Skip to content

Commit

Permalink
Don't check codec's profile for MV-HEVC video.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Googler authored and copybara-github committed Dec 11, 2024
1 parent de31a37 commit 3936c27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,9 @@ public static String getMimeTypeFromMp4ObjectType(int objectType) {
}
mimeType = Ascii.toLowerCase(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.
case BASE_TYPE_AUDIO + "/x-flac":
return AUDIO_FLAC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,19 @@ private boolean isSampleMimeTypeSupported(Format format) {
private boolean isCodecProfileAndLevelSupported(
Format format, boolean checkPerformanceCapabilities) {
Pair<Integer, Integer> codecProfileAndLevel = MediaCodecUtil.getCodecProfileAndLevel(format);
if (format.sampleMimeType != null
&& format.sampleMimeType.equals(MimeTypes.VIDEO_MV_HEVC)
&& codecMimeType.equals(MimeTypes.VIDEO_H265)) {
// Falling back to single-layer HEVC from MV-HEVC. Get base layer profile and level.
codecProfileAndLevel = MediaCodecUtil.getHevcBaseLayerCodecProfileAndLevel(format);
if (format.sampleMimeType != null && format.sampleMimeType.equals(MimeTypes.VIDEO_MV_HEVC)) {
String normalizedCodecMimeType = MimeTypes.normalizeMimeType(codecMimeType);
if (normalizedCodecMimeType.equals(MimeTypes.VIDEO_MV_HEVC)) {
// 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.
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 we don't know any better, we assume that the profile and level are supported.
return true;
Expand Down

0 comments on commit 3936c27

Please sign in to comment.