diff --git a/dom/media/GraphDriver.h b/dom/media/GraphDriver.h index 7421f14f622c..944f3350c139 100644 --- a/dom/media/GraphDriver.h +++ b/dom/media/GraphDriver.h @@ -50,15 +50,6 @@ static const int SCHEDULE_SAFETY_MARGIN_MS = 10; static const int AUDIO_TARGET_MS = 2*MEDIA_GRAPH_TARGET_PERIOD_MS + SCHEDULE_SAFETY_MARGIN_MS; -/** - * Try have this much video buffered. Video frames are set - * near the end of the iteration of the control loop. The maximum delay - * to the setting of the next video frame is 2*MEDIA_GRAPH_TARGET_PERIOD_MS + - * SCHEDULE_SAFETY_MARGIN_MS. This is not optimal yet. - */ -static const int VIDEO_TARGET_MS = 2*MEDIA_GRAPH_TARGET_PERIOD_MS + - SCHEDULE_SAFETY_MARGIN_MS; - class MediaStreamGraphImpl; /** diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index ca29ec2af00b..cc08de004be4 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -414,9 +414,8 @@ bool MediaDecoderStateMachine::HaveEnoughDecodedAudio(int64_t aAmpleAudioUSecs) return false; } - // We don't have to check SourceMediaStream::HaveEnoughBuffered() in the - // case of stream-capture for MDSM will ensure buffering level is high enough - // for playback speed at 1x at which the DecodedStream is playing. + // MDSM will ensure buffering level is high enough for playback speed at 1x + // at which the DecodedStream is playing. return true; } diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 2641eafa31c5..c126f22a254a 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -71,17 +71,6 @@ MediaStreamGraphImpl::~MediaStreamGraphImpl() LIFECYCLE_LOG("MediaStreamGraphImpl::~MediaStreamGraphImpl\n"); } - -StreamTime -MediaStreamGraphImpl::GetDesiredBufferEnd(MediaStream* aStream) -{ - StreamTime current = IterationEnd() - aStream->mBufferStartTime; - // When waking up media decoders, we need a longer safety margin, as it can - // take more time to get new samples. A factor of two seem to work. - return current + - 2 * MillisecondsToMediaTime(std::max(AUDIO_TARGET_MS, VIDEO_TARGET_MS)); -} - void MediaStreamGraphImpl::FinishStream(MediaStream* aStream) { @@ -261,34 +250,6 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream, } } -void -MediaStreamGraphImpl::UpdateBufferSufficiencyState(SourceMediaStream* aStream) -{ - StreamTime desiredEnd = GetDesiredBufferEnd(aStream); - { - MutexAutoLock lock(aStream->mMutex); - for (uint32_t i = 0; i < aStream->mUpdateTracks.Length(); ++i) { - SourceMediaStream::TrackData* data = &aStream->mUpdateTracks[i]; - if (data->mCommands & SourceMediaStream::TRACK_CREATE) { - // This track hasn't been created yet, so we have no sufficiency - // data. The track will be created in the next iteration of the - // control loop and then we'll fire insufficiency notifications - // if necessary. - continue; - } - if (data->mCommands & SourceMediaStream::TRACK_END) { - // This track will end, so no point updating. - continue; - } - StreamBuffer::Track* track = aStream->mBuffer.FindTrack(data->mID); - // Note that track->IsEnded() must be false, otherwise we would have - // removed the track from mUpdateTracks already. - NS_ASSERTION(!track->IsEnded(), "What is this track doing here?"); - data->mHaveEnough = track->GetEnd() >= desiredEnd; - } - } -} - StreamTime MediaStreamGraphImpl::GraphTimeToStreamTime(MediaStream* aStream, GraphTime aTime) @@ -1438,10 +1399,6 @@ MediaStreamGraphImpl::Process(GraphTime aFrom, GraphTime aTo) } PlayVideo(stream); } - SourceMediaStream* is = stream->AsSourceStream(); - if (is) { - UpdateBufferSufficiencyState(is); - } GraphTime end; if (!stream->mBlocked.GetAt(aTo, &end) || end < GRAPH_TIME_MAX) { allBlockedForever = false; @@ -2471,7 +2428,6 @@ SourceMediaStream::AddTrackInternal(TrackID aID, TrackRate aRate, StreamTime aSt data->mEndOfFlushedData = aStart; data->mCommands = TRACK_CREATE; data->mData = aSegment; - data->mHaveEnough = false; if (!(aFlags & ADDTRACK_QUEUED) && GraphImpl()) { GraphImpl()->EnsureNextIteration(); } @@ -2632,17 +2588,6 @@ SourceMediaStream::RemoveDirectListener(MediaStreamDirectListener* aListener) } } -bool -SourceMediaStream::HaveEnoughBuffered(TrackID aID) -{ - MutexAutoLock lock(mMutex); - TrackData *track = FindDataForTrack(aID); - if (track) { - return track->mHaveEnough; - } - return false; -} - StreamTime SourceMediaStream::GetEndOfAppendedData(TrackID aID) { diff --git a/dom/media/MediaStreamGraph.h b/dom/media/MediaStreamGraph.h index 5a2e07d59767..1d9a91f7a4b1 100644 --- a/dom/media/MediaStreamGraph.h +++ b/dom/media/MediaStreamGraph.h @@ -815,11 +815,6 @@ public: * or the stream was already finished. */ bool AppendToTrack(TrackID aID, MediaSegment* aSegment, MediaSegment *aRawSegment = nullptr); - /** - * Returns true if the buffer currently has enough data. - * Returns false if there isn't enough data or if no such track exists. - */ - bool HaveEnoughBuffered(TrackID aID); /** * Get the stream time of the end of the data that has been appended so far. * Can be called from any thread but won't be useful if it can race with @@ -925,7 +920,6 @@ protected: // Each time the track updates are flushed to the media graph thread, // this is cleared. uint32_t mCommands; - bool mHaveEnough; }; bool NeedsMixing();