Bug 1129263 - Part 3. Add tracks atomically when capturing from decoder. r=roc,jesup

This commit is contained in:
Andreas Pehrson 2015-02-24 13:11:32 +08:00
parent d61e1fd8f3
commit 7c048a5765

View File

@ -407,7 +407,8 @@ void MediaDecoderStateMachine::SendStreamData()
if (mInfo.HasAudio()) {
TrackID audioTrackId = mInfo.mAudio.mTrackInfo.mOutputId;
AudioSegment* audio = new AudioSegment();
mediaStream->AddAudioTrack(audioTrackId, mInfo.mAudio.mRate, 0, audio);
mediaStream->AddAudioTrack(audioTrackId, mInfo.mAudio.mRate, 0, audio,
SourceMediaStream::ADDTRACK_QUEUED);
stream->mStream->DispatchWhenNotEnoughBuffered(audioTrackId,
GetStateMachineThread(), GetWakeDecoderRunnable());
stream->mNextAudioTime = mStartTime + stream->mInitialTime;
@ -415,7 +416,8 @@ void MediaDecoderStateMachine::SendStreamData()
if (mInfo.HasVideo()) {
TrackID videoTrackId = mInfo.mVideo.mTrackInfo.mOutputId;
VideoSegment* video = new VideoSegment();
mediaStream->AddTrack(videoTrackId, 0, video);
mediaStream->AddTrack(videoTrackId, 0, video,
SourceMediaStream::ADDTRACK_QUEUED);
stream->mStream->DispatchWhenNotEnoughBuffered(videoTrackId,
GetStateMachineThread(), GetWakeDecoderRunnable());
@ -425,6 +427,7 @@ void MediaDecoderStateMachine::SendStreamData()
// into MediaDecoderStateMachine.
stream->mNextVideoTime = mStartTime + stream->mInitialTime;
}
mediaStream->FinishAddTracks();
stream->mStreamInitialized = true;
}