Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: webrtc/media/base/codec.cc

Issue 2449993003: Replace WebRtcVideoEncoderFactory::VideoCodec with cricket::VideoCodec (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698