mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 18:17:29 +09:00
Fix canPlayType/isTypeSupported for AV1 content
This commit is contained in:
parent
6676331d30
commit
cbacc81f82
6 changed files with 35 additions and 33 deletions
|
|
@ -458,6 +458,14 @@ IsVP9CodecString(const nsAString& aCodec)
|
||||||
aCodec.EqualsLiteral("vp9.0");
|
aCodec.EqualsLiteral("vp9.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_AV1
|
||||||
|
bool
|
||||||
|
IsAV1CodecString(const nsAString& aCodec)
|
||||||
|
{
|
||||||
|
return aCodec.EqualsLiteral("av1");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <int N>
|
template <int N>
|
||||||
static bool
|
static bool
|
||||||
StartsWith(const nsACString& string, const char (&prefix)[N])
|
StartsWith(const nsACString& string, const char (&prefix)[N])
|
||||||
|
|
|
||||||
|
|
@ -345,6 +345,11 @@ IsVP8CodecString(const nsAString& aCodec);
|
||||||
bool
|
bool
|
||||||
IsVP9CodecString(const nsAString& aCodec);
|
IsVP9CodecString(const nsAString& aCodec);
|
||||||
|
|
||||||
|
#ifdef MOZ_AV1
|
||||||
|
bool
|
||||||
|
IsAV1CodecString(const nsAString& aCodec);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Try and create a TrackInfo with a given codec MIME type.
|
// Try and create a TrackInfo with a given codec MIME type.
|
||||||
UniquePtr<TrackInfo>
|
UniquePtr<TrackInfo>
|
||||||
CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType);
|
CreateTrackInfoWithMIMEType(const nsACString& aCodecMIMEType);
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ RefPtr<MediaDataDecoder::InitPromise>
|
||||||
AOMDecoder::Init()
|
AOMDecoder::Init()
|
||||||
{
|
{
|
||||||
int decode_threads = 2;
|
int decode_threads = 2;
|
||||||
|
|
||||||
aom_codec_iface_t* dx = aom_codec_av1_dx();
|
aom_codec_iface_t* dx = aom_codec_av1_dx();
|
||||||
if (mInfo.mDisplay.width >= 2048) {
|
if (mInfo.mDisplay.width >= 2048) {
|
||||||
decode_threads = 8;
|
decode_threads = 8;
|
||||||
|
|
@ -231,23 +232,22 @@ AOMDecoder::DoDecode(MediaRawData* aSample)
|
||||||
RESULT_DETAIL("AOM Unknown image format"));
|
RESULT_DETAIL("AOM Unknown image format"));
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<VideoData> v;
|
RefPtr<VideoData> v =
|
||||||
v = VideoData::CreateAndCopyData(mInfo,
|
VideoData::CreateAndCopyData(mInfo,
|
||||||
mImageContainer,
|
mImageContainer,
|
||||||
aSample->mOffset,
|
aSample->mOffset,
|
||||||
aSample->mTime,
|
aSample->mTime,
|
||||||
aSample->mDuration,
|
aSample->mDuration,
|
||||||
b,
|
b,
|
||||||
aSample->mKeyframe,
|
aSample->mKeyframe,
|
||||||
aSample->mTimecode,
|
aSample->mTimecode,
|
||||||
mInfo.ScaledImageRect(img->d_w,
|
mInfo.ScaledImageRect(img->d_w,
|
||||||
img->d_h));
|
img->d_h));
|
||||||
|
|
||||||
if (!v) {
|
if (!v) {
|
||||||
LOG(
|
LOG("Image allocation error source %ux%u display %ux%u picture %ux%u",
|
||||||
"Image allocation error source %ux%u display %ux%u picture %ux%u",
|
img->d_w, img->d_h, mInfo.mDisplay.width, mInfo.mDisplay.height,
|
||||||
img->d_w, img->d_h, mInfo.mDisplay.width, mInfo.mDisplay.height,
|
mInfo.mImage.width, mInfo.mImage.height);
|
||||||
mInfo.mImage.width, mInfo.mImage.height);
|
|
||||||
return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__);
|
return MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__);
|
||||||
}
|
}
|
||||||
mCallback->Output(v);
|
mCallback->Output(v);
|
||||||
|
|
@ -296,15 +296,8 @@ AOMDecoder::Drain()
|
||||||
bool
|
bool
|
||||||
AOMDecoder::IsAV1(const nsACString& aMimeType)
|
AOMDecoder::IsAV1(const nsACString& aMimeType)
|
||||||
{
|
{
|
||||||
return aMimeType.EqualsLiteral("video/webm; codecs=av1")
|
return aMimeType.EqualsLiteral("video/webm; codecs=av1") ||
|
||||||
|| aMimeType.EqualsLiteral("video/av1");
|
aMimeType.EqualsLiteral("video/av1");
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
bool
|
|
||||||
AOMDecoder::IsSupportedCodec(const nsAString& aCodecType)
|
|
||||||
{
|
|
||||||
return aCodecType.EqualsLiteral("av1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,6 @@ public:
|
||||||
// by our demuxers to identify AV1 streams.
|
// by our demuxers to identify AV1 streams.
|
||||||
static bool IsAV1(const nsACString& aMimeType);
|
static bool IsAV1(const nsACString& aMimeType);
|
||||||
|
|
||||||
// Return true if aCodecType is a supported codec description.
|
|
||||||
static bool IsSupportedCodec(const nsAString& aCodecType);
|
|
||||||
|
|
||||||
// Return true if a sample is a keyframe.
|
// Return true if a sample is a keyframe.
|
||||||
static bool IsKeyframe(Span<const uint8_t> aBuffer);
|
static bool IsKeyframe(Span<const uint8_t> aBuffer);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,15 @@ AgnosticDecoderModule::SupportsMimeType(const nsACString& aMimeType,
|
||||||
{
|
{
|
||||||
bool supports =
|
bool supports =
|
||||||
VPXDecoder::IsVPX(aMimeType) ||
|
VPXDecoder::IsVPX(aMimeType) ||
|
||||||
|
OpusDataDecoder::IsOpus(aMimeType) ||
|
||||||
|
VorbisDataDecoder::IsVorbis(aMimeType) ||
|
||||||
|
WaveDataDecoder::IsWave(aMimeType) ||
|
||||||
|
TheoraDecoder::IsTheora(aMimeType);
|
||||||
#ifdef MOZ_AV1
|
#ifdef MOZ_AV1
|
||||||
if (MediaPrefs::AV1Enabled()) {
|
if (MediaPrefs::AV1Enabled()) {
|
||||||
supports |= AOMDecoder::IsAV1(aMimeType);
|
supports |= AOMDecoder::IsAV1(aMimeType);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
OpusDataDecoder::IsOpus(aMimeType) ||
|
|
||||||
VorbisDataDecoder::IsVorbis(aMimeType) ||
|
|
||||||
WaveDataDecoder::IsWave(aMimeType) ||
|
|
||||||
TheoraDecoder::IsTheora(aMimeType);
|
|
||||||
MOZ_LOG(sPDMLog, LogLevel::Debug, ("Agnostic decoder %s requested type",
|
MOZ_LOG(sPDMLog, LogLevel::Debug, ("Agnostic decoder %s requested type",
|
||||||
supports ? "supports" : "rejects"));
|
supports ? "supports" : "rejects"));
|
||||||
return supports;
|
return supports;
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,7 @@ WebMDecoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef MOZ_AV1
|
#ifdef MOZ_AV1
|
||||||
if (isWebMVideo && MediaPrefs::AV1Enabled() &&
|
if (MediaPrefs::AV1Enabled() && IsAV1CodecString(codec)) {
|
||||||
AOMDecoder::IsSupportedCodec(codec)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue