Implement equals() and hashCode() for VideoCodecInfo.

To be able to compare VideoCodecInfos in a nice way in Java and still
use the correct criteria for comparing H264 codec infos.

A similar thing was done for Obj-C here:
https://webrtc-review.googlesource.com/c/src/+/4383

Bug: webrtc:7925
Change-Id: I43f532d4efa557fc8fe25a82eebc35072b91e6db
Reviewed-on: https://webrtc-review.googlesource.com/23240
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20716}
This commit is contained in:
Anders Carlsson
2017-11-16 15:44:14 +01:00
committed by Commit Bot
parent 4d85e8a78c
commit 1e1dd77604
5 changed files with 47 additions and 42 deletions

View File

@ -93,6 +93,16 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
Integer yuvColorFormat = MediaCodecUtils.selectColorFormat(
MediaCodecUtils.ENCODER_COLOR_FORMATS, info.getCapabilitiesForType(mime));
if (type == VideoCodecType.H264) {
boolean isHighProfile = isSameH264Profile(input.params, getCodecProperties(type, true))
&& isH264HighProfileSupported(info);
boolean isBaselineProfile = isSameH264Profile(input.params, getCodecProperties(type, false));
if (!isHighProfile && !isBaselineProfile) {
return null;
}
}
return new HardwareVideoEncoder(codecName, type, surfaceColorFormat, yuvColorFormat,
input.params, getKeyFrameIntervalSec(type), getForcedKeyFrameIntervalMs(type, codecName),
createBitrateAdjuster(type, codecName), sharedContext);
@ -269,4 +279,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
throw new IllegalArgumentException("Unsupported codec: " + type);
}
}
private static native boolean isSameH264Profile(
Map<String, String> params1, Map<String, String> params2);
}