From f4605f76d92f09437f9b8a36dfd612f8d58c4ce9 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Thu, 5 Jan 2017 17:59:19 +0800 Subject: [PATCH] Bug 1328836 - Remove MDSM::DispatchMinimizePrerollUntilPlaybackStarts. r=kaku MozReview-Commit-ID: 1EGHVhZqUTA --HG-- extra : rebase_source : c90c245683c50364d869566540f47927e0f64d04 extra : intermediate-source : ceb0660e9f35a0dbbd361a4dc4eb6bcef8add385 extra : source : e1dfbdac70feedc99a950c00aeda683e38919247 --- dom/media/MediaDecoder.cpp | 3 --- dom/media/MediaDecoder.h | 2 ++ dom/media/MediaDecoderStateMachine.cpp | 2 +- dom/media/MediaDecoderStateMachine.h | 20 -------------------- 4 files changed, 3 insertions(+), 24 deletions(-) diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 2a96be23d12b..c279e41a94ea 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -633,9 +633,6 @@ void MediaDecoder::SetStateMachineParameters() { MOZ_ASSERT(NS_IsMainThread()); - if (mMinimizePreroll) { - mDecoderStateMachine->DispatchMinimizePrerollUntilPlaybackStarts(); - } if (mPlaybackRate != 1 && mPlaybackRate != 0) { mDecoderStateMachine->DispatchSetPlaybackRate(mPlaybackRate); } diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 16d3e1138120..977d826440b7 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -192,6 +192,8 @@ public: // not be played. Note that seeking also doesn't cause us start prerolling. void SetMinimizePrerollUntilPlaybackStarts(); + bool GetMinimizePreroll() const { return mMinimizePreroll; } + // All MediaStream-related data is protected by mReentrantMonitor. // We have at most one DecodedStreamData per MediaDecoder. Its stream // is used as the input for each ProcessedMediaStream created by calls to diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 376bfed828a6..111b3cc846ab 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -2359,7 +2359,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, mLowAudioThresholdUsecs(detail::LOW_AUDIO_USECS), mAmpleAudioThresholdUsecs(detail::AMPLE_AUDIO_USECS), mAudioCaptured(false), - mMinimizePreroll(false), + mMinimizePreroll(aDecoder->GetMinimizePreroll()), mSentLoadedMetadataEvent(false), mSentFirstFrameLoadedEvent(false), mVideoDecodeSuspended(false), diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 7a3628dffdfe..d600d46d4dc5 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -178,26 +178,6 @@ public: RefPtr BeginShutdown(); - // Notifies the state machine that should minimize the number of samples - // decoded we preroll, until playback starts. The first time playback starts - // the state machine is free to return to prerolling normally. Note - // "prerolling" in this context refers to when we decode and buffer decoded - // samples in advance of when they're needed for playback. - void DispatchMinimizePrerollUntilPlaybackStarts() - { - RefPtr self = this; - nsCOMPtr r = NS_NewRunnableFunction([self] () -> void - { - MOZ_ASSERT(self->OnTaskQueue()); - self->mMinimizePreroll = true; - - // Make sure that this arrives before playback starts, otherwise this won't - // have the intended effect. - MOZ_DIAGNOSTIC_ASSERT(self->mPlayState == MediaDecoder::PLAY_STATE_LOADING); - }); - OwnerThread()->Dispatch(r.forget()); - } - // Set the media fragment end time. aEndTime is in microseconds. void DispatchSetFragmentEndTime(int64_t aEndTime) {