зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1161901 - Sprinkle more assertions and fix some formatting. r=jww
This commit is contained in:
Родитель
973ebd793d
Коммит
aec6ecb986
|
@ -325,7 +325,8 @@ MediaDecoderStateMachine::InitializationTask()
|
|||
mWatchManager.Watch(mLogicallySeeking, &MediaDecoderStateMachine::LogicallySeekingChanged);
|
||||
}
|
||||
|
||||
bool MediaDecoderStateMachine::HasFutureAudio() {
|
||||
bool MediaDecoderStateMachine::HasFutureAudio()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
NS_ASSERTION(HasAudio(), "Should only call HasFutureAudio() when we have audio");
|
||||
|
@ -340,14 +341,16 @@ bool MediaDecoderStateMachine::HasFutureAudio() {
|
|||
AudioQueue().IsFinished());
|
||||
}
|
||||
|
||||
bool MediaDecoderStateMachine::HaveNextFrameData() {
|
||||
bool MediaDecoderStateMachine::HaveNextFrameData()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
return (!HasAudio() || HasFutureAudio()) &&
|
||||
(!HasVideo() || VideoQueue().GetSize() > 0);
|
||||
}
|
||||
|
||||
int64_t MediaDecoderStateMachine::GetDecodedAudioDuration() {
|
||||
int64_t MediaDecoderStateMachine::GetDecodedAudioDuration()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
int64_t audioDecoded = AudioQueue().Duration();
|
||||
|
@ -1395,7 +1398,8 @@ int64_t MediaDecoderStateMachine::GetCurrentTimeUs() const
|
|||
return mCurrentFrameTime;
|
||||
}
|
||||
|
||||
bool MediaDecoderStateMachine::IsRealTime() const {
|
||||
bool MediaDecoderStateMachine::IsRealTime() const
|
||||
{
|
||||
return mRealTime;
|
||||
}
|
||||
|
||||
|
@ -3305,7 +3309,8 @@ void MediaDecoderStateMachine::ScheduleStateMachineWithLockAndWakeDecoder()
|
|||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::ScheduleStateMachine() {
|
||||
MediaDecoderStateMachine::ScheduleStateMachine()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mDispatchedStateMachine) {
|
||||
|
@ -3354,6 +3359,7 @@ bool MediaDecoderStateMachine::OnTaskQueue() const
|
|||
|
||||
bool MediaDecoderStateMachine::IsStateMachineScheduled() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
return mDispatchedStateMachine || mDelayedScheduler.IsScheduled();
|
||||
}
|
||||
|
||||
|
|
|
@ -278,15 +278,15 @@ public:
|
|||
|
||||
// Must be called with the decode monitor held.
|
||||
bool IsBuffering() const {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
return mState == DECODER_STATE_BUFFERING;
|
||||
}
|
||||
|
||||
// Must be called with the decode monitor held.
|
||||
bool IsSeeking() const {
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
|
||||
return mState == DECODER_STATE_SEEKING;
|
||||
}
|
||||
|
||||
|
@ -358,6 +358,7 @@ public:
|
|||
|
||||
// Drop reference to decoder. Only called during shutdown dance.
|
||||
void BreakCycles() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mReader) {
|
||||
mReader->BreakCycles();
|
||||
}
|
||||
|
@ -413,10 +414,12 @@ public:
|
|||
void OnNotDecoded(MediaData::Type aType, MediaDecoderReader::NotDecodedReason aReason);
|
||||
void OnAudioNotDecoded(MediaDecoderReader::NotDecodedReason aReason)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
OnNotDecoded(MediaData::AUDIO_DATA, aReason);
|
||||
}
|
||||
void OnVideoNotDecoded(MediaDecoderReader::NotDecodedReason aReason)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
OnNotDecoded(MediaData::VIDEO_DATA, aReason);
|
||||
}
|
||||
|
||||
|
@ -507,6 +510,7 @@ protected:
|
|||
|
||||
bool OutOfDecodedVideo()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
// In buffering mode, we keep the last already-played frame in the queue.
|
||||
int emptyVideoSize = mState == DECODER_STATE_BUFFERING ? 1 : 0;
|
||||
return IsVideoDecoding() && !VideoQueue().IsFinished() && VideoQueue().GetSize() <= emptyVideoSize;
|
||||
|
@ -826,6 +830,7 @@ public:
|
|||
|
||||
void CompleteRequest()
|
||||
{
|
||||
MOZ_ASSERT(mSelf->OnTaskQueue());
|
||||
mRequest.Complete();
|
||||
mTarget = TimeStamp();
|
||||
}
|
||||
|
@ -1070,6 +1075,7 @@ protected:
|
|||
// samples we must consume before are considered to be finished prerolling.
|
||||
uint32_t AudioPrerollUsecs() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
if (IsRealTime()) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1081,6 +1087,7 @@ protected:
|
|||
|
||||
uint32_t VideoPrerollFrames() const
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
return IsRealTime() ? 0 : GetAmpleVideoFrames() / 2;
|
||||
}
|
||||
|
||||
|
@ -1101,6 +1108,7 @@ protected:
|
|||
|
||||
void StopPrerollingAudio()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mIsAudioPrerolling) {
|
||||
mIsAudioPrerolling = false;
|
||||
|
@ -1110,6 +1118,7 @@ protected:
|
|||
|
||||
void StopPrerollingVideo()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
AssertCurrentThreadInMonitor();
|
||||
if (mIsVideoPrerolling) {
|
||||
mIsVideoPrerolling = false;
|
||||
|
@ -1141,6 +1150,7 @@ protected:
|
|||
MediaPromiseConsumerHolder<MediaDecoderReader::WaitForDataPromise> mAudioWaitRequest;
|
||||
const char* AudioRequestStatus()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
if (mAudioDataRequest.Exists()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mAudioWaitRequest.Exists());
|
||||
return "pending";
|
||||
|
@ -1154,6 +1164,7 @@ protected:
|
|||
MediaPromiseConsumerHolder<MediaDecoderReader::VideoDataPromise> mVideoDataRequest;
|
||||
const char* VideoRequestStatus()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
if (mVideoDataRequest.Exists()) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mVideoWaitRequest.Exists());
|
||||
return "pending";
|
||||
|
@ -1165,6 +1176,7 @@ protected:
|
|||
|
||||
MediaPromiseConsumerHolder<MediaDecoderReader::WaitForDataPromise>& WaitRequestRef(MediaData::Type aType)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
return aType == MediaData::AUDIO_DATA ? mAudioWaitRequest : mVideoWaitRequest;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче