Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classic BT AVRC passthrough command not working while media is playing (IDFGH-5348) #7100

Closed
spleen1981 opened this issue Jun 3, 2021 · 5 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@spleen1981
Copy link

Hi,
sending AVRC passthrough commands (e.g. ESP_AVRC_PT_CMD_FORWARD) to connected peer while media is playing (works ok if media is not playing) from ESP32 A2DP sink seems to be broken with ESP IDF 4.2.1 (same with 4.3beta2), while with 4.2.0 same code works ok.
esp_avrc_ct_send_passthrough_cmd returns ESP_OK, but no event is received in relevant callback function.
Commands seems to be somehow queued, as when media is stopped from peer device, all previous passthrough commands sent are executed in series.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jun 3, 2021
@github-actions github-actions bot changed the title Classic BT AVRC passthrough command not working while media is playing Classic BT AVRC passthrough command not working while media is playing (IDFGH-5348) Jun 3, 2021
@Alvin1Zhang
Copy link
Collaborator

@spleen1981 Thanks for reporting. Would you please help provide more details as suggested in the issue template? Information like elf, sdk configuration, backtrace, log outputs, commit ID, hardware and etc. would help us debug further. Thanks.

@spleen1981
Copy link
Author

spleen1981 commented Jun 4, 2021

@Alvin1Zhang

Environment

  • Module or chip used: ESP32-WROOM-32
  • IDF version (run git describe --tags to find it): v4.2.1
  • Build System: idf.py
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it): xtensa-esp32-elf-gcc (crosstool-NG esp-2020r3) 8.4.0
  • Operating System: Windows
  • (Windows only) environment type: Plain Command Prompt
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

Sending AVRC passthrough commands (e.g. ESP_AVRC_PT_CMD_FORWARD) to connected peer while media is playing (works ok if media is not playing) from ESP32 A2DP sink seems to be broken with ESP IDF 4.2.1 (same with 4.3beta2), while with 4.2.0 same code works ok.
esp_avrc_ct_send_passthrough_cmd returns ESP_OK, but no event is received in relevant callback function.
Commands seems to be somehow queued, as when media is stopped from peer device, all previous passthrough commands sent are executed in series.

Expected Behavior

esp_avrc_ct_send_passthrough_cmd sent to peer and event received in relevant callback function even if media is playing.

Actual Behavior

esp_avrc_ct_send_passthrough_cmd not sent to peer and event not received in relevant callback function if media is playing.
Commands seems to be somehow queued, as when media is stopped from peer device, all previous passthrough commands sent are executed in series.

Steps to reproduce

  1. compile and upload attached source (AD2P example with additional task sending passthrough commands every 10 seconds starting when AVRC is connected)
  2. connect peer
  3. play media from peer

Code to reproduce this issue

Refer to attached source (AD2P example with additional task sending passthrough commands every 10 seconds starting when AVRC is connected).

Debug Logs

W (26735) BT_APPL: new conn_srvc id:19, app_id:1
I (26735) BT_AV: A2DP audio state: Started
I (26735) RCCT: AVRC event notification: 1
I (26745) BT_AV: Playback status changed: 0x1
I (26745) RCCT: AVRC event notification: 5
I (26755) BT_AV: Play position changed: 0-ms
I (28035) RCCT: Test passthrough command sent, result 0

I (29015) BT_AV: Audio packet count 100
I (31045) BT_AV: Audio packet count 200
I (33045) BT_AV: Audio packet count 300
I (35045) BT_AV: Audio packet count 400
I (37025) BT_AV: Audio packet count 500
I (38035) RCCT: Test passthrough command sent, result 0

I (39025) BT_AV: Audio packet count 600
I (41025) BT_AV: Audio packet count 700
I (43025) BT_AV: Audio packet count 800
I (45025) BT_AV: Audio packet count 900
I (47035) BT_AV: Audio packet count 1000
I (48035) RCCT: Test passthrough command sent, result 0

I (49025) BT_AV: Audio packet count 1100
I (51025) BT_AV: Audio packet count 1200
I (53025) BT_AV: Audio packet count 1300
I (55025) BT_AV: Audio packet count 1400
I (57025) BT_AV: Audio packet count 1500
I (58035) RCCT: Test passthrough command sent, result 0

I (59025) BT_AV: Audio packet count 1600
I (61015) BT_AV: Audio packet count 1700
I (63045) BT_AV: Audio packet count 1800
I (65045) BT_AV: Audio packet count 1900
I (67045) BT_AV: Audio packet count 2000
I (68035) RCCT: Test passthrough command sent, result 0

I (69045) BT_AV: Audio packet count 2100
I (71025) BT_AV: Audio packet count 2200
I (73025) BT_AV: Audio packet count 2300
I (75025) BT_AV: Audio packet count 2400
I (77025) BT_AV: Audio packet count 2500
I (78035) RCCT: Test passthrough command sent, result 0

I (79025) BT_AV: Audio packet count 2600
I (81035) BT_AV: Audio packet count 2700
I (83025) BT_AV: Audio packet count 2800
I (85025) BT_AV: Audio packet count 2900
I (87025) BT_AV: Audio packet count 3000
I (88035) RCCT: Test passthrough command sent, result 0

I (89025) BT_AV: Audio packet count 3100
I (89525) RCCT: AVRC event notification: 5
I (89525) BT_AV: Play position changed: 10124-ms
I (89525) RCCT: AVRC event notification: 2
I (90125) RCCT: AVRC passthrough rsp: key_code 0x4b, key_state 0
I (90135) RCCT: AVRC passthrough rsp: key_code 0x4c, key_state 0
I (90135) RCCT: AVRC passthrough rsp: key_code 0x4b, key_state 0
I (90135) RCCT: AVRC passthrough rsp: key_code 0x4c, key_state 0
I (90145) RCCT: AVRC passthrough rsp: key_code 0x4b, key_state 0
I (90155) RCCT: AVRC passthrough rsp: key_code 0x4c, key_state 0
I (90155) RCCT: AVRC passthrough rsp: key_code 0x4b, key_state 0
I (91175) BT_AV: A2DP audio state: Suspended

a2dp_sink_passthrough_test.zip

@boblane1
Copy link
Collaborator

Hi spleen1981,

Would you please try the following patch to see if the problem still exists?

Thanks.
0001-fix-a2dp-sink-RxSbcQ-bugs.zip

@spleen1981
Copy link
Author

@boblane1 problem seems to be fixed with this patch.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new labels Jun 22, 2021
projectgus pushed a commit that referenced this issue Jun 30, 2021
espressif-bot pushed a commit that referenced this issue Jul 18, 2021
espressif-bot pushed a commit that referenced this issue Aug 24, 2021
espressif-bot pushed a commit that referenced this issue Aug 30, 2021
@pad52
Copy link

pad52 commented Aug 8, 2023

I'm experiencing again the problem with new commits of the btc_a2dp_sink.c
with @boblane1 version problem was gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

5 participants