-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Bluetooth: audio: ascs: Fix possible race condition #52214
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
Bluetooth: audio: ascs: Fix possible race condition #52214
Conversation
|
I tried this one against PTS BAP/USR/SCC/BV-158-C and AOSP media, call |
a2effa8 to
5761b5d
Compare
Thalley
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments, which needs to ether be fixed or at least commented on. The fix for the state change to streaming should probably be done as part of #51030
subsys/bluetooth/audio/ascs.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this part was just moved, and it seems like the removal of this is missing from #51030: But ideally Sink ASEs should never autonousmly go into the streaming state - This should only happen as part of calling bt_audio_stream_start on the server side for Sink ASEs, as the Unicast Server application may want to delay going into the streaming state to setup anything related to processing audio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I'm moving the code only, I would rather leave the logic unchanged for now. This can be fixed in another PR
subsys/bluetooth/audio/ascs.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my previous comment about autonomously going into the streaming state
5761b5d to
23df7d4
Compare
7c4e3d5 to
c6daa4f
Compare
subsys/bluetooth/audio/ascs.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I'm not that much familiar with this code, but this & suggests that ase is container of ep, so this function can be called with ep from some other "pool"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I did not put much thought while rebasing the code. Looks like I can simply use CONTAINER_OF to get the ASE object
This fixes possible ASE state race condition. The notification is sent immediately once the ASE state changed that eliminates a situation where the state was changed by user action (API function call) when the state was not yet notified to the remote Unicast Client. Fixes: BAP/USR/SCC/BV-158-C Signed-off-by: Mariusz Skamra <[email protected]>
5e8d806
c6daa4f to
5e8d806
Compare
This fixes possible ASE state race condition. The notification is sent immediately once the ASE state changed that eliminates a situation where the state was changed by user action (API function call) when the state was not yet notified to the remote Unicast Client.
Fixes: BAP/USR/SCC/BV-158-C
Signed-off-by: Mariusz Skamra [email protected]