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

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

Merge "Invalidate all other clients when bit-perfect playback becomes active."...

Merge "Invalidate all other clients when bit-perfect playback becomes active." into udc-qpr-dev am: c120d093

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



Change-Id: I543892b5e0952f1c2f39fb1c2d4a381c9ecd4ac1
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9c0160d8 c120d093
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -2153,6 +2153,26 @@ status_t AudioPolicyManager::startOutput(audio_port_handle_t portId)
                return DEAD_OBJECT;
            }
            info->increaseActiveClient();
            if (info->getActiveClientCount() == 1 &&
                (info->getFlags() & AUDIO_OUTPUT_FLAG_BIT_PERFECT) != AUDIO_OUTPUT_FLAG_NONE) {
                // If it is first bit-perfect client, reroute all clients that will be routed to
                // the bit-perfect sink so that it is guaranteed only bit-perfect stream is active.
                PortHandleVector clientsToInvalidate;
                for (size_t i = 0; i < mOutputs.size(); i++) {
                    if (mOutputs[i] == outputDesc ||
                        !mOutputs[i]->devices().filter(outputDesc->devices()).isEmpty()) {
                        continue;
                    }
                    for (const auto& c : mOutputs[i]->getClientIterable()) {
                        clientsToInvalidate.push_back(c->portId());
                    }
                }
                if (!clientsToInvalidate.empty()) {
                    ALOGD("%s Invalidate clients due to first bit-perfect client started",
                          __func__);
                    mpClientInterface->invalidateTracks(clientsToInvalidate);
                }
            }
        }
    }