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

Commit 257db749 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Propagate setPreferredDevice to ClientDescriptor when AudioTrack is not playing" into main

parents 06267d9d efc130c6
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