ESP32 LyraT v4.3控制手机端QQ音乐阻塞

18792664440
Posts: 2
Joined: Fri Jan 07, 2022 3:23 am

ESP32 LyraT v4.3控制手机端QQ音乐阻塞

Postby 18792664440 » Fri Jan 07, 2022 4:07 am

开发环境:
系统:win10 20H2
开发板:LyraT v4.3
IDF: IDF 4.3.2
ADF: ADF 2.3
QQ音乐:11.0.5

问题:运行ADF例程examples\player\pipeline_bt_sink,使用QQ音乐播放歌曲过程中,
开发板touch按键发生阻塞,直到手机端暂停歌曲播放才能,按键回调才能响应。
touch按键触发以后立刻打印
I (71925) BLUETOOTH_EXAMPLE: [ * ] [Play] touch tap event
但是直到手机端暂停才打印如下部分:
key_ctrl cb: tl 5, state: 0key_ctrl cb: tl 6, state: 1key_ctrl cb: tl 7, state: 2I (90985) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

I (1155685) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

I (1856005) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

期望达到效果:touch按键触发以后,手机端能够立刻响应控制事件,而不是阻塞到音乐播放暂停以后才响应。
我应该怎么修改代码,或是使用什么开发环境?

完整问题日志:
I (56) boot: Partition Table:
I (60) boot: ## Label Usage Type ST Offset Length
I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (75) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (82) boot: 2 factory factory app 00 00 00010000 00124f80
I (90) boot: End of partition table
I (94) boot_comm: chip revision: 1, min. application chip revision: 0
I (101) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=2d34ch (185164) map
I (179) esp_image: segment 1: paddr=0003d374 vaddr=3ffbdb60 size=02ca4h ( 11428) load
I (184) esp_image: segment 2: paddr=00040020 vaddr=400d0020 size=ae884h (714884) map
I (455) esp_image: segment 3: paddr=000ee8ac vaddr=3ffc0804 size=01368h ( 4968) load
I (457) esp_image: segment 4: paddr=000efc1c vaddr=40080000 size=18b6ch (101228) load
I (504) esp_image: segment 5: paddr=00108790 vaddr=50000000 size=00010h ( 16) load
I (517) boot: Loaded app from partition at offset 0x10000
I (517) boot: Disabling RNG early entropy source...
I (529) cpu_start: Pro cpu up.
I (529) cpu_start: Starting app cpu, entry point is 0x400814d4
0x400814d4: call_start_cpu1 at D:/esp/esp-idf/components/esp_system/port/cpu_start.c:141

I (0) cpu_start: App cpu up.
I (545) cpu_start: Pro cpu start user code
I (545) cpu_start: cpu freq: 160000000
I (546) cpu_start: Application information:
I (550) cpu_start: Project name: play_bt_music
I (555) cpu_start: App version: v2.3-dirty
I (561) cpu_start: Compile time: Jan 7 2022 10:17:42
I (567) cpu_start: ELF file SHA256: 3de5c7c9941996fc...
I (573) cpu_start: ESP-IDF: v4.3-dirty
I (578) heap_init: Initializing. RAM available for dynamic allocation:
I (585) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (591) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (597) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (603) heap_init: At 3FFCB2C0 len 00014D40 (83 KiB): DRAM
I (610) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (616) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (622) heap_init: At 40098B6C len 00007494 (29 KiB): IRAM
I (630) spi_flash: detected chip: gd
I (633) spi_flash: flash io: dio
I (638) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (685) BLUETOOTH_EXAMPLE: [ 1 ] Create Bluetooth service
I (685) BTDM_INIT: BT controller compile version [1342a48]
I (685) system_api: Base MAC address is not set
I (685) system_api: read default base MAC address from EFUSE
I (695) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
W (1375) BT_BTC: A2DP Enable with AVRC
I (1395) BLUETOOTH_EXAMPLE: [ 2 ] Start codec chip
I (1405) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
res 0
i2c_init i2c_handle 0x3ffcac30
I (1425) ES8388_DRIVER: init,out:02, in:00
volume 33
I (1425) AUDIO_HAL: Codec mode is 2, Ctrl:1
I (1435) BLUETOOTH_EXAMPLE: [ 3 ] Create audio pipeline for playback
I (1435) BLUETOOTH_EXAMPLE: [3.1] Create i2s stream to write data to codec chip
I (1435) I2S: DMA Malloc info, datalen=blocksize=1200, dma_buf_count=3
I (1445) I2S: DMA Malloc info, datalen=blocksize=1200, dma_buf_count=3
I (1475) I2S: APLL: Req RATE: 44100, real rate: 44099.988, BITS: 16, CLKM: 1, BCK_M: 8, MCLK: 11289597.000, SCLK: 1411199.625000, diva: 1, divb: 0
I (1485) LYRAT_V4_3: I2S0, MCLK output by GPIO0
I (1485) BLUETOOTH_EXAMPLE: [3.2] Get Bluetooth stream
I (1495) BLUETOOTH_EXAMPLE: [3.2] Register all elements to audio pipeline
I (1505) BLUETOOTH_EXAMPLE: [3.3] Link it together [Bluetooth]-->bt_stream_reader-->i2s_stream_writer-->[codec_chip]
I (1515) AUDIO_PIPELINE: link el->rb, el:0x3ffd8834, tag:bt, rb:0x3ffd8bb0
I (1515) BLUETOOTH_EXAMPLE: [ 4 ] Initialize peripherals
E (1525) gpio: gpio_install_isr_service(460): GPIO isr service already installed
I (1535) BLUETOOTH_EXAMPLE: [4.1] Initialize Touch peripheral
I (1535) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
I (1545) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
I (1555) BLUETOOTH_EXAMPLE: [4.2] Create Bluetooth peripheral
W (1575) PERIPH_TOUCH: _touch_init
I (1575) BLUETOOTH_EXAMPLE: [4.2] Start all peripherals
I (1585) BLUETOOTH_EXAMPLE: [ 5 ] Set up event listener
I (1585) BLUETOOTH_EXAMPLE: [5.1] Listening event from all elements of pipeline
I (1595) BLUETOOTH_EXAMPLE: [5.2] Listening event from peripherals
I (1615) BLUETOOTH_EXAMPLE: [ 6 ] Start audio_pipeline
I (1615) AUDIO_ELEMENT: [bt-0x3ffd8834] Element task created
I (1615) AUDIO_ELEMENT: [i2s-0x3ffd671c] Element task created
I (1625) AUDIO_PIPELINE: Func:audio_pipeline_run, Line:359, MEM Total:135748 Bytes

I (1625) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_RESUME,state:1
I (1635) I2S_STREAM: AUDIO_STREAM_WRITER
I (1635) AUDIO_PIPELINE: Pipeline started
I (1655) BLUETOOTH_EXAMPLE: [ 7 ] Listen for all pipeline events
E (6205) BT_APPL: bta_av_rc_create ACP handle exist for shdl:0
I (6225) BLUETOOTH_EXAMPLE: [ * ] Receive music info from Bluetooth, sample_rates=44100, bits=16, ch=2
W (6245) BT_APPL: new conn_srvc id:19, app_id:0
I (6255) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_PAUSE
I (6345) I2S: APLL: Req RATE: 44100, real rate: 44099.988, BITS: 16, CLKM: 1, BCK_M: 8, MCLK: 11289597.000, SCLK: 1411199.625000, diva: 1, divb: 0
I (6355) AUDIO_ELEMENT: [i2s] AEL_MSG_CMD_RESUME,state:4
I (6365) I2S_STREAM: AUDIO_STREAM_WRITER
I (13275) BLUETOOTH_EXAMPLE: [ * ] [Vol+] touch tap event
key_ctrl cb: tl 0, state: 0key_ctrl cb: tl 0, state: 1I (14635) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

W (14645) BT_APPL: new conn_srvc id:19, app_id:1
key_ctrl cb: tl 1, state: 2I (20175) BLUETOOTH_EXAMPLE: [ * ] [Vol+] touch tap event
key_ctrl cb: tl 1, state: 0key_ctrl cb: tl 2, state: 1key_ctrl cb: tl 3, state: 2I (38595) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

I (68625) BLUETOOTH_EXAMPLE: [ * ] [Play] touch tap event
key_ctrl cb: tl 3, state: 0key_ctrl cb: tl 4, state: 1key_ctrl cb: tl 5, state: 2I (69475) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

I (71925) BLUETOOTH_EXAMPLE: [ * ] [Play] touch tap event
key_ctrl cb: tl 5, state: 0key_ctrl cb: tl 6, state: 1key_ctrl cb: tl 7, state: 2I (90985) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

I (1155685) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

I (1856005) BT_LOG: bta_av_link_role_ok hndl:x41 role:1 conn_audio:x1 bits:1 features:x824b

ESP_HengYC
Posts: 184
Joined: Fri Dec 15, 2017 2:45 am

Re: ESP32 LyraT v4.3控制手机端QQ音乐阻塞

Postby ESP_HengYC » Wed Mar 09, 2022 3:05 am

你好,

你可以把 [url]#define INPUT_KEY_SERVICE_TASK_PRIORITY (5)[https://github.com/espressif/esp-adf/bl ... vice.h#L39] 这个 按键任务的优先级提高到 15 试试? 这可能是 bt 高优任务 占用了 CPU 。

18792664440
Posts: 2
Joined: Fri Jan 07, 2022 3:23 am

Re: ESP32 LyraT v4.3控制手机端QQ音乐阻塞

Postby 18792664440 » Wed Mar 09, 2022 10:35 am

感谢回复:
我已经使用pipeline_a2dp_sink_stream中的例程,没有这个问题。

Who is online

Users browsing this forum: No registered users and 39 guests