From 74a8690e5fa50d7f3da8c87e368c2071b86d948b Mon Sep 17 00:00:00 2001 From: Andreas Pehrson Date: Mon, 30 Nov 2020 14:16:31 +0000 Subject: [PATCH] Bug 1605134 - Rename StateComputedEnd to StateComputedTime. r=padenot StateComputedEnd was likely a typo back in the day. The member in the graph is mStateComputedTime, so let's center around that. Differential Revision: https://phabricator.services.mozilla.com/D97404 --- dom/media/GraphRunner.cpp | 6 +++--- dom/media/GraphRunner.h | 16 +++++++++------- dom/media/MediaTrackGraph.cpp | 16 ++++++++-------- dom/media/MediaTrackGraphImpl.h | 6 +++--- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/dom/media/GraphRunner.cpp b/dom/media/GraphRunner.cpp index e96a6bcd81bd..b437e097b05f 100644 --- a/dom/media/GraphRunner.cpp +++ b/dom/media/GraphRunner.cpp @@ -56,13 +56,13 @@ void GraphRunner::Shutdown() { mThread->Shutdown(); } -auto GraphRunner::OneIteration(GraphTime aStateEnd, GraphTime aIterationEnd, +auto GraphRunner::OneIteration(GraphTime aStateTime, GraphTime aIterationEnd, AudioMixer* aMixer) -> IterationResult { TRACE(); MonitorAutoLock lock(mMonitor); MOZ_ASSERT(mThreadState == ThreadState::Wait); - mIterationState = Some(IterationState(aStateEnd, aIterationEnd, aMixer)); + mIterationState = Some(IterationState(aStateTime, aIterationEnd, aMixer)); #ifdef DEBUG if (auto audioDriver = mGraph->CurrentDriver()->AsAudioCallbackDriver()) { @@ -113,7 +113,7 @@ NS_IMETHODIMP GraphRunner::Run() { } MOZ_DIAGNOSTIC_ASSERT(mIterationState.isSome()); TRACE(); - mIterationResult = mGraph->OneIterationImpl(mIterationState->StateEnd(), + mIterationResult = mGraph->OneIterationImpl(mIterationState->StateTime(), mIterationState->IterationEnd(), mIterationState->Mixer()); // Signal that mIterationResult was updated diff --git a/dom/media/GraphRunner.h b/dom/media/GraphRunner.h index ade8bbd948c6..c06b9fd577ac 100644 --- a/dom/media/GraphRunner.h +++ b/dom/media/GraphRunner.h @@ -35,7 +35,7 @@ class GraphRunner final : public Runnable { * Signals one iteration of mGraph. Hands state over to mThread and runs * the iteration there. */ - IterationResult OneIteration(GraphTime aStateEnd, GraphTime aIterationEnd, + IterationResult OneIteration(GraphTime aStateTime, GraphTime aIterationEnd, AudioMixer* aMixer); /** @@ -62,16 +62,18 @@ class GraphRunner final : public Runnable { ~GraphRunner(); class IterationState { - GraphTime mStateEnd; + GraphTime mStateTime; GraphTime mIterationEnd; AudioMixer* MOZ_NON_OWNING_REF mMixer; public: - IterationState(GraphTime aStateEnd, GraphTime aIterationEnd, + IterationState(GraphTime aStateTime, GraphTime aIterationEnd, AudioMixer* aMixer) - : mStateEnd(aStateEnd), mIterationEnd(aIterationEnd), mMixer(aMixer) {} + : mStateTime(aStateTime), + mIterationEnd(aIterationEnd), + mMixer(aMixer) {} IterationState& operator=(const IterationState& aOther) = default; - GraphTime StateEnd() const { return mStateEnd; } + GraphTime StateTime() const { return mStateTime; } GraphTime IterationEnd() const { return mIterationEnd; } AudioMixer* Mixer() const { return mMixer; } }; @@ -90,8 +92,8 @@ class GraphRunner final : public Runnable { enum class ThreadState { Wait, // Waiting for a message. This is the initial state. - // A transition from Run back to Wait occurs on the runner - // thread after it processes as far as mIterationState->mStateEnd + // A transition from Run back to Wait occurs on the runner thread + // after it processes as far as mIterationState->mStateTime // and sets mIterationResult. Run, // Set on driver thread after each mIterationState update. Shutdown, // Set when Shutdown() is called on main thread. diff --git a/dom/media/MediaTrackGraph.cpp b/dom/media/MediaTrackGraph.cpp index 346c80b66463..ed2c14ca1127 100644 --- a/dom/media/MediaTrackGraph.cpp +++ b/dom/media/MediaTrackGraph.cpp @@ -1365,17 +1365,17 @@ bool MediaTrackGraphImpl::UpdateMainThreadState() { return false; } -auto MediaTrackGraphImpl::OneIteration(GraphTime aStateEnd, +auto MediaTrackGraphImpl::OneIteration(GraphTime aStateTime, GraphTime aIterationEnd, AudioMixer* aMixer) -> IterationResult { if (mGraphRunner) { - return mGraphRunner->OneIteration(aStateEnd, aIterationEnd, aMixer); + return mGraphRunner->OneIteration(aStateTime, aIterationEnd, aMixer); } - return OneIterationImpl(aStateEnd, aIterationEnd, aMixer); + return OneIterationImpl(aStateTime, aIterationEnd, aMixer); } -auto MediaTrackGraphImpl::OneIterationImpl(GraphTime aStateEnd, +auto MediaTrackGraphImpl::OneIterationImpl(GraphTime aStateTime, GraphTime aIterationEnd, AudioMixer* aMixer) -> IterationResult { @@ -1406,14 +1406,14 @@ auto MediaTrackGraphImpl::OneIterationImpl(GraphTime aStateEnd, NS_ProcessPendingEvents(nullptr); } - GraphTime stateEnd = std::min(aStateEnd, GraphTime(mEndTime)); - UpdateGraph(stateEnd); + GraphTime stateTime = std::min(aStateTime, GraphTime(mEndTime)); + UpdateGraph(stateTime); - mStateComputedTime = stateEnd; + mStateComputedTime = stateTime; GraphTime oldProcessedTime = mProcessedTime; Process(aMixer); - MOZ_ASSERT(mProcessedTime == stateEnd); + MOZ_ASSERT(mProcessedTime == stateTime); UpdateCurrentTimeForTracks(oldProcessedTime); diff --git a/dom/media/MediaTrackGraphImpl.h b/dom/media/MediaTrackGraphImpl.h index 1988ffe1145a..b87ae6b635bb 100644 --- a/dom/media/MediaTrackGraphImpl.h +++ b/dom/media/MediaTrackGraphImpl.h @@ -222,14 +222,14 @@ class MediaTrackGraphImpl : public MediaTrackGraph, * OneIterationImpl is called directly. Output from the graph gets mixed into * aMixer, if it is non-null. */ - IterationResult OneIteration(GraphTime aStateEnd, GraphTime aIterationEnd, + IterationResult OneIteration(GraphTime aStateTime, GraphTime aIterationEnd, AudioMixer* aMixer) override; /** * Returns true if this MediaTrackGraph should keep running */ - IterationResult OneIterationImpl(GraphTime aStateEnd, GraphTime aIterationEnd, - AudioMixer* aMixer); + IterationResult OneIterationImpl(GraphTime aStateTime, + GraphTime aIterationEnd, AudioMixer* aMixer); /** * Called from the driver, when the graph thread is about to stop, to tell