Add MediaTek H264 and VP8 HW Codec Support with field trial

Bug: webrtc:8761
Change-Id: I06cdff086b624afaf3533ced3e5e4eaf3a862720
Reviewed-on: https://webrtc-review.googlesource.com/39980
Commit-Queue: Alex Leung <alexleung@google.com>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Alex Glaznev <glaznev@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21699}
This commit is contained in:
Alex Leung
2018-01-18 10:01:14 -08:00
committed by Commit Bot
parent 0a6a2b73a1
commit 5b6891afdd
2 changed files with 52 additions and 14 deletions

View File

@ -176,8 +176,17 @@ public class MediaCodecVideoEncoder {
"OMX.qcom.", Build.VERSION_CODES.KITKAT, BitrateAdjustmentType.NO_ADJUSTMENT);
private static final MediaCodecProperties exynosH264HwProperties = new MediaCodecProperties(
"OMX.Exynos.", Build.VERSION_CODES.LOLLIPOP, BitrateAdjustmentType.FRAMERATE_ADJUSTMENT);
private static final MediaCodecProperties[] h264HwList =
new MediaCodecProperties[] {qcomH264HwProperties, exynosH264HwProperties};
private static final MediaCodecProperties mediatekH264HwProperties = new MediaCodecProperties(
"OMX.MTK.", Build.VERSION_CODES.O, BitrateAdjustmentType.FRAMERATE_ADJUSTMENT);
private static final MediaCodecProperties[] h264HwList() {
final ArrayList<MediaCodecProperties> supported_codecs = new ArrayList<MediaCodecProperties>();
supported_codecs.add(qcomH264HwProperties);
supported_codecs.add(exynosH264HwProperties);
if (PeerConnectionFactory.fieldTrialsFindFullName("WebRTC-MediaTekH264").equals("Enabled")) {
supported_codecs.add(mediatekH264HwProperties);
}
return supported_codecs.toArray(new MediaCodecProperties[supported_codecs.size()]);
}
// List of supported HW H.264 high profile encoders.
private static final MediaCodecProperties exynosH264HighProfileHwProperties =
@ -277,7 +286,7 @@ public class MediaCodecVideoEncoder {
@CalledByNative
public static boolean isH264HwSupported() {
return !hwEncoderDisabledTypes.contains(H264_MIME_TYPE)
&& (findHwEncoder(H264_MIME_TYPE, h264HwList, supportedColorList) != null);
&& (findHwEncoder(H264_MIME_TYPE, h264HwList(), supportedColorList) != null);
}
public static boolean isH264HighProfileHwSupported() {
@ -297,7 +306,7 @@ public class MediaCodecVideoEncoder {
public static boolean isH264HwSupportedUsingTextures() {
return !hwEncoderDisabledTypes.contains(H264_MIME_TYPE)
&& (findHwEncoder(H264_MIME_TYPE, h264HwList, supportedSurfaceColorList) != null);
&& (findHwEncoder(H264_MIME_TYPE, h264HwList(), supportedSurfaceColorList) != null);
}
// Helper struct for findHwEncoder() below.
@ -464,8 +473,8 @@ public class MediaCodecVideoEncoder {
keyFrameIntervalSec = 100;
} else if (type == VideoCodecType.VIDEO_CODEC_H264) {
mime = H264_MIME_TYPE;
properties = findHwEncoder(
H264_MIME_TYPE, h264HwList, useSurface ? supportedSurfaceColorList : supportedColorList);
properties = findHwEncoder(H264_MIME_TYPE, h264HwList(),
useSurface ? supportedSurfaceColorList : supportedColorList);
if (profile == H264Profile.CONSTRAINED_HIGH.getValue()) {
EncoderProperties h264HighProfileProperties = findHwEncoder(H264_MIME_TYPE,
h264HighProfileHwList, useSurface ? supportedSurfaceColorList : supportedColorList);