Bug 1365520. P1 - remove MDSM::mSentLoadedMetadataEvent and MDSM::EnqueueLoadedMetadataEvent(). r=kaku

The current call flow ensures decoding metadata only happens at most once
and therefore EnqueueLoadedMetadataEvent() will only be called at most once.
We don't need the mSentLoadedMetadataEvent flag.

MozReview-Commit-ID: E95jtRrKupw

--HG--
extra : rebase_source : b95887154a2392ca5a6fcb45b4c2dad60fb65b70
This commit is contained in:
JW Wang 2017-05-17 16:00:46 +08:00
Родитель bdbca169de
Коммит be797e327f
2 изменённых файлов: 4 добавлений и 24 удалений

Просмотреть файл

@ -2166,7 +2166,10 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata)
MOZ_ASSERT(mMaster->mDuration.Ref().isSome());
mMaster->EnqueueLoadedMetadataEvent();
mMaster->mMetadataLoadedEvent.Notify(
nsAutoPtr<MediaInfo>(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<MediaInfo>(new MediaInfo(Info())),
Move(mMetadataTags),
visibility);
mSentLoadedMetadataEvent = true;
}
void
MediaDecoderStateMachine::EnqueueFirstFrameLoadedEvent()
{

Просмотреть файл

@ -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