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

bluetooth: tester: audio: Add verification for bis stopping #79329

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Frodevan
Copy link
Contributor

@Frodevan Frodevan commented Oct 2, 2024

Adds a semaphor to make sure the stream has properly been stopped by the
controller before returning from btp_bap_broadcast_source_stop.

fixes: #73411

tests/bluetooth/tester/src/audio/btp/btp_bap.h Outdated Show resolved Hide resolved
tests/bluetooth/tester/src/audio/btp_bap_broadcast.c Outdated Show resolved Hide resolved
tests/bluetooth/tester/src/audio/btp_bap_broadcast.c Outdated Show resolved Hide resolved
Thalley
Thalley previously approved these changes Oct 2, 2024
@Frodevan Frodevan changed the title bluetooth: tester: audio: Add BIS stopped event BPT callback bluetooth: tester: audio: Add verification for bis stopping Oct 3, 2024
@Frodevan Frodevan requested a review from Thalley October 3, 2024 10:38
@Frodevan Frodevan marked this pull request as ready for review October 3, 2024 10:40
Comment on lines 499 to 508
err = k_sem_take(&sem_bis_stopped, K_MSEC(2000));
if (err != 0) {
LOG_DBG("Timed out waiting to stop BIS stream");

return BTP_STATUS_FAILED;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stream_stopped that gives sem_bis_stopped may be called multiple times.

You should take the same number of semaphores as we have streams.

Copy link
Contributor Author

@Frodevan Frodevan Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should now be resolved, if bt_bap_broadcast_source_stop stops broadcast source streams only.

@Frodevan Frodevan force-pushed the oct-3161 branch 3 times, most recently from 443be52 to d2a09d6 Compare October 3, 2024 11:25
@sjanc
Copy link
Collaborator

sjanc commented Oct 3, 2024

#AutoPTS run zephyr BAP/BSRC/SCC/BV-34-C

err = bt_bap_broadcast_source_stop(source->bap_broadcast);
if (err != 0) {
LOG_DBG("Unable to stop broadcast source: %d", err);

return BTP_STATUS_FAILED;
}

for (int i = 0; i < ARRAY_SIZE(source->streams); i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should check for actual number of streams, not max supported, shouldn't it?

Copy link
Contributor Author

@Frodevan Frodevan Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, must this be done by checking stream->in_use, or is this number stored somewhere in the source struct?

Copy link
Collaborator

@Thalley Thalley Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, must this be done by checking stream->in_use, or is this number stored somewhere in the source struct?

I don't think we currently store it anywhere, but it's pretty easy to just add a counter in the struct btp_bap_broadcast_remote_source so that we always know how many sem_stream_stopped we should expect if we ever start fewer than ARRAY_SIZE(source->streams) streams

Copy link
Contributor Author

@Frodevan Frodevan Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the count to the struct.

One observation along the way, I am not sure setup_broadcast_source in btp_bap_broadcast is supposed to set up subgroups and streams separately like it is doing, unless every broadcast source stream is shared among each subgroup.. However, this makes me unsure if stream_stopped will be called streams_per_subgroup times, or streams_per_subgroup multiplied with the number of subgroups times. Of course, this is not relevant if number of subgroups is always 1.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stream_stopped will be called per stream, regardless of the number of subgroups

@codecoup-tester
Copy link

Scheduled PR #79329 (comment), board: nrf53, estimated start time: 13:34:00, test case count: 1, estimated duration: 0:00:20

Test cases to be runBAP/BSRC/SCC/BV-34-C

@codecoup-tester
Copy link

AutoPTS Bot results:
No failed test found.

Successful tests (1)BAP BAP/BSRC/SCC/BV-34-C PASS

Adds a semaphor to make sure the stream has properly been stopped by the
controller before returning from btp_bap_broadcast_source_stop.

Signed-off-by: Frode van der Meeren <[email protected]>
Copy link
Collaborator

@Thalley Thalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me. Not sure about the timeout of 2000 ms, but I'll leave that to @sjanc :)

@Frodevan
Copy link
Contributor Author

Frodevan commented Oct 3, 2024

My reasoning for the timeout is that I have not checked if there is another timeout for this call in Auto-PTS, so a potential infinite wait here will have far greater consequences for a (typically very long) test run than just an error-code returned during a test-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Audio area: Bluetooth Qualification Bluetooth Qualification -related issues and pull requests area: Bluetooth
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

LE Audio: Tester: Broadcast too eager to reconfigure
5 participants