зеркало из 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),
|
mCurrentTimeBeforeSeek(0),
|
||||||
mCorruptFrames(30),
|
mCorruptFrames(30),
|
||||||
mDecodingFirstFrame(true),
|
mDecodingFirstFrame(true),
|
||||||
mDisabledHardwareAcceleration(false),
|
|
||||||
mSentLoadedMetadataEvent(false),
|
mSentLoadedMetadataEvent(false),
|
||||||
mSentFirstFrameLoadedEvent(false),
|
mSentFirstFrameLoadedEvent(false),
|
||||||
mSentPlaybackEndedEvent(false),
|
mSentPlaybackEndedEvent(false),
|
||||||
|
@ -2482,14 +2481,13 @@ bool MediaDecoderStateMachine::CheckFrameValidity(VideoData* aData)
|
||||||
// hardware acceleration. We use 10 as the corrupt value because RollingMean<>
|
// hardware acceleration. We use 10 as the corrupt value because RollingMean<>
|
||||||
// only supports integer types.
|
// only supports integer types.
|
||||||
mCorruptFrames.insert(10);
|
mCorruptFrames.insert(10);
|
||||||
if (!mDisabledHardwareAcceleration &&
|
if (mReader->VideoIsHardwareAccelerated() &&
|
||||||
mReader->VideoIsHardwareAccelerated() &&
|
|
||||||
frameStats.GetPresentedFrames() > 30 &&
|
frameStats.GetPresentedFrames() > 30 &&
|
||||||
mCorruptFrames.mean() >= 1 /* 10% */) {
|
mCorruptFrames.mean() >= 1 /* 10% */) {
|
||||||
nsCOMPtr<nsIRunnable> task =
|
nsCOMPtr<nsIRunnable> task =
|
||||||
NS_NewRunnableMethod(mReader, &MediaDecoderReader::DisableHardwareAcceleration);
|
NS_NewRunnableMethod(mReader, &MediaDecoderReader::DisableHardwareAcceleration);
|
||||||
DecodeTaskQueue()->Dispatch(task.forget());
|
DecodeTaskQueue()->Dispatch(task.forget());
|
||||||
mDisabledHardwareAcceleration = true;
|
mCorruptFrames.clear();
|
||||||
gfxCriticalNote << "Too many dropped/corrupted frames, disabling DXVA";
|
gfxCriticalNote << "Too many dropped/corrupted frames, disabling DXVA";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1271,8 +1271,6 @@ private:
|
||||||
// successeeding.
|
// successeeding.
|
||||||
bool mDecodingFirstFrame;
|
bool mDecodingFirstFrame;
|
||||||
|
|
||||||
bool mDisabledHardwareAcceleration;
|
|
||||||
|
|
||||||
// True if we are back from DECODER_STATE_DORMANT state and
|
// True if we are back from DECODER_STATE_DORMANT state and
|
||||||
// LoadedMetadataEvent was already sent.
|
// LoadedMetadataEvent was already sent.
|
||||||
bool mSentLoadedMetadataEvent;
|
bool mSentLoadedMetadataEvent;
|
||||||
|
|
|
@ -73,6 +73,7 @@ MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
|
||||||
, mSeekable(false)
|
, mSeekable(false)
|
||||||
, mIsEncrypted(false)
|
, mIsEncrypted(false)
|
||||||
, mTrackDemuxersMayBlock(false)
|
, mTrackDemuxersMayBlock(false)
|
||||||
|
, mHardwareAccelerationDisabled(false)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aDemuxer);
|
MOZ_ASSERT(aDemuxer);
|
||||||
MOZ_COUNT_CTOR(MediaFormatReader);
|
MOZ_COUNT_CTOR(MediaFormatReader);
|
||||||
|
@ -467,8 +468,11 @@ MediaFormatReader::EnsureDecodersCreated()
|
||||||
false);
|
false);
|
||||||
|
|
||||||
mVideo.mDecoderInitialized = false;
|
mVideo.mDecoderInitialized = false;
|
||||||
|
// If we've disabled hardware acceleration for this reader, then we can't use
|
||||||
|
// the shared decoder.
|
||||||
if (mSharedDecoderManager &&
|
if (mSharedDecoderManager &&
|
||||||
mPlatform->SupportsSharedDecoders(mInfo.mVideo)) {
|
mPlatform->SupportsSharedDecoders(mInfo.mVideo) &&
|
||||||
|
!mHardwareAccelerationDisabled) {
|
||||||
mVideo.mDecoder =
|
mVideo.mDecoder =
|
||||||
mSharedDecoderManager->CreateVideoDecoder(mPlatform,
|
mSharedDecoderManager->CreateVideoDecoder(mPlatform,
|
||||||
mVideo.mInfo ?
|
mVideo.mInfo ?
|
||||||
|
@ -479,13 +483,16 @@ MediaFormatReader::EnsureDecodersCreated()
|
||||||
mVideo.mTaskQueue,
|
mVideo.mTaskQueue,
|
||||||
mVideo.mCallback);
|
mVideo.mCallback);
|
||||||
} else {
|
} 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 =
|
mVideo.mDecoder =
|
||||||
mPlatform->CreateDecoder(mVideo.mInfo ?
|
mPlatform->CreateDecoder(mVideo.mInfo ?
|
||||||
*mVideo.mInfo->GetAsVideoInfo() :
|
*mVideo.mInfo->GetAsVideoInfo() :
|
||||||
mInfo.mVideo,
|
mInfo.mVideo,
|
||||||
mVideo.mTaskQueue,
|
mVideo.mTaskQueue,
|
||||||
mVideo.mCallback,
|
mVideo.mCallback,
|
||||||
mLayersBackendType,
|
mHardwareAccelerationDisabled ? LayersBackend::LAYERS_NONE :
|
||||||
|
mLayersBackendType,
|
||||||
mDecoder->GetImageContainer());
|
mDecoder->GetImageContainer());
|
||||||
}
|
}
|
||||||
NS_ENSURE_TRUE(mVideo.mDecoder != nullptr, false);
|
NS_ENSURE_TRUE(mVideo.mDecoder != nullptr, false);
|
||||||
|
@ -590,8 +597,8 @@ void
|
||||||
MediaFormatReader::DisableHardwareAcceleration()
|
MediaFormatReader::DisableHardwareAcceleration()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(OnTaskQueue());
|
MOZ_ASSERT(OnTaskQueue());
|
||||||
if (HasVideo()) {
|
if (HasVideo() && !mHardwareAccelerationDisabled) {
|
||||||
mPlatform->DisableHardwareAcceleration();
|
mHardwareAccelerationDisabled = true;
|
||||||
Flush(TrackInfo::kVideoTrack);
|
Flush(TrackInfo::kVideoTrack);
|
||||||
mVideo.mDecoder->Shutdown();
|
mVideo.mDecoder->Shutdown();
|
||||||
mVideo.mDecoder = nullptr;
|
mVideo.mDecoder = nullptr;
|
||||||
|
|
|
@ -399,6 +399,8 @@ private:
|
||||||
// Set to true if any of our track buffers may be blocking.
|
// Set to true if any of our track buffers may be blocking.
|
||||||
bool mTrackDemuxersMayBlock;
|
bool mTrackDemuxersMayBlock;
|
||||||
|
|
||||||
|
bool mHardwareAccelerationDisabled;
|
||||||
|
|
||||||
// Seeking objects.
|
// Seeking objects.
|
||||||
bool IsSeeking() const { return mPendingSeekTime.isSome(); }
|
bool IsSeeking() const { return mPendingSeekTime.isSome(); }
|
||||||
void AttemptSeek();
|
void AttemptSeek();
|
||||||
|
|
|
@ -110,8 +110,6 @@ public:
|
||||||
// feeding it to MediaDataDecoder::Input.
|
// feeding it to MediaDataDecoder::Input.
|
||||||
virtual ConversionRequired DecoderNeedsConversion(const TrackInfo& aConfig) const = 0;
|
virtual ConversionRequired DecoderNeedsConversion(const TrackInfo& aConfig) const = 0;
|
||||||
|
|
||||||
virtual void DisableHardwareAcceleration() {}
|
|
||||||
|
|
||||||
virtual bool SupportsSharedDecoders(const VideoInfo& aConfig) const {
|
virtual bool SupportsSharedDecoders(const VideoInfo& aConfig) const {
|
||||||
return !AgnosticMimeType(aConfig.mMimeType);
|
return !AgnosticMimeType(aConfig.mMimeType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,13 +120,6 @@ SharedDecoderManager::CreateVideoDecoder(
|
||||||
return proxy.forget();
|
return proxy.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
SharedDecoderManager::DisableHardwareAcceleration()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(mPDM);
|
|
||||||
mPDM->DisableHardwareAcceleration();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SharedDecoderManager::Recreate(const VideoInfo& aConfig)
|
SharedDecoderManager::Recreate(const VideoInfo& aConfig)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,6 @@ public:
|
||||||
friend class SharedDecoderProxy;
|
friend class SharedDecoderProxy;
|
||||||
friend class SharedDecoderCallback;
|
friend class SharedDecoderCallback;
|
||||||
|
|
||||||
void DisableHardwareAcceleration();
|
|
||||||
bool Recreate(const VideoInfo& aConfig);
|
bool Recreate(const VideoInfo& aConfig);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -41,13 +41,6 @@ WMFDecoderModule::~WMFDecoderModule()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
WMFDecoderModule::DisableHardwareAcceleration()
|
|
||||||
{
|
|
||||||
sDXVAEnabled = false;
|
|
||||||
sIsIntelDecoderEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetNumOfDecoderThreads()
|
SetNumOfDecoderThreads()
|
||||||
{
|
{
|
||||||
|
@ -133,14 +126,6 @@ WMFDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||||
return decoder.forget();
|
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
|
bool
|
||||||
WMFDecoderModule::SupportsMimeType(const nsACString& aMimeType)
|
WMFDecoderModule::SupportsMimeType(const nsACString& aMimeType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,9 +33,6 @@ public:
|
||||||
|
|
||||||
bool SupportsMimeType(const nsACString& aMimeType) override;
|
bool SupportsMimeType(const nsACString& aMimeType) override;
|
||||||
|
|
||||||
virtual void DisableHardwareAcceleration() override;
|
|
||||||
virtual bool SupportsSharedDecoders(const VideoInfo& aConfig) const override;
|
|
||||||
|
|
||||||
virtual ConversionRequired
|
virtual ConversionRequired
|
||||||
DecoderNeedsConversion(const TrackInfo& aConfig) const override;
|
DecoderNeedsConversion(const TrackInfo& aConfig) const override;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче