mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 22:04:36 +00:00
Backed out changeset d64ca44c11ce (bug 1214710)
This commit is contained in:
parent
dde29ee8a5
commit
6a323f91ff
@ -226,8 +226,7 @@ MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
|
||||
, mShutdown(false)
|
||||
, mAudioDiscontinuity(false)
|
||||
, mVideoDiscontinuity(false)
|
||||
, mIsSuspended(mTaskQueue, true,
|
||||
"MediaDecoderReader::mIsSuspended (Canonical)")
|
||||
, mIsSuspended(true)
|
||||
{
|
||||
MOZ_COUNT_CTOR(MediaDecoderReader);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -523,7 +522,6 @@ MediaDecoderReader::Shutdown()
|
||||
ReleaseMediaResources();
|
||||
mDuration.DisconnectIfConnected();
|
||||
mBuffered.DisconnectAll();
|
||||
mIsSuspended.DisconnectAll();
|
||||
|
||||
// Shut down the watch manager before shutting down our task queue.
|
||||
mWatchManager.Shutdown();
|
||||
|
@ -302,10 +302,6 @@ public:
|
||||
mIsSuspended = aState;
|
||||
}
|
||||
|
||||
AbstractCanonical<bool>* CanonicalIsSuspended() {
|
||||
return &mIsSuspended;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~MediaDecoderReader();
|
||||
|
||||
@ -451,7 +447,7 @@ private:
|
||||
// "discontinuity" in the stream. For example after a seek.
|
||||
bool mAudioDiscontinuity;
|
||||
bool mVideoDiscontinuity;
|
||||
Canonical<bool> mIsSuspended;
|
||||
bool mIsSuspended;
|
||||
|
||||
MediaEventListener mDataArrivedListener;
|
||||
};
|
||||
|
@ -415,9 +415,6 @@ public:
|
||||
AbstractCanonical<media::TimeIntervals>* CanonicalBuffered() {
|
||||
return mReader->CanonicalBuffered();
|
||||
}
|
||||
AbstractCanonical<bool>* CanonicalIsSuspended() {
|
||||
return mReader->CanonicalIsSuspended();
|
||||
}
|
||||
|
||||
#ifdef MOZ_EME
|
||||
void SetCDMProxy(CDMProxy* aProxy) { mReader->SetCDMProxy(aProxy); }
|
||||
|
@ -262,8 +262,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
||||
mAudioOffloading(false),
|
||||
mBuffered(mTaskQueue, TimeIntervals(),
|
||||
"MediaDecoderStateMachine::mBuffered (Mirror)"),
|
||||
mIsReaderSuspended(mTaskQueue, true,
|
||||
"MediaDecoderStateMachine::mIsReaderSuspended (Mirror)"),
|
||||
mEstimatedDuration(mTaskQueue, NullableTimeUnit(),
|
||||
"MediaDecoderStateMachine::mEstimatedDuration (Mirror)"),
|
||||
mExplicitDuration(mTaskQueue, Maybe<double>(),
|
||||
@ -341,7 +339,6 @@ MediaDecoderStateMachine::InitializationTask(MediaDecoder* aDecoder)
|
||||
|
||||
// Connect mirrors.
|
||||
mBuffered.Connect(mReader->CanonicalBuffered());
|
||||
mIsReaderSuspended.Connect(mReader->CanonicalIsSuspended());
|
||||
mEstimatedDuration.Connect(aDecoder->CanonicalEstimatedDuration());
|
||||
mExplicitDuration.Connect(aDecoder->CanonicalExplicitDuration());
|
||||
mPlayState.Connect(aDecoder->CanonicalPlayState());
|
||||
@ -360,7 +357,6 @@ MediaDecoderStateMachine::InitializationTask(MediaDecoder* aDecoder)
|
||||
|
||||
// Initialize watchers.
|
||||
mWatchManager.Watch(mBuffered, &MediaDecoderStateMachine::BufferedRangeUpdated);
|
||||
mWatchManager.Watch(mIsReaderSuspended, &MediaDecoderStateMachine::ReaderSuspendedChanged);
|
||||
mWatchManager.Watch(mState, &MediaDecoderStateMachine::UpdateNextFrameStatus);
|
||||
mWatchManager.Watch(mAudioCompleted, &MediaDecoderStateMachine::UpdateNextFrameStatus);
|
||||
mWatchManager.Watch(mVideoCompleted, &MediaDecoderStateMachine::UpdateNextFrameStatus);
|
||||
@ -1354,7 +1350,7 @@ void MediaDecoderStateMachine::VisibilityChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HasVideo() || mIsReaderSuspended) {
|
||||
if (!HasVideo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1389,32 +1385,23 @@ void MediaDecoderStateMachine::VisibilityChanged()
|
||||
}
|
||||
|
||||
// Start video-only seek to the current time...
|
||||
InitiateDecodeRecoverySeek(MediaDecoderReader::VIDEO_ONLY);
|
||||
InitiateVideoDecodeRecoverySeek();
|
||||
}
|
||||
}
|
||||
|
||||
// InitiateDecodeRecoverySeek is responsible for setting up a seek using the
|
||||
// seek task for the following situations:
|
||||
// 1. When suspension of decoding for videos that are in
|
||||
// InitiateVideoDecodeRecoverySeek is responsible for setting up a video-only
|
||||
// seek using the seek task. When suspension of decoding for videos that are in
|
||||
// background tabs (ie. invisible) is enabled, the audio keeps playing and when
|
||||
// switching back to decoding video, it is highly desirable to not cause the
|
||||
// audio to pause as the video is seeked else there be a noticeable audio glitch
|
||||
// as the tab becomes visible.
|
||||
// 2. When there is a decoder limit set, suspended videos may be resumed and
|
||||
// require the seek to recover the original seek position for both audio and
|
||||
// video.
|
||||
void MediaDecoderStateMachine::InitiateDecodeRecoverySeek(
|
||||
MediaDecoderReader::TargetQueues aQueues)
|
||||
void MediaDecoderStateMachine::InitiateVideoDecodeRecoverySeek()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
|
||||
DECODER_LOG("InitiateDecodeRecoverySeek(%d)", aQueues);
|
||||
|
||||
SeekJob seekJob;
|
||||
SeekTarget::Type seekTargetType = aQueues == MediaDecoderReader::VIDEO_ONLY
|
||||
? SeekTarget::Type::AccurateVideoOnly
|
||||
: SeekTarget::Type::Accurate;
|
||||
seekJob.mTarget = SeekTarget(GetMediaTime(), seekTargetType,
|
||||
seekJob.mTarget = SeekTarget(GetMediaTime(),
|
||||
SeekTarget::Type::AccurateVideoOnly,
|
||||
MediaDecoderEventVisibility::Suppressed);
|
||||
|
||||
SetState(DECODER_STATE_SEEKING);
|
||||
@ -1436,7 +1423,7 @@ void MediaDecoderStateMachine::InitiateDecodeRecoverySeek(
|
||||
|
||||
// Reset our state machine and decoding pipeline before seeking.
|
||||
if (mSeekTask->NeedToResetMDSM()) {
|
||||
Reset(aQueues);
|
||||
Reset(TrackInfo::kVideoTrack);
|
||||
}
|
||||
|
||||
// Do the seek.
|
||||
@ -1469,22 +1456,6 @@ void MediaDecoderStateMachine::BufferedRangeUpdated()
|
||||
}
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::ReaderSuspendedChanged()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
DECODER_LOG("ReaderSuspendedChanged: suspended = %d", mIsReaderSuspended.Ref());
|
||||
|
||||
if (!HasVideo() || mIsReaderSuspended || IsDecodingFirstFrame()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mSeekTask || mQueuedSeek.Exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
InitiateDecodeRecoverySeek(MediaDecoderReader::AUDIO_VIDEO);
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::ReadMetadata()
|
||||
{
|
||||
@ -2251,7 +2222,6 @@ MediaDecoderStateMachine::FinishShutdown()
|
||||
|
||||
// Disconnect canonicals and mirrors before shutting down our task queue.
|
||||
mBuffered.DisconnectIfConnected();
|
||||
mIsReaderSuspended.DisconnectIfConnected();
|
||||
mEstimatedDuration.DisconnectIfConnected();
|
||||
mExplicitDuration.DisconnectIfConnected();
|
||||
mPlayState.DisconnectIfConnected();
|
||||
@ -2666,8 +2636,7 @@ bool MediaDecoderStateMachine::IsStateMachineScheduled() const
|
||||
bool MediaDecoderStateMachine::IsVideoDecodeSuspended() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
return (MediaPrefs::MDSMSuspendBackgroundVideoEnabled() && mVideoDecodeSuspended) ||
|
||||
mIsReaderSuspended;
|
||||
return MediaPrefs::MDSMSuspendBackgroundVideoEnabled() && mVideoDecodeSuspended;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -381,8 +381,6 @@ protected:
|
||||
|
||||
void BufferedRangeUpdated();
|
||||
|
||||
void ReaderSuspendedChanged();
|
||||
|
||||
// Inserts MediaData* samples into their respective MediaQueues.
|
||||
// aSample must not be null.
|
||||
|
||||
@ -520,11 +518,10 @@ protected:
|
||||
// The decoder monitor must be held.
|
||||
void InitiateSeek(SeekJob aSeekJob);
|
||||
|
||||
// Clears any previous seeking state and initiates a seek on the decoder to
|
||||
// resync the video and audio positions, when recovering from video decoding
|
||||
// being suspended in background or from audio and video decoding being
|
||||
// suspended due to the decoder limit.
|
||||
void InitiateDecodeRecoverySeek(MediaDecoderReader::TargetQueues aQueues);
|
||||
// Clears any previous seeking state and initiates a video-only seek on the
|
||||
// decoder to catch up the video to the current audio position, when recovering
|
||||
// from video decoding being suspended in background.
|
||||
void InitiateVideoDecodeRecoverySeek();
|
||||
|
||||
nsresult DispatchAudioDecodeTaskIfNeeded();
|
||||
|
||||
@ -978,8 +975,6 @@ private:
|
||||
// The buffered range. Mirrored from the decoder thread.
|
||||
Mirror<media::TimeIntervals> mBuffered;
|
||||
|
||||
Mirror<bool> mIsReaderSuspended;
|
||||
|
||||
// The duration according to the demuxer's current estimate, mirrored from the main thread.
|
||||
Mirror<media::NullableTimeUnit> mEstimatedDuration;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user