зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1196417 - Make video software fallback only affect the current video instead of the entire browser. r=cpearce
This commit is contained in:
Родитель
e2765944f2
Коммит
ec61d0727e
|
@ -218,7 +218,6 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
|||
mCurrentTimeBeforeSeek(0),
|
||||
mCorruptFrames(30),
|
||||
mDecodingFirstFrame(true),
|
||||
mDisabledHardwareAcceleration(false),
|
||||
mSentLoadedMetadataEvent(false),
|
||||
mSentFirstFrameLoadedEvent(false),
|
||||
mSentPlaybackEndedEvent(false),
|
||||
|
@ -2482,14 +2481,13 @@ bool MediaDecoderStateMachine::CheckFrameValidity(VideoData* aData)
|
|||
// hardware acceleration. We use 10 as the corrupt value because RollingMean<>
|
||||
// only supports integer types.
|
||||
mCorruptFrames.insert(10);
|
||||
if (!mDisabledHardwareAcceleration &&
|
||||
mReader->VideoIsHardwareAccelerated() &&
|
||||
if (mReader->VideoIsHardwareAccelerated() &&
|
||||
frameStats.GetPresentedFrames() > 30 &&
|
||||
mCorruptFrames.mean() >= 1 /* 10% */) {
|
||||
nsCOMPtr<nsIRunnable> task =
|
||||
NS_NewRunnableMethod(mReader, &MediaDecoderReader::DisableHardwareAcceleration);
|
||||
DecodeTaskQueue()->Dispatch(task.forget());
|
||||
mDisabledHardwareAcceleration = true;
|
||||
mCorruptFrames.clear();
|
||||
gfxCriticalNote << "Too many dropped/corrupted frames, disabling DXVA";
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -1271,8 +1271,6 @@ private:
|
|||
// successeeding.
|
||||
bool mDecodingFirstFrame;
|
||||
|
||||
bool mDisabledHardwareAcceleration;
|
||||
|
||||
// True if we are back from DECODER_STATE_DORMANT state and
|
||||
// LoadedMetadataEvent was already sent.
|
||||
bool mSentLoadedMetadataEvent;
|
||||
|
|
|
@ -73,6 +73,7 @@ MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
|
|||
, mSeekable(false)
|
||||
, mIsEncrypted(false)
|
||||
, mTrackDemuxersMayBlock(false)
|
||||
, mHardwareAccelerationDisabled(false)
|
||||
{
|
||||
MOZ_ASSERT(aDemuxer);
|
||||
MOZ_COUNT_CTOR(MediaFormatReader);
|
||||
|
@ -467,8 +468,11 @@ MediaFormatReader::EnsureDecodersCreated()
|
|||
false);
|
||||
|
||||
mVideo.mDecoderInitialized = false;
|
||||
// If we've disabled hardware acceleration for this reader, then we can't use
|
||||
// the shared decoder.
|
||||
if (mSharedDecoderManager &&
|
||||
mPlatform->SupportsSharedDecoders(mInfo.mVideo)) {
|
||||
mPlatform->SupportsSharedDecoders(mInfo.mVideo) &&
|
||||
!mHardwareAccelerationDisabled) {
|
||||
mVideo.mDecoder =
|
||||
mSharedDecoderManager->CreateVideoDecoder(mPlatform,
|
||||
mVideo.mInfo ?
|
||||
|
@ -479,12 +483,15 @@ MediaFormatReader::EnsureDecodersCreated()
|
|||
mVideo.mTaskQueue,
|
||||
mVideo.mCallback);
|
||||
} else {
|
||||
// Decoders use the layers backend to decide if they can use hardware decoding,
|
||||
// so specify LAYERS_NONE if we want to forcibly disable it.
|
||||
mVideo.mDecoder =
|
||||
mPlatform->CreateDecoder(mVideo.mInfo ?
|
||||
*mVideo.mInfo->GetAsVideoInfo() :
|
||||
mInfo.mVideo,
|
||||
mVideo.mTaskQueue,
|
||||
mVideo.mCallback,
|
||||
mHardwareAccelerationDisabled ? LayersBackend::LAYERS_NONE :
|
||||
mLayersBackendType,
|
||||
mDecoder->GetImageContainer());
|
||||
}
|
||||
|
@ -590,8 +597,8 @@ void
|
|||
MediaFormatReader::DisableHardwareAcceleration()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
if (HasVideo()) {
|
||||
mPlatform->DisableHardwareAcceleration();
|
||||
if (HasVideo() && !mHardwareAccelerationDisabled) {
|
||||
mHardwareAccelerationDisabled = true;
|
||||
Flush(TrackInfo::kVideoTrack);
|
||||
mVideo.mDecoder->Shutdown();
|
||||
mVideo.mDecoder = nullptr;
|
||||
|
|
|
@ -399,6 +399,8 @@ private:
|
|||
// Set to true if any of our track buffers may be blocking.
|
||||
bool mTrackDemuxersMayBlock;
|
||||
|
||||
bool mHardwareAccelerationDisabled;
|
||||
|
||||
// Seeking objects.
|
||||
bool IsSeeking() const { return mPendingSeekTime.isSome(); }
|
||||
void AttemptSeek();
|
||||
|
|
|
@ -110,8 +110,6 @@ public:
|
|||
// feeding it to MediaDataDecoder::Input.
|
||||
virtual ConversionRequired DecoderNeedsConversion(const TrackInfo& aConfig) const = 0;
|
||||
|
||||
virtual void DisableHardwareAcceleration() {}
|
||||
|
||||
virtual bool SupportsSharedDecoders(const VideoInfo& aConfig) const {
|
||||
return !AgnosticMimeType(aConfig.mMimeType);
|
||||
}
|
||||
|
|
|
@ -120,13 +120,6 @@ SharedDecoderManager::CreateVideoDecoder(
|
|||
return proxy.forget();
|
||||
}
|
||||
|
||||
void
|
||||
SharedDecoderManager::DisableHardwareAcceleration()
|
||||
{
|
||||
MOZ_ASSERT(mPDM);
|
||||
mPDM->DisableHardwareAcceleration();
|
||||
}
|
||||
|
||||
bool
|
||||
SharedDecoderManager::Recreate(const VideoInfo& aConfig)
|
||||
{
|
||||
|
|
|
@ -41,7 +41,6 @@ public:
|
|||
friend class SharedDecoderProxy;
|
||||
friend class SharedDecoderCallback;
|
||||
|
||||
void DisableHardwareAcceleration();
|
||||
bool Recreate(const VideoInfo& aConfig);
|
||||
|
||||
private:
|
||||
|
|
|
@ -41,13 +41,6 @@ WMFDecoderModule::~WMFDecoderModule()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
WMFDecoderModule::DisableHardwareAcceleration()
|
||||
{
|
||||
sDXVAEnabled = false;
|
||||
sIsIntelDecoderEnabled = false;
|
||||
}
|
||||
|
||||
static void
|
||||
SetNumOfDecoderThreads()
|
||||
{
|
||||
|
@ -133,14 +126,6 @@ WMFDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
|||
return decoder.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
WMFDecoderModule::SupportsSharedDecoders(const VideoInfo& aConfig) const
|
||||
{
|
||||
// If DXVA is enabled, but we're not going to use it for this specific config, then
|
||||
// we can't use the shared decoder.
|
||||
return !AgnosticMimeType(aConfig.mMimeType);
|
||||
}
|
||||
|
||||
bool
|
||||
WMFDecoderModule::SupportsMimeType(const nsACString& aMimeType)
|
||||
{
|
||||
|
|
|
@ -33,9 +33,6 @@ public:
|
|||
|
||||
bool SupportsMimeType(const nsACString& aMimeType) override;
|
||||
|
||||
virtual void DisableHardwareAcceleration() override;
|
||||
virtual bool SupportsSharedDecoders(const VideoInfo& aConfig) const override;
|
||||
|
||||
virtual ConversionRequired
|
||||
DecoderNeedsConversion(const TrackInfo& aConfig) const override;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче