From cca0f6cc688a98b4fe01302b371163fc64a7a983 Mon Sep 17 00:00:00 2001 From: glaznev Date: Wed, 14 Jun 2017 10:20:54 -0700 Subject: [PATCH] Support H.264 high profile decoding on Exynos devices. Tested on Galaxy S5, S6, S7 and S8 BUG=b/34816463 Review-Url: https://codereview.webrtc.org/2942463002 Cr-Commit-Position: refs/heads/master@{#18596} --- .../org/webrtc/MediaCodecVideoDecoder.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/webrtc/sdk/android/api/org/webrtc/MediaCodecVideoDecoder.java b/webrtc/sdk/android/api/org/webrtc/MediaCodecVideoDecoder.java index 4ba6b727df..4304ff421b 100644 --- a/webrtc/sdk/android/api/org/webrtc/MediaCodecVideoDecoder.java +++ b/webrtc/sdk/android/api/org/webrtc/MediaCodecVideoDecoder.java @@ -82,7 +82,8 @@ public class MediaCodecVideoDecoder { private static final String[] supportedH264HwCodecPrefixes = { "OMX.qcom.", "OMX.Intel.", "OMX.Exynos."}; // List of supported HW H.264 high profile decoders. - private static final String[] supportedH264HighProfileHwCodecPrefixes = {"OMX.qcom."}; + private static final String supportedQcomH264HighProfileHwCodecPrefix = "OMX.qcom."; + private static final String supportedExynosH264HighProfileHwCodecPrefix = "OMX.Exynos."; // NV12 color format supported by QCOM codec, but not declared in MediaCodec - // see /hardware/qcom/media/mm-core/inc/OMX_QCOMExtns.h @@ -160,9 +161,22 @@ public class MediaCodecVideoDecoder { } public static boolean isH264HighProfileHwSupported() { - return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP - && !hwDecoderDisabledTypes.contains(H264_MIME_TYPE) - && (findDecoder(H264_MIME_TYPE, supportedH264HighProfileHwCodecPrefixes) != null); + if (hwDecoderDisabledTypes.contains(H264_MIME_TYPE)) { + return false; + } + // Support H.264 HP decoding on QCOM chips for Android L and above. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP + && findDecoder(H264_MIME_TYPE, new String[] {supportedQcomH264HighProfileHwCodecPrefix}) + != null) { + return true; + } + // Support H.264 HP decoding on Exynos chips for Android M and above. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M + && findDecoder(H264_MIME_TYPE, new String[] {supportedExynosH264HighProfileHwCodecPrefix}) + != null) { + return true; + } + return false; } public static void printStackTrace() {