Chromium Code Reviews| Index: webrtc/media/base/codec.cc |
| diff --git a/webrtc/media/base/codec.cc b/webrtc/media/base/codec.cc |
| index 66bc9ff7d9d0a44f5129707c2cea06172cfe79f8..de1288fbbe34357e843dde81520571cf68632eb2 100644 |
| --- a/webrtc/media/base/codec.cc |
| +++ b/webrtc/media/base/codec.cc |
| @@ -17,6 +17,7 @@ |
| #include "webrtc/base/logging.h" |
| #include "webrtc/base/stringencode.h" |
| #include "webrtc/base/stringutils.h" |
| +#include "webrtc/common_video/h264/profile_level_id.h" |
| namespace cricket { |
| @@ -218,6 +219,20 @@ bool VideoCodec::operator==(const VideoCodec& c) const { |
| return Codec::operator==(c); |
| } |
| +bool VideoCodec::Matches(const VideoCodec& other) const { |
| + if (!Codec::Matches(other)) |
| + return false; |
| + if (!CodecNamesEq(name.c_str(), kH264CodecName)) |
| + return true; |
| + const rtc::Optional<webrtc::H264::ProfileLevelId> profile_level_id = |
| + webrtc::H264::ParseSdpProfileLevelId(params); |
| + const rtc::Optional<webrtc::H264::ProfileLevelId> other_profile_level_id = |
| + webrtc::H264::ParseSdpProfileLevelId(other.params); |
| + // Compare H264 profiles, but not levels. |
| + return profile_level_id && other_profile_level_id && |
| + profile_level_id->profile == other_profile_level_id->profile; |
|
hta-webrtc
2016/11/08 13:59:53
See comment about matching. This says whether they
magjed_webrtc
2016/11/08 16:18:26
Yes, this function compares whether the codecs are
|
| +} |
| + |
| VideoCodec VideoCodec::CreateRtxCodec(int rtx_payload_type, |
| int associated_payload_type) { |
| VideoCodec rtx_codec(rtx_payload_type, kRtxCodecName); |
| @@ -321,7 +336,7 @@ bool IsCodecSupported(const std::vector<VideoCodec>& supported_codecs, |
| const VideoCodec& codec) { |
| return std::any_of(supported_codecs.begin(), supported_codecs.end(), |
| [&codec](const VideoCodec& supported_codec) -> bool { |
| - return CodecNamesEq(codec.name, supported_codec.name); |
| + return codec.Matches(supported_codec); |
| }); |
| } |