Bug 1291633 - Don't call MediaDecoder::SeekingStarted when visibility is Suppressed. r=kaku

MozReview-Commit-ID: 15YOmFCoXGp

--HG--
extra : rebase_source : b5269f7a4883ff08dbfdb797df9eb78334315108
This commit is contained in:
JW Wang 2016-08-03 17:18:54 +08:00
Родитель e32ee56058
Коммит 2d84b3c90e
6 изменённых файлов: 15 добавлений и 21 удалений

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

@ -637,7 +637,6 @@ MediaDecoder::Shutdown()
mMetadataLoadedListener.Disconnect();
mFirstFrameLoadedListener.Disconnect();
mOnPlaybackEvent.Disconnect();
mOnSeekingStart.Disconnect();
mOnMediaNotSeekable.Disconnect();
mDecoderStateMachine->BeginShutdown()
@ -689,6 +688,9 @@ MediaDecoder::OnPlaybackEvent(MediaEventType aEvent)
case MediaEventType::PlaybackEnded:
PlaybackEnded();
break;
case MediaEventType::SeekStarted:
SeekingStarted();
break;
case MediaEventType::DecodeError:
DecodeError();
break;
@ -771,8 +773,6 @@ MediaDecoder::SetStateMachineParameters()
mOnPlaybackEvent = mDecoderStateMachine->OnPlaybackEvent().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackEvent);
mOnSeekingStart = mDecoderStateMachine->OnSeekingStart().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::SeekingStarted);
mOnMediaNotSeekable = mDecoderStateMachine->OnMediaNotSeekable().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::OnMediaNotSeekable);
}
@ -1313,13 +1313,11 @@ MediaDecoder::OnSeekRejected()
}
void
MediaDecoder::SeekingStarted(MediaDecoderEventVisibility aEventVisibility)
MediaDecoder::SeekingStarted()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!IsShutdown());
if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
mOwner->SeekStarted();
}
mOwner->SeekStarted();
}
void

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

@ -414,9 +414,8 @@ private:
mIgnoreProgressData = mLogicallySeeking;
}
// Seeking has started. Inform the element on the main
// thread.
void SeekingStarted(MediaDecoderEventVisibility aEventVisibility = MediaDecoderEventVisibility::Observable);
// Seeking has started. Inform the element on the main thread.
void SeekingStarted();
void UpdateLogicalPositionInternal(MediaDecoderEventVisibility aEventVisibility);
void UpdateLogicalPosition()
@ -732,7 +731,6 @@ protected:
MediaEventListener mFirstFrameLoadedListener;
MediaEventListener mOnPlaybackEvent;
MediaEventListener mOnSeekingStart;
MediaEventListener mOnMediaNotSeekable;
protected:

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

@ -1410,8 +1410,6 @@ void MediaDecoderStateMachine::InitiateDecodeRecoverySeek(TrackSet aTracks)
mReader.get(), mCurrentSeek.mTarget,
mInfo, Duration(), GetMediaTime());
mOnSeekingStart.Notify(MediaDecoderEventVisibility::Suppressed);
// Reset our state machine and decoding pipeline before seeking.
if (mSeekTask->NeedToResetMDSM()) {
Reset(aTracks);
@ -1631,7 +1629,9 @@ MediaDecoderStateMachine::InitiateSeek(SeekJob aSeekJob)
// clamped value.
UpdatePlaybackPositionInternal(mSeekTask->GetSeekTarget().GetTime().ToMicroseconds());
mOnSeekingStart.Notify(aSeekJob.mTarget.mEventVisibility);
if (aSeekJob.mTarget.mEventVisibility == MediaDecoderEventVisibility::Observable) {
mOnPlaybackEvent.Notify(MediaEventType::SeekStarted);
}
// Reset our state machine and decoding pipeline before seeking.
if (mSeekTask->NeedToResetMDSM()) { Reset(); }

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

@ -118,6 +118,7 @@ enum class MediaEventType : int8_t {
PlaybackStarted,
PlaybackStopped,
PlaybackEnded,
SeekStarted,
DecodeError,
Invalidate
};
@ -244,9 +245,6 @@ public:
MediaEventSource<MediaEventType>&
OnPlaybackEvent() { return mOnPlaybackEvent; }
MediaEventSource<MediaDecoderEventVisibility>&
OnSeekingStart() { return mOnSeekingStart; }
// Immutable after construction - may be called on any thread.
bool IsRealTime() const { return mRealTime; }
@ -949,7 +947,6 @@ private:
MediaDecoderEventVisibility> mFirstFrameLoadedEvent;
MediaEventProducer<MediaEventType> mOnPlaybackEvent;
MediaEventProducer<MediaDecoderEventVisibility> mOnSeekingStart;
// True if audio is offloading.
// Playback will not start when audio is offloading.

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

@ -370,8 +370,9 @@ status_t AudioOffloadPlayer::DoSeek()
mPositionTimeMediaUs = -1;
mStartPosUs = mSeekTarget.GetTime().ToMicroseconds();
if (!mSeekPromise.IsEmpty()) {
mOnSeekingStarted.Notify(mSeekTarget.mEventVisibility);
if (!mSeekPromise.IsEmpty() &&
mSeekTarget.mEventVisibility == MediaDecoderEventVisibility::Observable) {
mOnSeekingStarted.Notify();
}
if (mPlaying) {

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

@ -194,7 +194,7 @@ private:
MediaEventProducer<void> mOnPositionChanged;
MediaEventProducer<void> mOnPlaybackEnded;
MediaEventProducer<void> mOnPlayerTearDown;
MediaEventProducer<MediaDecoderEventVisibility> mOnSeekingStarted;
MediaEventProducer<void> mOnSeekingStarted;
MediaEventListener mPositionChanged;
MediaEventListener mPlaybackEnded;
MediaEventListener mPlayerTearDown;