mirror of
https://github.com/samsonjs/media.git
synced 2026-04-19 13:35:47 +00:00
Support additional DV profiles that require fallback
PiperOrigin-RevId: 244170391
This commit is contained in:
parent
50c9fe6294
commit
6665af5b7b
2 changed files with 18 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue