Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b40472ac authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Propagate setPreferredDevice to ClientDescriptor when AudioTrack is not...

Merge "Propagate setPreferredDevice to ClientDescriptor when AudioTrack is not playing" into main am: 257db749 am: 079cfa4d am: 80ffb9b0

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2907580



Change-Id: Idca3def28327d0001bcbddd199a1b96f77e5f780
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 3ce137c4 80ffb9b0
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1704,10 +1704,14 @@ status_t AudioTrack::setOutputDevice(audio_port_handle_t deviceId) {
            __func__, mPortId, deviceId, mSelectedDeviceId, mRoutedDeviceId);
    if (mSelectedDeviceId != deviceId) {
        mSelectedDeviceId = deviceId;
        if (mStatus == NO_ERROR && mSelectedDeviceId != mRoutedDeviceId) {
        if (mStatus == NO_ERROR) {
            // allow track invalidation when track is not playing to propagate
            // the updated mSelectedDeviceId
            if (isPlaying_l()) {
                if (mSelectedDeviceId != mRoutedDeviceId) {
                    android_atomic_or(CBLK_INVALID, &mCblk->mFlags);
                    mProxy->interrupt();
                }
            } else {
                // if the track is idle, try to restore now and
                // defer to next start if not possible