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:
committed by
Commit Bot
parent
4d85e8a78c
commit
1e1dd77604
@ -14,7 +14,6 @@
|
||||
#include "media/base/h264_profile_level_id.h"
|
||||
#include "media/base/mediaconstants.h"
|
||||
#include "sdk/android/src/jni/jni_helpers.h"
|
||||
#include "sdk/android/src/jni/videocodecinfo.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace jni {
|
||||
@ -31,23 +30,13 @@ static bool IsSameH264Profile(const cricket::CodecParameterMap& params1,
|
||||
}
|
||||
|
||||
JNI_FUNCTION_DECLARATION(jboolean,
|
||||
DefaultVideoEncoderFactory_isSameCodec,
|
||||
HardwareVideoEncoderFactory_isSameH264Profile,
|
||||
JNIEnv* jni,
|
||||
jclass,
|
||||
jobject info1,
|
||||
jobject info2) {
|
||||
cricket::VideoCodec codec1 =
|
||||
cricket::VideoCodec(VideoCodecInfoToSdpVideoFormat(jni, info1));
|
||||
cricket::VideoCodec codec2 =
|
||||
cricket::VideoCodec(VideoCodecInfoToSdpVideoFormat(jni, info2));
|
||||
|
||||
if (!cricket::CodecNamesEq(codec1.name, codec2.name))
|
||||
return false;
|
||||
if (cricket::CodecNamesEq(codec1.name.c_str(), cricket::kH264CodecName) &&
|
||||
!IsSameH264Profile(codec1.params, codec2.params)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
jobject params1,
|
||||
jobject params2) {
|
||||
return IsSameH264Profile(JavaToStdMapStrings(jni, params1),
|
||||
JavaToStdMapStrings(jni, params2));
|
||||
}
|
||||
|
||||
} // namespace jni
|
||||
Reference in New Issue
Block a user