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

Commit a5281065 authored by jiabin's avatar jiabin
Browse files

Invalidate compressed tracks when secondary outputs are changed.

As compressed tracks are not supported for playback capture, it will
cause crash when secondary outputs are changed and it is only updated
with secondary outputs. In that case, invalidating offload tracks
when secondary outputs are changed to trigger recreation.

Test: atest AudioPlaybackCaptureTest
Bug: 207152962
Change-Id: Iff6ea6f4797dbd160b1e0169f375062725a670af
parent 159257a4
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -5958,6 +5958,11 @@ void AudioPolicyManager::checkSecondaryOutputs() {
                    client->getSecondaryOutputs().begin(),
                    client->getSecondaryOutputs().end(),
                    secondaryDescs.begin(), secondaryDescs.end())) {
                if (!audio_is_linear_pcm(client->config().format)) {
                    // If the format is not PCM, the tracks should be invalidated to get correct
                    // behavior when the secondary output is changed.
                    streamsToInvalidate.insert(client->stream());
                } else {
                    std::vector<wp<SwAudioOutputDescriptor>> weakSecondaryDescs;
                    std::vector<audio_io_handle_t> secondaryOutputIds;
                    for (const auto &secondaryDesc: secondaryDescs) {
@@ -5969,6 +5974,7 @@ void AudioPolicyManager::checkSecondaryOutputs() {
                }
            }
        }
    }
    if (!trackSecondaryOutputs.empty()) {
        mpClientInterface->updateSecondaryOutputs(trackSecondaryOutputs);
    }