void AddMediaFormatChecker(const TrackInfo& aTrackConfig) { if (aTrackConfig.IsVideo()) { auto mimeType = aTrackConfig.GetAsVideoInfo()->mMimeType; RefPtr<MediaByteBuffer> extraData = aTrackConfig.GetAsVideoInfo()->mExtraData; AddToCheckList([mimeType, extraData]() { if (MP4Decoder::IsH264(mimeType)) { mp4_demuxer::SPSData spsdata; // WMF H.264 Video Decoder and Apple ATDecoder // do not support YUV444 format. // For consistency, all decoders should be checked. if (mp4_demuxer::H264::DecodeSPSFromExtraData(extraData, spsdata) && (spsdata.profile_idc == 244 /* Hi444PP */ || spsdata.chroma_format_idc == PDMFactory::kYUV444)) { return CheckResult( SupportChecker::Reason::kVideoFormatNotSupported, MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, RESULT_DETAIL("Decoder may not have the capability " "to handle the requested video format " "with YUV444 chroma subsampling."))); } } return CheckResult(SupportChecker::Reason::kSupported); }); } }
void AddMediaFormatChecker(const TrackInfo& aTrackConfig) { if (aTrackConfig.IsVideo()) { auto mimeType = aTrackConfig.GetAsVideoInfo()->mMimeType; RefPtr<MediaByteBuffer> extraData = aTrackConfig.GetAsVideoInfo()->mExtraData; AddToCheckList( [mimeType, extraData]() { if (MP4Decoder::IsH264(mimeType)) { mp4_demuxer::SPSData spsdata; // WMF H.264 Video Decoder and Apple ATDecoder // do not support YUV444 format. // For consistency, all decoders should be checked. if (mp4_demuxer::H264::DecodeSPSFromExtraData(extraData, spsdata) && spsdata.chroma_format_idc == PDMFactory::kYUV444) { return SupportChecker::Result::kVideoFormatNotSupported; } } return SupportChecker::Result::kSupported; }); } }