Android: Add helper functions for comparing H264 codecs

These helper functions will be useful when making the legacy video
codecs injectable.

Bug: webrtc:7925
Change-Id: Id5a480666f07eccc3116d2c2e61803cc4daf7c9f
Reviewed-on: https://webrtc-review.googlesource.com/88365
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23954}
This commit is contained in:
Magnus Jedvert
2018-07-12 17:05:12 +02:00
committed by Commit Bot
parent 3f84f498e4
commit 1045af2989
5 changed files with 70 additions and 26 deletions

View File

@ -79,15 +79,17 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
MediaCodecUtils.ENCODER_COLOR_FORMATS, info.getCapabilitiesForType(mime));
if (type == VideoCodecType.H264) {
boolean isHighProfile = nativeIsSameH264Profile(input.params,
MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true))
&& isH264HighProfileSupported(info);
boolean isBaselineProfile = nativeIsSameH264Profile(
boolean isHighProfile = H264Utils.isSameH264Profile(
input.params, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true));
boolean isBaselineProfile = H264Utils.isSameH264Profile(
input.params, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ false));
if (!isHighProfile && !isBaselineProfile) {
return null;
}
if (isHighProfile && !isH264HighProfileSupported(info)) {
return null;
}
}
return new HardwareVideoEncoder(codecName, type, surfaceColorFormat, yuvColorFormat,
@ -243,7 +245,4 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
return enableH264HighProfile && Build.VERSION.SDK_INT > Build.VERSION_CODES.M
&& info.getName().startsWith(EXYNOS_PREFIX);
}
private static native boolean nativeIsSameH264Profile(
Map<String, String> params1, Map<String, String> params2);
}