зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1388228. P3 - following P2, we can now remove unused code and canonicals. r=gerald
Note we remove the log in BufferingState::Enter() which prevents us from removing ChannelMediaResource related code from MDSM. We can add it back in the future after the refactoring. MozReview-Commit-ID: B94iOI0bTXC --HG-- extra : rebase_source : 857b7420ab9b52c07dc8a917c1f9344096ed20e6 extra : source : 2c350a4f3cbdf6f446b5e1cc8d6e0892722866d0
This commit is contained in:
Родитель
b4e54281c9
Коммит
303f74001a
|
@ -390,9 +390,6 @@ MediaDecoder::MediaDecoder(MediaDecoderInit& aInit)
|
|||
, INIT_CANONICAL(mLogicallySeeking, false)
|
||||
, INIT_CANONICAL(mSameOriginMedia, false)
|
||||
, INIT_CANONICAL(mMediaPrincipalHandle, PRINCIPAL_HANDLE_NONE)
|
||||
, INIT_CANONICAL(mPlaybackBytesPerSecond, 0.0)
|
||||
, INIT_CANONICAL(mPlaybackRateReliable, true)
|
||||
, INIT_CANONICAL(mDecoderPosition, 0)
|
||||
, mVideoDecodingOberver(new BackgroundVideoDecodingPermissionObserver(this))
|
||||
, mIsBackgroundVideoDecodingAllowed(false)
|
||||
, mTelemetryReported(false)
|
||||
|
|
|
@ -711,18 +711,6 @@ protected:
|
|||
// main-thread induced principal changes get reflected on MSG thread.
|
||||
Canonical<PrincipalHandle> mMediaPrincipalHandle;
|
||||
|
||||
// Estimate of the current playback rate (bytes/second).
|
||||
Canonical<double> mPlaybackBytesPerSecond;
|
||||
|
||||
// True if mPlaybackBytesPerSecond is a reliable estimate.
|
||||
Canonical<bool> mPlaybackRateReliable;
|
||||
|
||||
// Current decoding position in the stream. This is where the decoder
|
||||
// is up to consuming the stream. This is not adjusted during decoder
|
||||
// seek operations, but it's updated at the end when we start playing
|
||||
// back again.
|
||||
Canonical<int64_t> mDecoderPosition;
|
||||
|
||||
// We can allow video decoding in background when we match some special
|
||||
// conditions, eg. when the cursor is hovering over the tab. This observer is
|
||||
// used to listen the related events.
|
||||
|
@ -733,6 +721,12 @@ protected:
|
|||
// background.
|
||||
bool mIsBackgroundVideoDecodingAllowed;
|
||||
|
||||
// Current decoding position in the stream. This is where the decoder
|
||||
// is up to consuming the stream. This is not adjusted during decoder
|
||||
// seek operations, but it's updated at the end when we start playing
|
||||
// back again.
|
||||
int64_t mDecoderPosition = 0;
|
||||
|
||||
public:
|
||||
AbstractCanonical<double>* CanonicalVolume() { return &mVolume; }
|
||||
AbstractCanonical<bool>* CanonicalPreservesPitch()
|
||||
|
@ -756,18 +750,6 @@ public:
|
|||
{
|
||||
return &mMediaPrincipalHandle;
|
||||
}
|
||||
AbstractCanonical<double>* CanonicalPlaybackBytesPerSecond()
|
||||
{
|
||||
return &mPlaybackBytesPerSecond;
|
||||
}
|
||||
AbstractCanonical<bool>* CanonicalPlaybackRateReliable()
|
||||
{
|
||||
return &mPlaybackRateReliable;
|
||||
}
|
||||
AbstractCanonical<int64_t>* CanonicalDecoderPosition()
|
||||
{
|
||||
return &mDecoderPosition;
|
||||
}
|
||||
|
||||
private:
|
||||
// Notify owner when the audible state changed
|
||||
|
@ -776,6 +758,12 @@ private:
|
|||
bool mTelemetryReported;
|
||||
const MediaContainerType mContainerType;
|
||||
bool mCanPlayThrough = false;
|
||||
|
||||
// Estimate of the current playback rate (bytes/second).
|
||||
double mPlaybackBytesPerSecond = 0;
|
||||
|
||||
// True if mPlaybackBytesPerSecond is a reliable estimate.
|
||||
bool mPlaybackRateReliable = true;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -1856,16 +1856,7 @@ public:
|
|||
}
|
||||
|
||||
mBufferingStart = TimeStamp::Now();
|
||||
|
||||
MediaStatistics stats = mMaster->GetStatistics();
|
||||
SLOG("Playback rate: %.1lfKB/s%s download rate: %.1lfKB/s%s",
|
||||
stats.mPlaybackRate / 1024,
|
||||
stats.mPlaybackRateReliable ? "" : " (unreliable)",
|
||||
stats.mDownloadRate / 1024,
|
||||
stats.mDownloadRateReliable ? "" : " (unreliable)");
|
||||
|
||||
mMaster->ScheduleStateMachineIn(TimeUnit::FromMicroseconds(USECS_PER_S));
|
||||
|
||||
mMaster->UpdateNextFrameStatus(
|
||||
MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING);
|
||||
}
|
||||
|
@ -2680,9 +2671,6 @@ ShutdownState::Enter()
|
|||
master->mLooping.DisconnectIfConnected();
|
||||
master->mSameOriginMedia.DisconnectIfConnected();
|
||||
master->mMediaPrincipalHandle.DisconnectIfConnected();
|
||||
master->mPlaybackBytesPerSecond.DisconnectIfConnected();
|
||||
master->mPlaybackRateReliable.DisconnectIfConnected();
|
||||
master->mDecoderPosition.DisconnectIfConnected();
|
||||
|
||||
master->mDuration.DisconnectAll();
|
||||
master->mNextFrameStatus.DisconnectAll();
|
||||
|
@ -2739,9 +2727,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
|||
INIT_MIRROR(mLooping, false),
|
||||
INIT_MIRROR(mSameOriginMedia, false),
|
||||
INIT_MIRROR(mMediaPrincipalHandle, PRINCIPAL_HANDLE_NONE),
|
||||
INIT_MIRROR(mPlaybackBytesPerSecond, 0.0),
|
||||
INIT_MIRROR(mPlaybackRateReliable, true),
|
||||
INIT_MIRROR(mDecoderPosition, 0),
|
||||
INIT_CANONICAL(mDuration, NullableTimeUnit()),
|
||||
INIT_CANONICAL(mNextFrameStatus, MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE),
|
||||
INIT_CANONICAL(mCurrentPosition, TimeUnit::Zero()),
|
||||
|
@ -2784,9 +2769,6 @@ MediaDecoderStateMachine::InitializationTask(MediaDecoder* aDecoder)
|
|||
mLooping.Connect(aDecoder->CanonicalLooping());
|
||||
mSameOriginMedia.Connect(aDecoder->CanonicalSameOriginMedia());
|
||||
mMediaPrincipalHandle.Connect(aDecoder->CanonicalMediaPrincipalHandle());
|
||||
mPlaybackBytesPerSecond.Connect(aDecoder->CanonicalPlaybackBytesPerSecond());
|
||||
mPlaybackRateReliable.Connect(aDecoder->CanonicalPlaybackRateReliable());
|
||||
mDecoderPosition.Connect(aDecoder->CanonicalDecoderPosition());
|
||||
|
||||
// Initialize watchers.
|
||||
mWatchManager.Watch(mBuffered,
|
||||
|
@ -3646,29 +3628,6 @@ MediaDecoderStateMachine::UpdateNextFrameStatus(NextFrameStatus aStatus)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MediaDecoderStateMachine::CanPlayThrough()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
return GetStatistics().CanPlayThrough();
|
||||
}
|
||||
|
||||
MediaStatistics
|
||||
MediaDecoderStateMachine::GetStatistics()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
MediaStatistics result;
|
||||
result.mDownloadRate =
|
||||
mResource->GetDownloadRate(&result.mDownloadRateReliable);
|
||||
result.mDownloadPosition = mResource->GetCachedDataEnd(mDecoderPosition);
|
||||
result.mTotalBytes = mResource->GetLength();
|
||||
result.mPlaybackRate = mPlaybackBytesPerSecond;
|
||||
result.mPlaybackRateReliable = mPlaybackRateReliable;
|
||||
result.mDecoderPosition = mDecoderPosition;
|
||||
result.mPlaybackPosition = mPlaybackOffset;
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::ScheduleStateMachine()
|
||||
{
|
||||
|
|
|
@ -301,10 +301,6 @@ private:
|
|||
// the decode monitor held.
|
||||
void UpdatePlaybackPosition(const media::TimeUnit& aTime);
|
||||
|
||||
bool CanPlayThrough();
|
||||
|
||||
MediaStatistics GetStatistics();
|
||||
|
||||
bool HasAudio() const { return mInfo.ref().HasAudio(); }
|
||||
bool HasVideo() const { return mInfo.ref().HasVideo(); }
|
||||
const MediaInfo& Info() const { return mInfo.ref(); }
|
||||
|
@ -696,16 +692,6 @@ private:
|
|||
// main-thread induced principal changes get reflected on MSG thread.
|
||||
Mirror<PrincipalHandle> mMediaPrincipalHandle;
|
||||
|
||||
// Estimate of the current playback rate (bytes/second).
|
||||
Mirror<double> mPlaybackBytesPerSecond;
|
||||
|
||||
// True if mPlaybackBytesPerSecond is a reliable estimate.
|
||||
Mirror<bool> mPlaybackRateReliable;
|
||||
|
||||
// Current decoding position in the stream.
|
||||
Mirror<int64_t> mDecoderPosition;
|
||||
|
||||
|
||||
// Duration of the media. This is guaranteed to be non-null after we finish
|
||||
// decoding the first frame.
|
||||
Canonical<media::NullableTimeUnit> mDuration;
|
||||
|
|
Загрузка…
Ссылка в новой задаче