Bug 1628690 [Wayland][VA-API] Respect disabled HW decoding to allow fallback to SW decoding, r=jya

Differential Revision: https://phabricator.services.mozilla.com/D71158
This commit is contained in:
Martin Stransky 2020-04-16 13:49:37 +00:00
parent 0c13707a40
commit 3a6824ecbf
3 changed files with 13 additions and 6 deletions

View File

@ -49,7 +49,9 @@ class FFmpegDecoderModule : public PlatformDecoderModule {
RefPtr<MediaDataDecoder> decoder = new FFmpegVideoDecoder<V>(
mLib, aParams.mTaskQueue, aParams.VideoConfig(),
aParams.mKnowsCompositor, aParams.mImageContainer,
aParams.mOptions.contains(CreateDecoderParams::Option::LowLatency));
aParams.mOptions.contains(CreateDecoderParams::Option::LowLatency),
aParams.mOptions.contains(
CreateDecoderParams::Option::HardwareDecoderNotAllowed));
return decoder.forget();
}

View File

@ -270,10 +270,11 @@ void FFmpegVideoDecoder<LIBAV_VER>::PtsCorrectionContext::Reset() {
FFmpegVideoDecoder<LIBAV_VER>::FFmpegVideoDecoder(
FFmpegLibWrapper* aLib, TaskQueue* aTaskQueue, const VideoInfo& aConfig,
KnowsCompositor* aAllocator, ImageContainer* aImageContainer,
bool aLowLatency)
bool aLowLatency, bool aDisableHardwareDecoding)
: FFmpegDataDecoder(aLib, aTaskQueue, GetCodecId(aConfig.mMimeType)),
#ifdef MOZ_WAYLAND_USE_VAAPI
mVAAPIDeviceContext(nullptr),
mDisableHardwareDecoding(aDisableHardwareDecoding),
#endif
mImageAllocator(aAllocator),
mImageContainer(aImageContainer),
@ -289,9 +290,11 @@ RefPtr<MediaDataDecoder::InitPromise> FFmpegVideoDecoder<LIBAV_VER>::Init() {
MediaResult rv;
#ifdef MOZ_WAYLAND_USE_VAAPI
rv = InitVAAPIDecoder();
if (NS_SUCCEEDED(rv)) {
return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__);
if (!mDisableHardwareDecoding) {
rv = InitVAAPIDecoder();
if (NS_SUCCEEDED(rv)) {
return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__);
}
}
#endif

View File

@ -48,7 +48,8 @@ class FFmpegVideoDecoder<LIBAV_VER>
public:
FFmpegVideoDecoder(FFmpegLibWrapper* aLib, TaskQueue* aTaskQueue,
const VideoInfo& aConfig, KnowsCompositor* aAllocator,
ImageContainer* aImageContainer, bool aLowLatency);
ImageContainer* aImageContainer, bool aLowLatency,
bool aDisableHardwareDecoding);
RefPtr<InitPromise> Init() override;
void InitCodecContext() override;
@ -109,6 +110,7 @@ class FFmpegVideoDecoder<LIBAV_VER>
#ifdef MOZ_WAYLAND_USE_VAAPI
AVBufferRef* mVAAPIDeviceContext;
const bool mDisableHardwareDecoding;
#endif
RefPtr<KnowsCompositor> mImageAllocator;
RefPtr<ImageContainer> mImageContainer;