commit 08d019b2ab6fab03df40a1811fec45c6e059b5b1
parent 7a48aeca1ed554ed7a1383352ab3f4151e5994a9
Author: Andrew Osmond <aosmond@gmail.com>
Date: Tue, 23 Dec 2025 23:03:03 +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:
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;
}