diff options
author | trav90 <travawine@palemoon.org> | 2018-10-15 22:11:24 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-15 22:11:24 -0500 |
commit | e69ea0ff2e110886316d1c055f8b8e7677f58693 (patch) | |
tree | 74ff7e872754162c117f4f722b15b67852baa66e /dom/media | |
parent | b7565385f9fc42a55a9279aadefad4127cb41ac1 (diff) | |
download | aura-central-e69ea0ff2e110886316d1c055f8b8e7677f58693.tar.gz |
Recognize AV1 in WebMDemuxer
Call AOMDecoder to handle AV1 video tracks from the WebM container. The new decoder is very similar to VPXDecoder so we can use parallel calls. This codec is still build-time conditional.
Diffstat (limited to 'dom/media')
-rw-r--r-- | dom/media/webm/WebMDemuxer.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp index b54739c06..013da9b2c 100644 --- a/dom/media/webm/WebMDemuxer.cpp +++ b/dom/media/webm/WebMDemuxer.cpp @@ -8,6 +8,9 @@ #include "MediaDecoderStateMachine.h" #include "AbstractMediaDecoder.h" #include "MediaResource.h" +#ifdef MOZ_AV1 +#include "AOMDecoder.h" +#endif #include "OpusDecoder.h" #include "VPXDecoder.h" #include "WebMDemuxer.h" @@ -320,6 +323,9 @@ WebMDemuxer::ReadMetadata() case NESTEGG_CODEC_VP9: mInfo.mVideo.mMimeType = "video/webm; codecs=vp9"; break; + case NESTEGG_CODEC_AV1: + mInfo.mVideo.mMimeType = "video/webm; codecs=av1"; + break; default: NS_WARNING("Unknown WebM video codec"); return NS_ERROR_FAILURE; @@ -651,6 +657,11 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl case NESTEGG_CODEC_VP9: isKeyframe = VPXDecoder::IsKeyframe(sample, VPXDecoder::Codec::VP9); break; +#ifdef MOZ_AV1 + case NESTEGG_CODEC_AV1: + isKeyframe = AOMDecoder::IsKeyframe(sample); + break; +#endif default: NS_WARNING("Cannot detect keyframes in unknown WebM video codec"); return NS_ERROR_FAILURE; @@ -658,10 +669,20 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl if (isKeyframe) { // For both VP8 and VP9, we only look for resolution changes // on keyframes. Other resolution changes are invalid. - auto codec = mVideoCodec == NESTEGG_CODEC_VP8 - ? VPXDecoder::Codec::VP8 - : VPXDecoder::Codec::VP9; - auto dimensions = VPXDecoder::GetFrameSize(sample, codec); + auto dimensions = nsIntSize(0, 0); + switch (mVideoCodec) { + case NESTEGG_CODEC_VP8: + dimensions = VPXDecoder::GetFrameSize(sample, VPXDecoder::Codec::VP8); + break; + case NESTEGG_CODEC_VP9: + dimensions = VPXDecoder::GetFrameSize(sample, VPXDecoder::Codec::VP9); + break; +#ifdef MOZ_AV1 + case NESTEGG_CODEC_AV1: + dimensions = AOMDecoder::GetFrameSize(sample); + break; +#endif + } if (mLastSeenFrameSize.isSome() && (dimensions != mLastSeenFrameSize.value())) { mInfo.mVideo.mDisplay = dimensions; |