Fix two bugs in the updated code

If we handle the "codecs" in  HlsPlaylistParser.java rather than in  HlsMediaPeriod.java, since the "codecs" property includes both audio and video codec names here, we can't update it directly. Only video part should be updated by Dolby codec string.
This commit is contained in:
ybai001 2024-10-14 17:25:36 +08:00
parent e8d29dc3d6
commit 545d37c104
2 changed files with 15 additions and 3 deletions

View File

@ -1191,7 +1191,7 @@ public final class Format {
}
}
if (MimeTypes.VIDEO_DOLBY_VISION.equals(sampleMimeType)) {
codecs = manifestFormat.codecs;
codecs = Util.getCodecsOfType(manifestFormat.codecs, C.TRACK_TYPE_VIDEO);
}
@Nullable

View File

@ -428,8 +428,20 @@ public final class HlsPlaylistParser implements ParsingLoadable.Parser<HlsPlayli
}
}
}
if (isDolbyVisionFormat(videoRange, codecs, supplementalCodecs, supplementalProfiles)) {
codecs = supplementalCodecs != null ? supplementalCodecs : codecs;
String videoCodecs = Util.getCodecsOfType(codecs, C.TRACK_TYPE_VIDEO);
if (isDolbyVisionFormat(videoRange, videoCodecs, supplementalCodecs, supplementalProfiles)) {
videoCodecs = supplementalCodecs != null ? supplementalCodecs : videoCodecs;
String[] codecArray = Util.splitCodecs(codecs);
StringBuilder builder = new StringBuilder();
for (String codec : codecArray) {
if (builder.length() > 0) {
builder.append(",");
}
builder.append(MimeTypes.getTrackTypeOfCodec(codec) == C.TRACK_TYPE_VIDEO
? videoCodecs
: codec);
}
codecs = builder.length() > 0 ? builder.toString() : codecs;
}
String resolutionString =