Bug 1860492 - Add a pref to disable Theora playback, disable it on Nightly. r=media-playback-reviewers,alwu

Differential Revision: https://phabricator.services.mozilla.com/D204052
This commit is contained in:
Paul Adenot 2024-04-04 15:02:31 +00:00
Родитель 9c35a1eb34
Коммит 0737e57898
3 изменённых файлов: 21 добавлений и 7 удалений

Просмотреть файл

@ -24,7 +24,10 @@ bool OggDecoder::IsSupportedType(const MediaContainerType& aContainerType) {
return false;
}
const bool isOggVideo = (aContainerType.Type() != MEDIAMIMETYPE(AUDIO_OGG));
const bool isOggVideo = (aContainerType.Type() == MEDIAMIMETYPE(VIDEO_OGG));
if (isOggVideo && !StaticPrefs::media_theora_enabled()) {
return false;
}
const MediaCodecs& codecs = aContainerType.ExtendedType().Codecs();
if (codecs.IsEmpty()) {
@ -40,8 +43,9 @@ bool OggDecoder::IsSupportedType(const MediaContainerType& aContainerType) {
}
// Note: Only accept Theora in a video container type, not in an audio
// container type.
if (isOggVideo && codec.EqualsLiteral("theora")) {
continue;
if (aContainerType.Type() != MEDIAMIMETYPE(AUDIO_OGG) &&
codec.EqualsLiteral("theora")) {
return StaticPrefs::media_theora_enabled();
}
// Some unsupported codec.
return false;

Просмотреть файл

@ -36,8 +36,9 @@ static bool IsAvailableInDefault(DecoderType type) {
case DecoderType::AV1:
return StaticPrefs::media_av1_enabled();
#endif
case DecoderType::Opus:
case DecoderType::Theora:
return StaticPrefs::media_theora_enabled();
case DecoderType::Opus:
case DecoderType::Vorbis:
case DecoderType::VPX:
case DecoderType::Wave:
@ -56,7 +57,8 @@ static bool IsAvailableInRdd(DecoderType type) {
case DecoderType::Opus:
return StaticPrefs::media_rdd_opus_enabled();
case DecoderType::Theora:
return StaticPrefs::media_rdd_theora_enabled();
return StaticPrefs::media_rdd_theora_enabled() &&
StaticPrefs::media_theora_enabled();
case DecoderType::Vorbis:
#if defined(__MINGW32__)
// If this is a MinGW build we need to force AgnosticDecoderModule to
@ -129,7 +131,8 @@ media::DecodeSupportSet AgnosticDecoderModule::Supports(
(AOMDecoder::IsAV1(mimeType) && IsAvailable(DecoderType::AV1)) ||
#endif
(VPXDecoder::IsVPX(mimeType) && IsAvailable(DecoderType::VPX)) ||
(TheoraDecoder::IsTheora(mimeType) && IsAvailable(DecoderType::Theora));
(TheoraDecoder::IsTheora(mimeType) && IsAvailable(DecoderType::Theora) &&
StaticPrefs::media_theora_enabled());
MOZ_LOG(sPDMLog, LogLevel::Debug,
("Agnostic decoder %s requested type '%s'",
supports ? "supports" : "rejects", mimeType.BeginReading()));
@ -164,7 +167,8 @@ already_AddRefed<MediaDataDecoder> AgnosticDecoderModule::CreateVideoDecoder(
}
}
#endif
else if (TheoraDecoder::IsTheora(aParams.mConfig.mMimeType)) {
else if (TheoraDecoder::IsTheora(aParams.mConfig.mMimeType) &&
StaticPrefs::media_theora_enabled()) {
m = new TheoraDecoder(aParams);
}

Просмотреть файл

@ -11183,6 +11183,12 @@
mirror: always
#endif
# Bug 1860492 - Deprecate and remove theora
- name: media.theora.enabled
type: RelaxedAtomicBool
value: @IS_NOT_NIGHTLY_BUILD@
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "memory."
#---------------------------------------------------------------------------