| Index: media/formats/mp4/box_definitions.cc
|
| diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc
|
| index 558367e763a1d60e39e03b07e8c48b1ae5881387..bf2e1d827cb755ec9799fd7684b5e9d161f1c35b 100644
|
| --- a/media/formats/mp4/box_definitions.cc
|
| +++ b/media/formats/mp4/box_definitions.cc
|
| @@ -20,6 +20,10 @@
|
| #include "media/formats/mp4/rcheck.h"
|
| #include "media/media_features.h"
|
|
|
| +#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| +#include "media/formats/mp4/dolby_vision.h"
|
| +#endif
|
| +
|
| #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
|
| #include "media/formats/mp4/hevc.h"
|
| #endif
|
| @@ -701,8 +705,10 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
|
| reader->Read2(&height) &&
|
| reader->SkipBytes(50));
|
|
|
| - RCHECK(reader->ScanChildren() &&
|
| - reader->MaybeReadChild(&pixel_aspect));
|
| + RCHECK(reader->ScanChildren());
|
| + if (reader->HasChild(&pixel_aspect)) {
|
| + RCHECK(reader->MaybeReadChild(&pixel_aspect));
|
| + }
|
|
|
| if (format == FOURCC_ENCV) {
|
| // Continue scanning until a recognized protection scheme is found, or until
|
| @@ -727,6 +733,17 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
|
| avcConfig->profile_indication);
|
| frame_bitstream_converter =
|
| make_scoped_refptr(new AVCBitstreamConverter(std::move(avcConfig)));
|
| +#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| + // It can be Dolby Vision stream if there is DVCC box.
|
| + DolbyVisionConfiguration dvccConfig;
|
| + if (reader->HasChild(&dvccConfig) && reader->ReadChild(&dvccConfig)) {
|
| + DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC)";
|
| + static_cast<AVCBitstreamConverter*>(frame_bitstream_converter.get())
|
| + ->DisablePostAnnexbValidation();
|
| + video_codec = kCodecDolbyVision;
|
| + video_codec_profile = dvccConfig.codec_profile;
|
| + }
|
| +#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| break;
|
| }
|
| #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
|
| @@ -740,9 +757,52 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
|
| video_codec_profile = hevcConfig->GetVideoProfile();
|
| frame_bitstream_converter =
|
| make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig)));
|
| +#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| + // It can be Dolby Vision stream if there is DVCC box.
|
| + DolbyVisionConfiguration dvccConfig;
|
| + if (reader->HasChild(&dvccConfig) && reader->ReadChild(&dvccConfig)) {
|
| + DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC)";
|
| + video_codec = kCodecDolbyVision;
|
| + video_codec_profile = dvccConfig.codec_profile;
|
| + }
|
| +#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| break;
|
| }
|
| -#endif
|
| +#endif // BUILDFLAG(ENABLE_HEVC_DEMUXING)
|
| +#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| + case FOURCC_DVA1:
|
| + case FOURCC_DVAV: {
|
| + DVLOG(2) << __func__ << " reading AVCDecoderConfigurationRecord (avcC)";
|
| + std::unique_ptr<AVCDecoderConfigurationRecord> avcConfig(
|
| + new AVCDecoderConfigurationRecord());
|
| + RCHECK(reader->ReadChild(avcConfig.get()));
|
| + frame_bitstream_converter =
|
| + make_scoped_refptr(new AVCBitstreamConverter(std::move(avcConfig)));
|
| + DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC)";
|
| + DolbyVisionConfiguration dvccConfig;
|
| + RCHECK(reader->ReadChild(&dvccConfig));
|
| + video_codec = kCodecDolbyVision;
|
| + video_codec_profile = dvccConfig.codec_profile;
|
| + break;
|
| + }
|
| +#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
|
| + case FOURCC_DVH1:
|
| + case FOURCC_DVHE: {
|
| + DVLOG(2) << __func__ << " reading HEVCDecoderConfigurationRecord (hvcC)";
|
| + std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig(
|
| + new HEVCDecoderConfigurationRecord());
|
| + RCHECK(reader->ReadChild(hevcConfig.get()));
|
| + frame_bitstream_converter =
|
| + make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig)));
|
| + DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC)";
|
| + DolbyVisionConfiguration dvccConfig;
|
| + RCHECK(reader->ReadChild(&dvccConfig));
|
| + video_codec = kCodecDolbyVision;
|
| + video_codec_profile = dvccConfig.codec_profile;
|
| + break;
|
| + }
|
| +#endif // BUILDFLAG(ENABLE_HEVC_DEMUXING)
|
| +#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| case FOURCC_VP09:
|
| if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| switches::kEnableVp9InMp4)) {
|
| @@ -778,7 +838,15 @@ bool VideoSampleEntry::IsFormatValid() const {
|
| #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
|
| case FOURCC_HEV1:
|
| case FOURCC_HVC1:
|
| -#endif
|
| +#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| + case FOURCC_DVH1:
|
| + case FOURCC_DVHE:
|
| +#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| +#endif // BUILDFLAG(ENABLE_HEVC_DEMUXING)
|
| +#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| + case FOURCC_DVA1:
|
| + case FOURCC_DVAV:
|
| +#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING)
|
| return true;
|
| case FOURCC_VP09:
|
| return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
|
|