Bug 1189506. Use mStateComputedTime in some places instead of passing aTo. r=karlt

--HG--
extra : commitid : LR21taIGcGM
extra : rebase_source : c228ba660e8ced61a17e9ec52fb47fff0d07b4c5
This commit is contained in:
Robert O'Callahan 2015-09-08 16:58:19 +12:00
Родитель 2ca14cc805
Коммит 7395a6b7fd
2 изменённых файлов: 15 добавлений и 13 удалений

Просмотреть файл

@ -648,7 +648,7 @@ MediaStreamGraphImpl::CreateOrDestroyAudioStreams(MediaStream* aStream)
} }
StreamTime StreamTime
MediaStreamGraphImpl::PlayAudio(MediaStream* aStream, GraphTime aTo) MediaStreamGraphImpl::PlayAudio(MediaStream* aStream)
{ {
MOZ_ASSERT(mRealtime, "Should only attempt to play audio in realtime mode"); MOZ_ASSERT(mRealtime, "Should only attempt to play audio in realtime mode");
@ -675,10 +675,10 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream, GraphTime aTo)
// from the right offsets in the stream buffer, even if we've already // from the right offsets in the stream buffer, even if we've already
// written silence for some amount of blocked time after the current time. // written silence for some amount of blocked time after the current time.
GraphTime t = mProcessedTime; GraphTime t = mProcessedTime;
while (t < aTo) { while (t < mStateComputedTime) {
bool blocked = t >= aStream->mStartBlocking; bool blocked = t >= aStream->mStartBlocking;
GraphTime end = blocked ? aTo : aStream->mStartBlocking; GraphTime end = blocked ? mStateComputedTime : aStream->mStartBlocking;
NS_ASSERTION(end <= aTo, "mStartBlocking is wrong!"); NS_ASSERTION(end <= mStateComputedTime, "mStartBlocking is wrong!");
// Check how many ticks of sound we can provide if we are blocked some // Check how many ticks of sound we can provide if we are blocked some
// time in the middle of this cycle. // time in the middle of this cycle.
@ -1083,7 +1083,7 @@ MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions)
} }
void void
MediaStreamGraphImpl::Process(GraphTime aTo) MediaStreamGraphImpl::Process()
{ {
// Play stream contents. // Play stream contents.
bool allBlockedForever = true; bool allBlockedForever = true;
@ -1116,12 +1116,13 @@ MediaStreamGraphImpl::Process(GraphTime aTo)
// Since an AudioNodeStream is present, go ahead and // Since an AudioNodeStream is present, go ahead and
// produce audio block by block for all the rest of the streams. // produce audio block by block for all the rest of the streams.
ProduceDataForStreamsBlockByBlock(i, n->SampleRate(), ProduceDataForStreamsBlockByBlock(i, n->SampleRate(),
mProcessedTime, aTo); mProcessedTime, mStateComputedTime);
doneAllProducing = true; doneAllProducing = true;
} else { } else {
ps->ProcessInput(mProcessedTime, aTo, ProcessedMediaStream::ALLOW_FINISH); ps->ProcessInput(mProcessedTime, mStateComputedTime,
ProcessedMediaStream::ALLOW_FINISH);
NS_WARN_IF_FALSE(stream->mBuffer.GetEnd() >= NS_WARN_IF_FALSE(stream->mBuffer.GetEnd() >=
GraphTimeToStreamTimeWithBlocking(stream, aTo), GraphTimeToStreamTimeWithBlocking(stream, mStateComputedTime),
"Stream did not produce enough data"); "Stream did not produce enough data");
} }
} }
@ -1131,7 +1132,7 @@ MediaStreamGraphImpl::Process(GraphTime aTo)
if (mRealtime) { if (mRealtime) {
CreateOrDestroyAudioStreams(stream); CreateOrDestroyAudioStreams(stream);
if (CurrentDriver()->AsAudioCallbackDriver()) { if (CurrentDriver()->AsAudioCallbackDriver()) {
StreamTime ticksPlayedForThisStream = PlayAudio(stream, aTo); StreamTime ticksPlayedForThisStream = PlayAudio(stream);
if (!ticksPlayed) { if (!ticksPlayed) {
ticksPlayed = ticksPlayedForThisStream; ticksPlayed = ticksPlayedForThisStream;
} else { } else {
@ -1224,7 +1225,7 @@ MediaStreamGraphImpl::OneIteration(GraphTime aStateEnd)
mStateComputedTime = stateEnd; mStateComputedTime = stateEnd;
Process(stateEnd); Process();
GraphTime oldProcessedTime = mProcessedTime; GraphTime oldProcessedTime = mProcessedTime;
mProcessedTime = stateEnd; mProcessedTime = stateEnd;

Просмотреть файл

@ -236,9 +236,10 @@ public:
mFrontMessageQueue.SwapElements(mBackMessageQueue); mFrontMessageQueue.SwapElements(mBackMessageQueue);
} }
/** /**
* Do all the processing and play the audio and video, ffrom aFrom to aTo. * Do all the processing and play the audio and video, from
* mProcessedTime to mStateComputedTime.
*/ */
void Process(GraphTime aTo); void Process();
/** /**
* Update the consumption state of aStream to reflect whether its data * Update the consumption state of aStream to reflect whether its data
* is needed or not. * is needed or not.
@ -345,7 +346,7 @@ public:
* Queue audio (mix of stream audio and silence for blocked intervals) * Queue audio (mix of stream audio and silence for blocked intervals)
* to the audio output stream. Returns the number of frames played. * to the audio output stream. Returns the number of frames played.
*/ */
StreamTime PlayAudio(MediaStream* aStream, GraphTime aTo); StreamTime PlayAudio(MediaStream* aStream);
/** /**
* Set the correct current video frame for stream aStream. * Set the correct current video frame for stream aStream.
*/ */