Loading services/audioflinger/AudioFlinger.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -3951,7 +3951,7 @@ void AudioFlinger::updateSecondaryOutputsForTrack_l( patchTrack->setPeerProxy(patchRecord, true /* holdReference */); patchRecord->setPeerProxy(patchTrack, false /* holdReference */); } track->setTeePatches(std::move(teePatches)); track->setTeePatchesToUpdate(std::move(teePatches)); } sp<AudioFlinger::SyncEvent> AudioFlinger::createSyncEvent(AudioSystem::sync_event_t type, Loading services/audioflinger/PlaybackTracks.h +4 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,9 @@ public: } sp<os::ExternalVibration> getExternalVibration() const { return mExternalVibration; } void setTeePatches(TeePatches teePatches); // This function should be called with holding thread lock. void updateTeePatches(); void setTeePatchesToUpdate(TeePatches teePatchesToUpdate); void tallyUnderrunFrames(size_t frames) override { if (isOut()) { // we expect this from output tracks only Loading Loading @@ -369,6 +371,7 @@ private: bool mPauseHwPending = false; // direct/offload track request for thread pause audio_output_flags_t mFlags; TeePatches mTeePatches; std::optional<TeePatches> mTeePatchesToUpdate; const float mSpeed; const bool mIsSpatialized; const bool mIsBitPerfect; Loading services/audioflinger/Threads.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -4104,6 +4104,10 @@ NO_THREAD_SAFETY_ANALYSIS // manual locking of AudioFlinger setHalLatencyMode_l(); for (const auto &track : mActiveTracks ) { track->updateTeePatches(); } // signal actual start of output stream when the render position reported by the kernel // starts moving. if (!mStandby && !mHalStarted && mKernelPositionOnStandby != Loading services/audioflinger/Tracks.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -1491,13 +1491,22 @@ void AudioFlinger::PlaybackThread::Track::copyMetadataTo(MetadataInserter& backI *backInserter++ = metadata; } void AudioFlinger::PlaybackThread::Track::setTeePatches(TeePatches teePatches) { void AudioFlinger::PlaybackThread::Track::updateTeePatches() { if (mTeePatchesToUpdate.has_value()) { forEachTeePatchTrack([](auto patchTrack) { patchTrack->destroy(); }); mTeePatches = std::move(teePatches); mTeePatches = mTeePatchesToUpdate.value(); if (mState == TrackBase::ACTIVE || mState == TrackBase::RESUMING || mState == TrackBase::STOPPING_1) { forEachTeePatchTrack([](auto patchTrack) { patchTrack->start(); }); } mTeePatchesToUpdate.reset(); } } void AudioFlinger::PlaybackThread::Track::setTeePatchesToUpdate(TeePatches teePatchesToUpdate) { ALOGW_IF(mTeePatchesToUpdate.has_value(), "%s, existing tee patches to update will be ignored", __func__); mTeePatchesToUpdate = std::move(teePatchesToUpdate); } // must be called with player thread lock held Loading Loading
services/audioflinger/AudioFlinger.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -3951,7 +3951,7 @@ void AudioFlinger::updateSecondaryOutputsForTrack_l( patchTrack->setPeerProxy(patchRecord, true /* holdReference */); patchRecord->setPeerProxy(patchTrack, false /* holdReference */); } track->setTeePatches(std::move(teePatches)); track->setTeePatchesToUpdate(std::move(teePatches)); } sp<AudioFlinger::SyncEvent> AudioFlinger::createSyncEvent(AudioSystem::sync_event_t type, Loading
services/audioflinger/PlaybackTracks.h +4 −1 Original line number Diff line number Diff line Loading @@ -186,7 +186,9 @@ public: } sp<os::ExternalVibration> getExternalVibration() const { return mExternalVibration; } void setTeePatches(TeePatches teePatches); // This function should be called with holding thread lock. void updateTeePatches(); void setTeePatchesToUpdate(TeePatches teePatchesToUpdate); void tallyUnderrunFrames(size_t frames) override { if (isOut()) { // we expect this from output tracks only Loading Loading @@ -369,6 +371,7 @@ private: bool mPauseHwPending = false; // direct/offload track request for thread pause audio_output_flags_t mFlags; TeePatches mTeePatches; std::optional<TeePatches> mTeePatchesToUpdate; const float mSpeed; const bool mIsSpatialized; const bool mIsBitPerfect; Loading
services/audioflinger/Threads.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -4104,6 +4104,10 @@ NO_THREAD_SAFETY_ANALYSIS // manual locking of AudioFlinger setHalLatencyMode_l(); for (const auto &track : mActiveTracks ) { track->updateTeePatches(); } // signal actual start of output stream when the render position reported by the kernel // starts moving. if (!mStandby && !mHalStarted && mKernelPositionOnStandby != Loading
services/audioflinger/Tracks.cpp +15 −6 Original line number Diff line number Diff line Loading @@ -1491,13 +1491,22 @@ void AudioFlinger::PlaybackThread::Track::copyMetadataTo(MetadataInserter& backI *backInserter++ = metadata; } void AudioFlinger::PlaybackThread::Track::setTeePatches(TeePatches teePatches) { void AudioFlinger::PlaybackThread::Track::updateTeePatches() { if (mTeePatchesToUpdate.has_value()) { forEachTeePatchTrack([](auto patchTrack) { patchTrack->destroy(); }); mTeePatches = std::move(teePatches); mTeePatches = mTeePatchesToUpdate.value(); if (mState == TrackBase::ACTIVE || mState == TrackBase::RESUMING || mState == TrackBase::STOPPING_1) { forEachTeePatchTrack([](auto patchTrack) { patchTrack->start(); }); } mTeePatchesToUpdate.reset(); } } void AudioFlinger::PlaybackThread::Track::setTeePatchesToUpdate(TeePatches teePatchesToUpdate) { ALOGW_IF(mTeePatchesToUpdate.has_value(), "%s, existing tee patches to update will be ignored", __func__); mTeePatchesToUpdate = std::move(teePatchesToUpdate); } // must be called with player thread lock held Loading