зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1189506. Use mProcessedTime in some places instead of passing aFrom. r=karlt
--HG-- extra : commitid : 332ie8PhPom extra : rebase_source : 7ff2eaff9a3a7b12208a06e99233aea523143fb9
This commit is contained in:
Родитель
c4f0cbe5be
Коммит
2ca14cc805
|
@ -592,8 +592,7 @@ MediaStreamGraphImpl::NotifyHasCurrentData(MediaStream* aStream)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTime,
|
MediaStreamGraphImpl::CreateOrDestroyAudioStreams(MediaStream* aStream)
|
||||||
MediaStream* aStream)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mRealtime, "Should only attempt to create audio streams in real-time mode");
|
MOZ_ASSERT(mRealtime, "Should only attempt to create audio streams in real-time mode");
|
||||||
|
|
||||||
|
@ -624,7 +623,7 @@ MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTim
|
||||||
} else {
|
} else {
|
||||||
MediaStream::AudioOutputStream* audioOutputStream =
|
MediaStream::AudioOutputStream* audioOutputStream =
|
||||||
aStream->mAudioOutputStreams.AppendElement();
|
aStream->mAudioOutputStreams.AppendElement();
|
||||||
audioOutputStream->mAudioPlaybackStartTime = aAudioOutputStartTime;
|
audioOutputStream->mAudioPlaybackStartTime = mProcessedTime;
|
||||||
audioOutputStream->mBlockedAudioTime = 0;
|
audioOutputStream->mBlockedAudioTime = 0;
|
||||||
audioOutputStream->mLastTickWritten = 0;
|
audioOutputStream->mLastTickWritten = 0;
|
||||||
audioOutputStream->mTrackID = tracks->GetID();
|
audioOutputStream->mTrackID = tracks->GetID();
|
||||||
|
@ -649,8 +648,7 @@ MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTim
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamTime
|
StreamTime
|
||||||
MediaStreamGraphImpl::PlayAudio(MediaStream* aStream,
|
MediaStreamGraphImpl::PlayAudio(MediaStream* aStream, GraphTime aTo)
|
||||||
GraphTime aFrom, GraphTime aTo)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mRealtime, "Should only attempt to play audio in realtime mode");
|
MOZ_ASSERT(mRealtime, "Should only attempt to play audio in realtime mode");
|
||||||
|
|
||||||
|
@ -669,14 +667,14 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream,
|
||||||
AudioSegment* audio = track->Get<AudioSegment>();
|
AudioSegment* audio = track->Get<AudioSegment>();
|
||||||
AudioSegment output;
|
AudioSegment output;
|
||||||
|
|
||||||
StreamTime offset = GraphTimeToStreamTimeWithBlocking(aStream, aFrom);
|
StreamTime offset = GraphTimeToStreamTimeWithBlocking(aStream, mProcessedTime);
|
||||||
|
|
||||||
// We don't update aStream->mBufferStartTime here to account for time spent
|
// We don't update aStream->mBufferStartTime here to account for time spent
|
||||||
// blocked. Instead, we'll update it in UpdateCurrentTimeForStreams after
|
// blocked. Instead, we'll update it in UpdateCurrentTimeForStreams after
|
||||||
// the blocked period has completed. But we do need to make sure we play
|
// the blocked period has completed. But we do need to make sure we play
|
||||||
// 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 = aFrom;
|
GraphTime t = mProcessedTime;
|
||||||
while (t < aTo) {
|
while (t < aTo) {
|
||||||
bool blocked = t >= aStream->mStartBlocking;
|
bool blocked = t >= aStream->mStartBlocking;
|
||||||
GraphTime end = blocked ? aTo : aStream->mStartBlocking;
|
GraphTime end = blocked ? aTo : aStream->mStartBlocking;
|
||||||
|
@ -1085,7 +1083,7 @@ MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaStreamGraphImpl::Process(GraphTime aFrom, GraphTime aTo)
|
MediaStreamGraphImpl::Process(GraphTime aTo)
|
||||||
{
|
{
|
||||||
// Play stream contents.
|
// Play stream contents.
|
||||||
bool allBlockedForever = true;
|
bool allBlockedForever = true;
|
||||||
|
@ -1117,10 +1115,11 @@ MediaStreamGraphImpl::Process(GraphTime aFrom, GraphTime aTo)
|
||||||
#endif
|
#endif
|
||||||
// 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(), aFrom, aTo);
|
ProduceDataForStreamsBlockByBlock(i, n->SampleRate(),
|
||||||
|
mProcessedTime, aTo);
|
||||||
doneAllProducing = true;
|
doneAllProducing = true;
|
||||||
} else {
|
} else {
|
||||||
ps->ProcessInput(aFrom, aTo, ProcessedMediaStream::ALLOW_FINISH);
|
ps->ProcessInput(mProcessedTime, aTo, ProcessedMediaStream::ALLOW_FINISH);
|
||||||
NS_WARN_IF_FALSE(stream->mBuffer.GetEnd() >=
|
NS_WARN_IF_FALSE(stream->mBuffer.GetEnd() >=
|
||||||
GraphTimeToStreamTimeWithBlocking(stream, aTo),
|
GraphTimeToStreamTimeWithBlocking(stream, aTo),
|
||||||
"Stream did not produce enough data");
|
"Stream did not produce enough data");
|
||||||
|
@ -1130,9 +1129,9 @@ MediaStreamGraphImpl::Process(GraphTime aFrom, GraphTime aTo)
|
||||||
NotifyHasCurrentData(stream);
|
NotifyHasCurrentData(stream);
|
||||||
// Only playback audio and video in real-time mode
|
// Only playback audio and video in real-time mode
|
||||||
if (mRealtime) {
|
if (mRealtime) {
|
||||||
CreateOrDestroyAudioStreams(aFrom, stream);
|
CreateOrDestroyAudioStreams(stream);
|
||||||
if (CurrentDriver()->AsAudioCallbackDriver()) {
|
if (CurrentDriver()->AsAudioCallbackDriver()) {
|
||||||
StreamTime ticksPlayedForThisStream = PlayAudio(stream, aFrom, aTo);
|
StreamTime ticksPlayedForThisStream = PlayAudio(stream, aTo);
|
||||||
if (!ticksPlayed) {
|
if (!ticksPlayed) {
|
||||||
ticksPlayed = ticksPlayedForThisStream;
|
ticksPlayed = ticksPlayedForThisStream;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1142,7 +1141,7 @@ MediaStreamGraphImpl::Process(GraphTime aFrom, GraphTime aTo)
|
||||||
}
|
}
|
||||||
PlayVideo(stream);
|
PlayVideo(stream);
|
||||||
}
|
}
|
||||||
if (stream->mStartBlocking > aFrom) {
|
if (stream->mStartBlocking > mProcessedTime) {
|
||||||
allBlockedForever = false;
|
allBlockedForever = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1220,17 +1219,17 @@ MediaStreamGraphImpl::OneIteration(GraphTime aStateEnd)
|
||||||
{
|
{
|
||||||
MaybeProduceMemoryReport();
|
MaybeProduceMemoryReport();
|
||||||
|
|
||||||
GraphTime stateFrom = mStateComputedTime;
|
|
||||||
GraphTime stateEnd = std::min(aStateEnd, mEndTime);
|
GraphTime stateEnd = std::min(aStateEnd, mEndTime);
|
||||||
UpdateGraph(stateEnd);
|
UpdateGraph(stateEnd);
|
||||||
|
|
||||||
mStateComputedTime = stateEnd;
|
mStateComputedTime = stateEnd;
|
||||||
|
|
||||||
Process(stateFrom, stateEnd);
|
Process(stateEnd);
|
||||||
|
|
||||||
|
GraphTime oldProcessedTime = mProcessedTime;
|
||||||
mProcessedTime = stateEnd;
|
mProcessedTime = stateEnd;
|
||||||
|
|
||||||
UpdateCurrentTimeForStreams(stateFrom);
|
UpdateCurrentTimeForStreams(oldProcessedTime);
|
||||||
|
|
||||||
return UpdateMainThreadState();
|
return UpdateMainThreadState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Do all the processing and play the audio and video, ffrom aFrom to aTo.
|
* Do all the processing and play the audio and video, ffrom aFrom to aTo.
|
||||||
*/
|
*/
|
||||||
void Process(GraphTime aFrom, GraphTime aTo);
|
void Process(GraphTime aTo);
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
@ -340,12 +340,12 @@ public:
|
||||||
* If aStream needs an audio stream but doesn't have one, create it.
|
* If aStream needs an audio stream but doesn't have one, create it.
|
||||||
* If aStream doesn't need an audio stream but has one, destroy it.
|
* If aStream doesn't need an audio stream but has one, destroy it.
|
||||||
*/
|
*/
|
||||||
void CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTime, MediaStream* aStream);
|
void CreateOrDestroyAudioStreams(MediaStream* aStream);
|
||||||
/**
|
/**
|
||||||
* 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 aFrom, GraphTime aTo);
|
StreamTime PlayAudio(MediaStream* aStream, GraphTime aTo);
|
||||||
/**
|
/**
|
||||||
* Set the correct current video frame for stream aStream.
|
* Set the correct current video frame for stream aStream.
|
||||||
*/
|
*/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче