From 3586f511240b69eb6f29d9c8c8176729a9ae6348 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Tue, 6 Sep 2016 14:48:29 +0800 Subject: [PATCH] Bug 1301341. Part 2 - Remove unused members. r=kaku MozReview-Commit-ID: 3S9hw6w0k1T --HG-- extra : rebase_source : b14d23f5845caaa00333aca99fbdf49a4f1dc2aa --- dom/media/MediaDecoderStateMachine.cpp | 94 -------------------------- dom/media/MediaDecoderStateMachine.h | 14 ---- 2 files changed, 108 deletions(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 7703e39404cf..6a44fe737550 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -1840,23 +1840,6 @@ void MediaDecoderStateMachine::ReaderSuspendedChanged() SetDormant(mIsReaderSuspended); } -void -MediaDecoderStateMachine::ReadMetadata() -{ - MOZ_ASSERT(OnTaskQueue()); - MOZ_ASSERT(!IsShutdown()); - MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA); - MOZ_ASSERT(!mMetadataRequest.Exists()); - - DECODER_LOG("Dispatching AsyncReadMetadata"); - // Set mode to METADATA since we are about to read metadata. - mResource->SetReadMode(MediaCacheStream::MODE_METADATA); - mMetadataRequest.Begin(mReader->ReadMetadata() - ->Then(OwnerThread(), __func__, this, - &MediaDecoderStateMachine::OnMetadataRead, - &MediaDecoderStateMachine::OnMetadataNotRead)); -} - RefPtr MediaDecoderStateMachine::Seek(SeekTarget aTarget) { @@ -2311,83 +2294,6 @@ MediaDecoderStateMachine::DecodeError() mOnPlaybackEvent.Notify(MediaEventType::DecodeError); } -void -MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata) -{ - MOZ_ASSERT(OnTaskQueue()); - MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA); - mMetadataRequest.Complete(); - - if (mPendingDormant) { - mPendingDormant = false; - SetDormant(true); - return; - } - - // Set mode to PLAYBACK after reading metadata. - mResource->SetReadMode(MediaCacheStream::MODE_PLAYBACK); - mInfo = aMetadata->mInfo; - mMetadataTags = aMetadata->mTags.forget(); - RefPtr self = this; - - if (mInfo.mMetadataDuration.isSome()) { - RecomputeDuration(); - } else if (mInfo.mUnadjustedMetadataEndTime.isSome()) { - mReader->AwaitStartTime()->Then(OwnerThread(), __func__, - [self] () -> void { - NS_ENSURE_TRUE_VOID(!self->IsShutdown()); - TimeUnit unadjusted = self->mInfo.mUnadjustedMetadataEndTime.ref(); - TimeUnit adjustment = self->mReader->StartTime(); - self->mInfo.mMetadataDuration.emplace(unadjusted - adjustment); - self->RecomputeDuration(); - }, [] () -> void { NS_WARNING("Adjusting metadata end time failed"); } - ); - } - - if (HasVideo()) { - DECODER_LOG("Video decode isAsync=%d HWAccel=%d videoQueueSize=%d", - mReader->IsAsync(), - mReader->VideoIsHardwareAccelerated(), - GetAmpleVideoFrames()); - } - - // In general, we wait until we know the duration before notifying the decoder. - // However, we notify unconditionally in this case without waiting for the start - // time, since the caller might be waiting on metadataloaded to be fired before - // feeding in the CDM, which we need to decode the first frame (and - // thus get the metadata). We could fix this if we could compute the start - // time by demuxing without necessaring decoding. - bool waitingForCDM = -#ifdef MOZ_EME - mInfo.IsEncrypted() && !mCDMProxy; -#else - false; -#endif - mNotifyMetadataBeforeFirstFrame = mDuration.Ref().isSome() || waitingForCDM; - if (mNotifyMetadataBeforeFirstFrame) { - EnqueueLoadedMetadataEvent(); - } - - if (waitingForCDM) { - // Metadata parsing was successful but we're still waiting for CDM caps - // to become available so that we can build the correct decryptor/decoder. - SetState(DECODER_STATE_WAIT_FOR_CDM); - return; - } - - SetState(DECODER_STATE_DECODING_FIRSTFRAME); -} - -void -MediaDecoderStateMachine::OnMetadataNotRead(ReadMetadataFailureReason aReason) -{ - MOZ_ASSERT(OnTaskQueue()); - MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA); - mMetadataRequest.Complete(); - DECODER_WARN("Decode metadata failed, shutting down decoder"); - DecodeError(); -} - void MediaDecoderStateMachine::EnqueueLoadedMetadataEvent() { diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 77adcd7f1333..2d40ec661528 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -278,8 +278,6 @@ private: void SetAudioCaptured(bool aCaptured); - void ReadMetadata(); - RefPtr Seek(SeekTarget aTarget); RefPtr Shutdown(); @@ -537,10 +535,6 @@ protected: // must be held when calling this. Called on the decode thread. int64_t GetDecodedAudioDuration(); - // Promise callbacks for metadata reading. - void OnMetadataRead(MetadataHolder* aMetadata); - void OnMetadataNotRead(ReadMetadataFailureReason aReason); - // Notify FirstFrameLoaded if having decoded first frames and // transition to SEEKING if there is any pending seek, or DECODING otherwise. void MaybeFinishDecodeFirstFrame(); @@ -816,11 +810,6 @@ private: // True if all video frames are already rendered. Watchable mVideoCompleted; - // True if we need to enter dormant state after reading metadata. Note that - // we can't enter dormant state until reading metadata is done for some - // limitations of the reader. - bool mPendingDormant = false; - // Flag whether we notify metadata before decoding the first frame or after. // // Note that the odd semantics here are designed to replicate the current @@ -853,9 +842,6 @@ private: // by the decoder monitor. bool mDecodeThreadWaiting; - // Track our request for metadata from the reader. - MozPromiseRequestHolder mMetadataRequest; - // Stores presentation info required for playback. The decoder monitor // must be held when accessing this. MediaInfo mInfo;