Don't check codec's profile for MV-HEVC video.

Currently as there is no formal support for MV-HEVC within Android framework, the profile is not correctly specified by the underlying codec; just assume the profile obtained from the MV-HEVC sample is supported.

PiperOrigin-RevId: 705164738
This commit is contained in:
Googler 2024-12-11 10:56:06 -08:00 committed by Copybara-Service
parent de31a3745c
commit 3936c27b6d
2 changed files with 15 additions and 5 deletions

View File

@ -686,6 +686,9 @@ public final class MimeTypes {
} }
mimeType = Ascii.toLowerCase(mimeType); mimeType = Ascii.toLowerCase(mimeType);
switch (mimeType) { switch (mimeType) {
// Normalize uncommon versions of some video MIME types to their standard equivalent.
case BASE_TYPE_VIDEO + "/x-mvhevc":
return VIDEO_MV_HEVC;
// Normalize uncommon versions of some audio MIME types to their standard equivalent. // Normalize uncommon versions of some audio MIME types to their standard equivalent.
case BASE_TYPE_AUDIO + "/x-flac": case BASE_TYPE_AUDIO + "/x-flac":
return AUDIO_FLAC; return AUDIO_FLAC;

View File

@ -297,12 +297,19 @@ public final class MediaCodecInfo {
private boolean isCodecProfileAndLevelSupported( private boolean isCodecProfileAndLevelSupported(
Format format, boolean checkPerformanceCapabilities) { Format format, boolean checkPerformanceCapabilities) {
Pair<Integer, Integer> codecProfileAndLevel = MediaCodecUtil.getCodecProfileAndLevel(format); Pair<Integer, Integer> codecProfileAndLevel = MediaCodecUtil.getCodecProfileAndLevel(format);
if (format.sampleMimeType != null if (format.sampleMimeType != null && format.sampleMimeType.equals(MimeTypes.VIDEO_MV_HEVC)) {
&& format.sampleMimeType.equals(MimeTypes.VIDEO_MV_HEVC) String normalizedCodecMimeType = MimeTypes.normalizeMimeType(codecMimeType);
&& codecMimeType.equals(MimeTypes.VIDEO_H265)) { if (normalizedCodecMimeType.equals(MimeTypes.VIDEO_MV_HEVC)) {
// Falling back to single-layer HEVC from MV-HEVC. Get base layer profile and level. // Currently as there is no formal support for MV-HEVC within Android framework, the profile
codecProfileAndLevel = MediaCodecUtil.getHevcBaseLayerCodecProfileAndLevel(format); // is not correctly specified by the underlying codec; just assume the profile obtained from
// the MV-HEVC sample is supported.
return true;
} else if (normalizedCodecMimeType.equals(MimeTypes.VIDEO_H265)) {
// Falling back to single-layer HEVC from MV-HEVC. Get base layer profile and level.
codecProfileAndLevel = MediaCodecUtil.getHevcBaseLayerCodecProfileAndLevel(format);
}
} }
if (codecProfileAndLevel == null) { if (codecProfileAndLevel == null) {
// If we don't know any better, we assume that the profile and level are supported. // If we don't know any better, we assume that the profile and level are supported.
return true; return true;