Index: webrtc/media/base/codec.cc |
diff --git a/webrtc/media/base/codec.cc b/webrtc/media/base/codec.cc |
index 1e06e8e595ca83d29f3281e1160f39e086a31be2..7087a8a886f9afe23dd94b784a9f5ee9295cb151 100644 |
--- a/webrtc/media/base/codec.cc |
+++ b/webrtc/media/base/codec.cc |
@@ -212,6 +212,9 @@ std::string VideoCodec::ToString() const { |
VideoCodec::VideoCodec(int id, const std::string& name) |
: Codec(id, name, kVideoCodecClockrate) {} |
+VideoCodec::VideoCodec(const std::string& name) |
+ : VideoCodec(0 /* id */, name) {} |
+ |
VideoCodec::VideoCodec() : Codec() { |
clockrate = kVideoCodecClockrate; |
} |
@@ -304,7 +307,22 @@ bool HasTransportCc(const Codec& codec) { |
} |
bool CodecNamesEq(const std::string& name1, const std::string& name2) { |
- return _stricmp(name1.c_str(), name2.c_str()) == 0; |
+ return CodecNamesEq(name1.c_str(), name2.c_str()); |
+} |
+ |
+bool CodecNamesEq(const char* name1, const char* name2) { |
+ return _stricmp(name1, name2) == 0; |
+} |
+ |
+webrtc::VideoCodecType CodecTypeFromName(const std::string& name) { |
+ if (CodecNamesEq(name.c_str(), kVp8CodecName)) { |
+ return webrtc::kVideoCodecVP8; |
+ } else if (CodecNamesEq(name.c_str(), kVp9CodecName)) { |
+ return webrtc::kVideoCodecVP9; |
+ } else if (CodecNamesEq(name.c_str(), kH264CodecName)) { |
+ return webrtc::kVideoCodecH264; |
+ } |
+ return webrtc::kVideoCodecUnknown; |
} |
} // namespace cricket |