MrBuddyCasino / ESP32_MP3_Decoder

A internet radio and bluetooth speaker project for the Espressif ESP32
782 stars 182 forks source link

PDM fails to play after half an audio data packet on bluetooth(p_data is null) #14

Open joeybab3 opened 7 years ago

joeybab3 commented 7 years ago

After getting it to work(note: cmd is not gnd...), I was playing around with it and I can't get it to play over bluetooth when the audio mode is set to pdm. It gives the error below:

I (2549) main: RAM left 134032
E (21349) BT: btm_sec_conn_req

E (21369) BT: btm_sec_connected

I (21879) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (21879) BT_AV: a2dp conn_state_cb, state 1
I (22369) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x2
I (22369) BT_AV: a2dp audio_cfg_cb , codec type 0
I (22369) BT_AV: audio player configured
E (22899) BT: bta_dm_rm_cback:0, status:0
I (22899) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (22899) BT_AV: a2dp conn_state_cb, state 2
E (23809) BT: process_service_search_attr_rsp

E (23959) BT: bta_av_rc_opened allow incoming AVRCP connections:1
E (23959) BT: bta_av_rc_opened rcb[0] shdl:1 lidx:1/0
I (23969) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x0
I (23969) BT_AV: avrc conn_state evt: state 1, feature 0x259, [9c:2a:83:2c:d5:d6
]
E (29339) BT: bta_av_proc_stream_evt: p_data is null
E (29339) BT: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:
x8202

E (29339) BT: bta_dm_rm_cback:0, status:0
E (29339) BT: bta_dm_rm_cback:0, status:7
E (29349) BT: BTA_AV_START_EVT status 0, suspending 0, init 0

I (29349) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x1
I (29359) BT_AV: a2dp audio_state_cb state 2
E (31539) BT_AV: audio data pkt cnt 100

and just sounds like it repeats the same sample over and over. It doesn't have this issue when streaming over wifi.

MrBuddyCasino commented 7 years ago

Thanks for the report, I'll look into it as soon as I find the time.

fanthos commented 7 years ago

I got the same error after pkt count 700 printed, and have to reset the esp32 to get bluetooth works again.

Adding log to memory that I got this:

E (14625) BT: BTA_AV_START_EVT status 0, suspending 0, init 0
I (14635) BT_APP_CORE: bt_app_task_handler, sig 0x1, 0x1␛[0m
I (14635) BT_AV: a2dp audio_state_cb state 2␛[0m
I (16795) BT_AV: RAM left: 121092␛[0m
E (16795) BT_AV: audio data pkt cnt 100␛[0m
I (18975) BT_AV: RAM left: 114172␛[0m
E (18975) BT_AV: audio data pkt cnt 200␛[0m
I (21155) BT_AV: RAM left: 106804␛[0m
E (21155) BT_AV: audio data pkt cnt 300␛[0m
I (23335) BT_AV: RAM left: 98008␛[0m
E (23335) BT_AV: audio data pkt cnt 400␛[0m
I (25515) BT_AV: RAM left: 90316␛[0m
E (25515) BT_AV: audio data pkt cnt 500␛[0m
I (27695) BT_AV: RAM left: 81732␛[0m
E (27695) BT_AV: audio data pkt cnt 600␛[0m
I (29885) BT_AV: RAM left: 118484␛[0m
E (29885) BT_AV: audio data pkt cnt 700␛[0m

Maybe memory related?

This issue only happens pkt cnt 700+. Pause and play would clear the counter.

I also found that PDM with webradio will stop play after relative long of time, about half hour or more. The esp32 wont load any mp3 file. It works again after push the reset button. Bluetooth with DAC seems works great.