зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1743159 Disable hardware video decoding for WebRTC when decode fails, r=jya
Recently hardware video decoding is enabled by default for WebRTC and there isn't any fallback if it fails. Let's try HW decoding first and fallback to SW decoding if we fail as we do for media video playback. Differential Revision: https://phabricator.services.mozilla.com/D132492
This commit is contained in:
Родитель
4ef99ace6a
Коммит
9b8c7dbec4
|
@ -61,6 +61,9 @@ int32_t WebrtcMediaDataDecoder::Decode(const webrtc::EncodedImage& aInputImage,
|
|||
}
|
||||
}
|
||||
|
||||
auto disabledHardwareAcceleration =
|
||||
MakeScopeExit([&] { mDisabledHardwareAcceleration = true; });
|
||||
|
||||
RefPtr<MediaRawData> compressedFrame =
|
||||
new MediaRawData(aInputImage.data(), aInputImage.size());
|
||||
if (!compressedFrame->Data()) {
|
||||
|
@ -108,8 +111,12 @@ int32_t WebrtcMediaDataDecoder::Decode(const webrtc::EncodedImage& aInputImage,
|
|||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
|
||||
return NS_SUCCEEDED(mError) ? WEBRTC_VIDEO_CODEC_OK
|
||||
: WEBRTC_VIDEO_CODEC_ERROR;
|
||||
if (NS_FAILED(mError)) {
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
|
||||
disabledHardwareAcceleration.release();
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
int32_t WebrtcMediaDataDecoder::RegisterDecodeCompleteCallback(
|
||||
|
@ -157,7 +164,11 @@ int32_t WebrtcMediaDataDecoder::CreateDecoder() {
|
|||
CreateDecoderParams::Option::LowLatency,
|
||||
CreateDecoderParams::Option::FullH264Parsing,
|
||||
CreateDecoderParams::Option::
|
||||
ErrorIfNoInitializationData),
|
||||
ErrorIfNoInitializationData,
|
||||
mDisabledHardwareAcceleration
|
||||
? CreateDecoderParams::Option::
|
||||
HardwareDecoderNotAllowed
|
||||
: CreateDecoderParams::Option::Default),
|
||||
mTrackType, mImageContainer, knowsCompositor})
|
||||
->Then(
|
||||
tq, __func__,
|
||||
|
|
|
@ -62,6 +62,7 @@ class WebrtcMediaDataDecoder : public WebrtcVideoDecoder {
|
|||
MediaResult mError = NS_OK;
|
||||
MediaDataDecoder::DecodedData mResults;
|
||||
const nsCString mCodecType;
|
||||
bool mDisabledHardwareAcceleration = false;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче