tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit cc59d41bd7cc4bf5b9bfa358dd6bad6a5027029b
parent ae45ac5a963f8b0397243ca0f9f314302ec4dcb7
Author: Andrew Osmond <aosmond@gmail.com>
Date:   Wed, 24 Dec 2025 03:56:26 +0000

Bug 2005011 - Part 2. Move AV1 main profile check from AndroidDecoderModule to AOMDecoder. r=media-playback-reviewers,padenot

This will allow it to be reused with FFmpegDecoderModule.

Differential Revision: https://phabricator.services.mozilla.com/D275720

Diffstat:
Mdom/media/platforms/agnostic/AOMDecoder.cpp | 11+++++++++++
Mdom/media/platforms/agnostic/AOMDecoder.h | 3+++
Mdom/media/platforms/android/AndroidDecoderModule.cpp | 12+-----------
3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/dom/media/platforms/agnostic/AOMDecoder.cpp b/dom/media/platforms/agnostic/AOMDecoder.cpp @@ -317,6 +317,17 @@ bool AOMDecoder::IsAV1(const nsACString& aMimeType) { } /* static */ +bool AOMDecoder::IsMainProfile(const MediaByteBuffer* aBox) { + if (!aBox || aBox->IsEmpty()) { + return false; + } + AV1SequenceInfo av1Info; + MediaResult seqHdrResult; + TryReadAV1CBox(aBox, av1Info, seqHdrResult); + return seqHdrResult.Code() == NS_OK && av1Info.mProfile == 0; +} + +/* static */ bool AOMDecoder::IsKeyframe(Span<const uint8_t> aBuffer) { aom_codec_stream_info_t info; PodZero(&info); diff --git a/dom/media/platforms/agnostic/AOMDecoder.h b/dom/media/platforms/agnostic/AOMDecoder.h @@ -39,6 +39,9 @@ class AOMDecoder final : public MediaDataDecoder, // by our demuxers to identify AV1 streams. static bool IsAV1(const nsACString& aMimeType); + // Return true if uses AV1 main profile. + static bool IsMainProfile(const MediaByteBuffer* aBox); + // Return true if a sample is a keyframe. static bool IsKeyframe(Span<const uint8_t> aBuffer); diff --git a/dom/media/platforms/android/AndroidDecoderModule.cpp b/dom/media/platforms/android/AndroidDecoderModule.cpp @@ -316,16 +316,6 @@ media::DecodeSupportSet AndroidDecoderModule::Supports( : media::DecodeSupportSet{}; } -static bool IsAV1MainProfile(const MediaByteBuffer* aBox) { - if (!aBox || aBox->IsEmpty()) { - return false; - } - AOMDecoder::AV1SequenceInfo av1Info; - MediaResult seqHdrResult; - AOMDecoder::TryReadAV1CBox(aBox, av1Info, seqHdrResult); - return seqHdrResult.Code() == NS_OK && av1Info.mProfile == 0; -} - already_AddRefed<MediaDataDecoder> AndroidDecoderModule::CreateVideoDecoder( const CreateDecoderParams& aParams) { // Temporary - forces use of VPXDecoder when alpha is present. @@ -337,7 +327,7 @@ already_AddRefed<MediaDataDecoder> AndroidDecoderModule::CreateVideoDecoder( } if (AOMDecoder::IsAV1(aParams.mConfig.mMimeType) && - !IsAV1MainProfile(aParams.VideoConfig().mExtraData)) { + !AOMDecoder::IsMainProfile(aParams.VideoConfig().mExtraData)) { return nullptr; }