diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 2b4eed3bbce7..384547dd7515 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -2166,7 +2166,10 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata) MOZ_ASSERT(mMaster->mDuration.Ref().isSome()); - mMaster->EnqueueLoadedMetadataEvent(); + mMaster->mMetadataLoadedEvent.Notify( + nsAutoPtr(new MediaInfo(aMetadata->mInfo)), + Move(mMaster->mMetadataTags), + MediaDecoderEventVisibility::Observable); if (Info().IsEncrypted() && !mMaster->mCDMProxy) { // Metadata parsing was successful but we're still waiting for CDM caps @@ -2681,7 +2684,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, mAmpleAudioThreshold(detail::AMPLE_AUDIO_THRESHOLD), mAudioCaptured(false), mMinimizePreroll(aDecoder->GetMinimizePreroll()), - mSentLoadedMetadataEvent(false), mSentFirstFrameLoadedEvent(false), mVideoDecodeSuspended(false), mVideoDecodeSuspendTimer(mTaskQueue), @@ -3466,19 +3468,6 @@ MediaDecoderStateMachine::DecodeError(const MediaResult& aError) mOnPlaybackErrorEvent.Notify(aError); } -void -MediaDecoderStateMachine::EnqueueLoadedMetadataEvent() -{ - MOZ_ASSERT(OnTaskQueue()); - MediaDecoderEventVisibility visibility = - mSentLoadedMetadataEvent ? MediaDecoderEventVisibility::Suppressed - : MediaDecoderEventVisibility::Observable; - mMetadataLoadedEvent.Notify(nsAutoPtr(new MediaInfo(Info())), - Move(mMetadataTags), - visibility); - mSentLoadedMetadataEvent = true; -} - void MediaDecoderStateMachine::EnqueueFirstFrameLoadedEvent() { diff --git a/dom/media/MediaDecoderStateMachine.h b/dom/media/MediaDecoderStateMachine.h index 1cd7f918c707..507f97b38d73 100644 --- a/dom/media/MediaDecoderStateMachine.h +++ b/dom/media/MediaDecoderStateMachine.h @@ -423,11 +423,6 @@ protected: // decode thread. void DecodeError(const MediaResult& aError); - // Dispatches a LoadedMetadataEvent. - // This is threadsafe and can be called on any thread. - // The decoder monitor must be held. - void EnqueueLoadedMetadataEvent(); - void EnqueueFirstFrameLoadedEvent(); // Start a task to decode audio. @@ -640,10 +635,6 @@ private: mozilla::MediaMetadataManager mMetadataManager; - // True if we are back from DECODER_STATE_DORMANT state and - // LoadedMetadataEvent was already sent. - bool mSentLoadedMetadataEvent; - // True if we've decoded first frames (thus having the start time) and // notified the FirstFrameLoaded event. Note we can't initiate seek until the // start time is known which happens when the first frames are decoded or we