Skip to content

Commit

Permalink
CRAS: reset active a2dp device only when inactivating
Browse files Browse the repository at this point in the history
We used to call |reset_active_device| whenever there is a call to change
the |active| state of an A2DP iodev, as a precautionary measure to
cleanup internal states in the BT stack.

However, this could be an issue when the transition is |active->active|
because by resetting the device there will be a short time where the
socket cannot be written.

Since we have sufficient understanding of the specific internal states
that need to be cleaned up, after this CL we will only reset when
inactivating.

BUG=b:307228349
TEST=Verify bug cannot be reproduced

Change-Id: I76d244a569244d552d3a3131d28f1d533d39b798
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/4997244
Auto-Submit: Jeremy Wu <jrwu@google.com>
Reviewed-by: En-Shuo Hsu <enshuo@chromium.org>
Commit-Queue: En-Shuo Hsu <enshuo@chromium.org>
Tested-by: Jeremy Wu <jrwu@google.com>
  • Loading branch information
Jeremy Wu authored and Chromeos LUCI committed Nov 1, 2023
1 parent bee8923 commit 81ff79b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cras/src/server/cras_a2dp_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,14 @@ int cras_floss_a2dp_start(struct cras_a2dp* a2dp,
}

void cras_floss_a2dp_set_active(struct cras_a2dp* a2dp, unsigned enabled) {
/* Clear session. */
floss_media_a2dp_reset_active_device(a2dp->fm);
if (enabled) {
/* Set the connected a2dp device to be active. This is required
* for other profiles (e.g., AVRCP) depending on the active a2dp
* status to work. */
floss_media_a2dp_set_active_device(a2dp->fm, a2dp->addr);
} else {
/* Clear session. */
floss_media_a2dp_reset_active_device(a2dp->fm);
}
}

Expand Down

0 comments on commit 81ff79b

Please sign in to comment.