зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1257013 - Part 3: Stop checking for corrupt frames in MediaDecoderStateMachine since we no longer produce them. r=ajones
--HG-- extra : rebase_source : a68da2757970cd28da5719d77e3036f9051041e5
This commit is contained in:
Родитель
41cff5119c
Коммит
fd534aefc7
|
@ -20,8 +20,7 @@ public:
|
|||
mParsedFrames(0),
|
||||
mDecodedFrames(0),
|
||||
mPresentedFrames(0),
|
||||
mDroppedFrames(0),
|
||||
mCorruptFrames(0) {}
|
||||
mDroppedFrames(0) {}
|
||||
|
||||
// Returns number of frames which have been parsed from the media.
|
||||
// Can be called on any thread.
|
||||
|
@ -49,12 +48,7 @@ public:
|
|||
// compoisition deadline.
|
||||
uint32_t GetDroppedFrames() {
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mDroppedFrames + mCorruptFrames;
|
||||
}
|
||||
|
||||
uint32_t GetCorruptedFrames() {
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
return mCorruptFrames;
|
||||
return mDroppedFrames;
|
||||
}
|
||||
|
||||
// Increments the parsed and decoded frame counters by the passed in counts.
|
||||
|
@ -76,11 +70,6 @@ public:
|
|||
++mPresentedFrames;
|
||||
}
|
||||
|
||||
void NotifyCorruptFrame() {
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
++mCorruptFrames;
|
||||
}
|
||||
|
||||
private:
|
||||
~FrameStatistics() {}
|
||||
|
||||
|
@ -100,8 +89,6 @@ private:
|
|||
uint32_t mPresentedFrames;
|
||||
|
||||
uint32_t mDroppedFrames;
|
||||
|
||||
uint32_t mCorruptFrames;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -281,8 +281,6 @@ public:
|
|||
// decoding.
|
||||
virtual bool VideoIsHardwareAccelerated() const { return false; }
|
||||
|
||||
virtual void DisableHardwareAcceleration() {}
|
||||
|
||||
TimedMetadataEventSource& TimedMetadataEvent()
|
||||
{
|
||||
return mTimedMetadataEvent;
|
||||
|
|
|
@ -238,7 +238,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
|||
mDropAudioUntilNextDiscontinuity(false),
|
||||
mDropVideoUntilNextDiscontinuity(false),
|
||||
mCurrentTimeBeforeSeek(0),
|
||||
mCorruptFrames(60),
|
||||
mDecodingFirstFrame(true),
|
||||
mSentLoadedMetadataEvent(false),
|
||||
mSentFirstFrameLoadedEvent(false),
|
||||
|
@ -894,10 +893,6 @@ MediaDecoderStateMachine::OnVideoDecoded(MediaData* aVideoSample,
|
|||
(video ? video->GetEndTime() : -1),
|
||||
(video ? video->mDiscontinuity : 0));
|
||||
|
||||
// Check frame validity here for every decoded frame in order to have a
|
||||
// better chance to make the decision of turning off HW acceleration.
|
||||
CheckFrameValidity(aVideoSample->As<VideoData>());
|
||||
|
||||
switch (mState) {
|
||||
case DECODER_STATE_BUFFERING: {
|
||||
// If we're buffering, this may be the sample we need to stop buffering.
|
||||
|
@ -2419,33 +2414,6 @@ MediaDecoderStateMachine::Reset()
|
|||
DecodeTaskQueue()->Dispatch(resetTask.forget());
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::CheckFrameValidity(VideoData* aData)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
|
||||
// Update corrupt-frames statistics
|
||||
if (aData->mImage && !aData->mImage->IsValid() && !gfxPrefs::HardwareVideoDecodingForceEnabled()) {
|
||||
FrameStatistics& frameStats = *mFrameStats;
|
||||
frameStats.NotifyCorruptFrame();
|
||||
// If more than 10% of the last 30 frames have been corrupted, then try disabling
|
||||
// hardware acceleration. We use 10 as the corrupt value because RollingMean<>
|
||||
// only supports integer types.
|
||||
mCorruptFrames.insert(10);
|
||||
if (mReader->VideoIsHardwareAccelerated() &&
|
||||
frameStats.GetPresentedFrames() > 60 &&
|
||||
mCorruptFrames.mean() >= 2 /* 20% */) {
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(mReader, &MediaDecoderReader::DisableHardwareAcceleration);
|
||||
DecodeTaskQueue()->Dispatch(task.forget());
|
||||
mCorruptFrames.clear();
|
||||
gfxCriticalNote << "Too many dropped/corrupted frames, disabling DXVA";
|
||||
}
|
||||
} else {
|
||||
mCorruptFrames.insert(0);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t
|
||||
MediaDecoderStateMachine::GetClock(TimeStamp* aTimeStamp) const
|
||||
{
|
||||
|
|
|
@ -84,7 +84,6 @@ hardware (via AudioStream).
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "mozilla/RollingMean.h"
|
||||
#include "mozilla/StateMirroring.h"
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -454,10 +453,6 @@ protected:
|
|||
// machine thread, caller must hold the decoder lock.
|
||||
void UpdatePlaybackPositionInternal(int64_t aTime);
|
||||
|
||||
// Decode monitor must be held. To determine if MDSM needs to turn off HW
|
||||
// acceleration.
|
||||
void CheckFrameValidity(VideoData* aData);
|
||||
|
||||
// Update playback position and trigger next update by default time period.
|
||||
// Called on the state machine thread.
|
||||
void UpdatePlaybackPositionPeriodically();
|
||||
|
@ -1131,8 +1126,6 @@ private:
|
|||
|
||||
mozilla::MediaMetadataManager mMetadataManager;
|
||||
|
||||
mozilla::RollingMean<uint32_t, uint32_t> mCorruptFrames;
|
||||
|
||||
// Track our request to update the buffered ranges
|
||||
MozPromiseRequestHolder<MediaDecoderReader::BufferedUpdatePromise> mBufferedUpdateRequest;
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
|
|||
, mInitDone(false)
|
||||
, mIsEncrypted(false)
|
||||
, mTrackDemuxersMayBlock(false)
|
||||
, mHardwareAccelerationDisabled(false)
|
||||
, mDemuxOnly(false)
|
||||
, mVideoFrameContainer(aVideoFrameContainer)
|
||||
{
|
||||
|
@ -406,7 +405,6 @@ MediaFormatReader::EnsureDecoderCreated(TrackType aTrack)
|
|||
mInfo.mVideo,
|
||||
decoder.mTaskQueue,
|
||||
decoder.mCallback,
|
||||
mHardwareAccelerationDisabled ? LayersBackend::LAYERS_NONE :
|
||||
mLayersBackendType,
|
||||
GetImageContainer());
|
||||
break;
|
||||
|
@ -471,23 +469,6 @@ MediaFormatReader::GetDecoderData(TrackType aTrack)
|
|||
return mVideo;
|
||||
}
|
||||
|
||||
void
|
||||
MediaFormatReader::DisableHardwareAcceleration()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
if (HasVideo() && !mHardwareAccelerationDisabled) {
|
||||
mHardwareAccelerationDisabled = true;
|
||||
Flush(TrackInfo::kVideoTrack);
|
||||
mVideo.ShutdownDecoder();
|
||||
if (!EnsureDecoderCreated(TrackType::kVideoTrack)) {
|
||||
LOG("Unable to re-create decoder, aborting");
|
||||
NotifyError(TrackInfo::kVideoTrack);
|
||||
return;
|
||||
}
|
||||
ScheduleUpdate(TrackInfo::kVideoTrack);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MediaFormatReader::ShouldSkip(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold)
|
||||
{
|
||||
|
|
|
@ -70,8 +70,6 @@ public:
|
|||
|
||||
bool VideoIsHardwareAccelerated() const override;
|
||||
|
||||
void DisableHardwareAcceleration() override;
|
||||
|
||||
bool IsWaitForDataSupported() override { return true; }
|
||||
RefPtr<WaitForDataPromise> WaitForData(MediaData::Type aType) override;
|
||||
|
||||
|
@ -449,8 +447,6 @@ private:
|
|||
// Set to true if any of our track buffers may be blocking.
|
||||
bool mTrackDemuxersMayBlock;
|
||||
|
||||
bool mHardwareAccelerationDisabled;
|
||||
|
||||
// Set the demuxed-only flag.
|
||||
Atomic<bool> mDemuxOnly;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче