From 85592c5fc054c07c39c959c89182c76a35f5fd59 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 16 Sep 2015 16:24:10 +1200 Subject: [PATCH] Bug 1189506. Use mProcessedTime/mStateComputedTime in ProduceDataForStreamsBlockByBlock. karlt --HG-- extra : commitid : 9tpkCW2vhWj extra : rebase_source : 17d886e7b7a51834dec6ea53e41a7f7ef08ec58b --- dom/media/MediaStreamGraph.cpp | 17 ++++++++--------- dom/media/MediaStreamGraphImpl.h | 6 ++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index c875d1801f2b..af846a6324d9 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -978,14 +978,12 @@ MediaStreamGraphImpl::RoundUpToNextAudioBlock(GraphTime aTime) void MediaStreamGraphImpl::ProduceDataForStreamsBlockByBlock(uint32_t aStreamIndex, - TrackRate aSampleRate, - GraphTime aFrom, - GraphTime aTo) + TrackRate aSampleRate) { MOZ_ASSERT(aStreamIndex <= mFirstCycleBreaker, "Cycle breaker is not AudioNodeStream?"); - GraphTime t = aFrom; - while (t < aTo) { + GraphTime t = mProcessedTime; + while (t < mStateComputedTime) { GraphTime next = RoundUpToNextAudioBlock(t); for (uint32_t i = mFirstCycleBreaker; i < mStreams.Length(); ++i) { auto ns = static_cast(mStreams[i]); @@ -995,12 +993,14 @@ MediaStreamGraphImpl::ProduceDataForStreamsBlockByBlock(uint32_t aStreamIndex, for (uint32_t i = aStreamIndex; i < mStreams.Length(); ++i) { ProcessedMediaStream* ps = mStreams[i]->AsProcessedStream(); if (ps) { - ps->ProcessInput(t, next, (next == aTo) ? ProcessedMediaStream::ALLOW_FINISH : 0); + ps->ProcessInput(t, next, + (next == mStateComputedTime) ? ProcessedMediaStream::ALLOW_FINISH : 0); } } t = next; } - NS_ASSERTION(t == aTo, "Something went wrong with rounding to block boundaries"); + NS_ASSERTION(t == mStateComputedTime, + "Something went wrong with rounding to block boundaries"); } bool @@ -1115,8 +1115,7 @@ MediaStreamGraphImpl::Process() #endif // Since an AudioNodeStream is present, go ahead and // produce audio block by block for all the rest of the streams. - ProduceDataForStreamsBlockByBlock(i, n->SampleRate(), - mProcessedTime, mStateComputedTime); + ProduceDataForStreamsBlockByBlock(i, n->SampleRate()); doneAllProducing = true; } else { ps->ProcessInput(mProcessedTime, mStateComputedTime, diff --git a/dom/media/MediaStreamGraphImpl.h b/dom/media/MediaStreamGraphImpl.h index 89da80abc567..16529331f618 100644 --- a/dom/media/MediaStreamGraphImpl.h +++ b/dom/media/MediaStreamGraphImpl.h @@ -304,15 +304,13 @@ public: */ GraphTime RoundUpToNextAudioBlock(GraphTime aTime); /** - * Produce data for all streams >= aStreamIndex for the given time interval. + * Produce data for all streams >= aStreamIndex for the current time interval. * Advances block by block, each iteration producing data for all streams * for a single block. * This is called whenever we have an AudioNodeStream in the graph. */ void ProduceDataForStreamsBlockByBlock(uint32_t aStreamIndex, - TrackRate aSampleRate, - GraphTime aFrom, - GraphTime aTo); + TrackRate aSampleRate); /** * If aStream will underrun between aTime, and aEndBlockingDecisions, returns * the time at which the underrun will start. Otherwise return