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

Commit 5461bcb4 authored by jiabin's avatar jiabin
Browse files

Reject start other output if bit-perfect output is active.

When bit-perfect output is active, all clients should be routed to
bit-perfect output if the selected output devices contain the
bit-perfect output device. In that case, when trying to start output on
other playback thread with the bit-perfect device, the start request
should fail to allow the client to reattach to the right playback
thread.

Bug: 391116315
Test: atest audiopolicy_tests
Flag: EXEMPT bugfix
Change-Id: Iac6a8621c9680908dce3628fe216086113605e2f
parent 2da34c08
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -2622,8 +2622,15 @@ status_t AudioPolicyManager::startSource(const sp<SwAudioOutputDescriptor>& outp
                // a volume ramp if there is no mute.
                requiresMuteCheck |= sharedDevice && isActive;

                if (needToCloseBitPerfectOutput && desc->isBitPerfect()) {
                if (desc->isBitPerfect()) {
                    if (needToCloseBitPerfectOutput) {
                        outputsToReopen.push_back(desc);
                    } else if (!desc->devices().filter(devices).isEmpty()) {
                        // There is an active bit-perfect playback on one of the targeted device,
                        // the client should be reattached to the bit-perfect thread.
                        ALOGD("%s, fails as there is bit-perfect playback active", __func__);
                        return DEAD_OBJECT;
                    }
                }
            }
        }