Commit 6665af5b by andrewlewis Committed by Andrew Lewis

Support additional DV profiles that require fallback

PiperOrigin-RevId: 244170391
parent 50c9fe62
......@@ -897,8 +897,7 @@ import java.util.List;
out.nalUnitLengthFieldLength = hevcConfig.nalUnitLengthFieldLength;
} else if (childAtomType == Atom.TYPE_dvcC || childAtomType == Atom.TYPE_dvvC) {
DolbyVisionConfig dolbyVisionConfig = DolbyVisionConfig.parse(parent);
// TODO: Support profiles 4, 8 and 9 once we have a way to fall back to AVC/HEVC decoding.
if (dolbyVisionConfig != null && dolbyVisionConfig.profile == 5) {
if (dolbyVisionConfig != null) {
codecs = dolbyVisionConfig.codecs;
mimeType = MimeTypes.VIDEO_DOLBY_VISION;
}
......
......@@ -369,6 +369,23 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
mediaCodecSelector.getDecoderInfos(
format.sampleMimeType, requiresSecureDecoder, requiresTunnelingDecoder);
decoderInfos = MediaCodecUtil.getDecoderInfosSortedByFormatSupport(decoderInfos, format);
if (MimeTypes.VIDEO_DOLBY_VISION.equals(format.sampleMimeType)) {
// Fallback to primary decoders for H.265/HEVC or H.264/AVC for the relevant DV profiles.
Pair<Integer, Integer> codecProfileAndLevel =
MediaCodecUtil.getCodecProfileAndLevel(format.codecs);
if (codecProfileAndLevel != null) {
int profile = codecProfileAndLevel.first;
if (profile == 4 || profile == 8) {
decoderInfos.addAll(
mediaCodecSelector.getDecoderInfos(
MimeTypes.VIDEO_H265, requiresSecureDecoder, requiresTunnelingDecoder));
} else if (profile == 9) {
decoderInfos.addAll(
mediaCodecSelector.getDecoderInfos(
MimeTypes.VIDEO_H264, requiresSecureDecoder, requiresTunnelingDecoder));
}
}
}
return Collections.unmodifiableList(decoderInfos);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment