Skip to content

Commit a84c369

Browse files
committed
Bugfix: Dolby Vision Profile 10.0 playback artifacts issue
* This issue was triggered because androidx#2830 was not merged correctly. * The issue arises when all three of the following conditions are * met simultaneously: * 1. The content is Dolby Vision Profile 10.0 * 2. A resolution switch occurs during playback due to network * bandwidth changes (e.g., 1080p → 720p) * 3. The device’s AV1 decoder fails to properly handle AV1 * Codec-Specific Data (CSD)
1 parent 779907a commit a84c369

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ protected DecoderReuseEvaluation onInputFormatChanged(FormatHolder formatHolder)
18131813
|| Objects.equals(newFormat.sampleMimeType, MimeTypes.VIDEO_VP9)
18141814
|| (Objects.equals(newFormat.sampleMimeType, MimeTypes.VIDEO_DOLBY_VISION)
18151815
&& Objects.equals(
1816-
MediaCodecUtil.getAlternativeCodecMimeType(newFormat), MimeTypes.VIDEO_AV1)))
1816+
MediaCodecUtil.getDolbyVisionBlMimeType(newFormat), MimeTypes.VIDEO_AV1)))
18171817
&& !newFormat.initializationData.isEmpty()) {
18181818
newFormat = newFormat.buildUpon().setInitializationData(null).build();
18191819
}

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,34 @@ public static MediaCodecProfileAndLevel getHevcBaseLayerCodecProfileAndLevel(For
365365
return getHevcProfileAndLevel(codecs, parts, format.colorInfo);
366366
}
367367

368+
/**
369+
* Returns a Dolby Vision base layer codec MIME type of the provided {@link Format}.
370+
*
371+
* @param format The media format.
372+
* @return A Dolby Vision base layer MIME type, or null if a Dolby Vision profile is not
373+
* identified.
374+
*/
375+
@Nullable
376+
public static String getDolbyVisionBlMimeType(Format format) {
377+
378+
if (MimeTypes.VIDEO_DOLBY_VISION.equals(format.sampleMimeType)) {
379+
@Nullable Pair<Integer, Integer> codecProfileAndLevel = getCodecProfileAndLevel(format);
380+
if (codecProfileAndLevel != null) {
381+
int profile = codecProfileAndLevel.first;
382+
if (profile == CodecProfileLevel.DolbyVisionProfileDvheDtr // profile 4
383+
|| profile == CodecProfileLevel.DolbyVisionProfileDvheStn // profile 5
384+
|| profile == CodecProfileLevel.DolbyVisionProfileDvheSt) { // profile 8
385+
return MimeTypes.VIDEO_H265;
386+
} else if (profile == CodecProfileLevel.DolbyVisionProfileDvavSe) { // profile 9
387+
return MimeTypes.VIDEO_H264;
388+
} else if (profile == CodecProfileLevel.DolbyVisionProfileDvav110) { // profile 10
389+
return MimeTypes.VIDEO_AV1;
390+
}
391+
}
392+
}
393+
return null;
394+
}
395+
368396
/**
369397
* Returns an alternative codec MIME type (besides the default {@link Format#sampleMimeType}) that
370398
* can be used to decode samples of the provided {@link Format}.

0 commit comments

Comments
 (0)