OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 std::string VideoCodec::ToString() const { | 206 std::string VideoCodec::ToString() const { |
207 std::ostringstream os; | 207 std::ostringstream os; |
208 os << "VideoCodec[" << id << ":" << name << "]"; | 208 os << "VideoCodec[" << id << ":" << name << "]"; |
209 return os.str(); | 209 return os.str(); |
210 } | 210 } |
211 | 211 |
212 VideoCodec::VideoCodec(int id, const std::string& name) | 212 VideoCodec::VideoCodec(int id, const std::string& name) |
213 : Codec(id, name, kVideoCodecClockrate) {} | 213 : Codec(id, name, kVideoCodecClockrate) {} |
214 | 214 |
| 215 VideoCodec::VideoCodec(const std::string& name) |
| 216 : VideoCodec(0 /* id */, name) {} |
| 217 |
215 VideoCodec::VideoCodec() : Codec() { | 218 VideoCodec::VideoCodec() : Codec() { |
216 clockrate = kVideoCodecClockrate; | 219 clockrate = kVideoCodecClockrate; |
217 } | 220 } |
218 | 221 |
219 VideoCodec::VideoCodec(const VideoCodec& c) = default; | 222 VideoCodec::VideoCodec(const VideoCodec& c) = default; |
220 | 223 |
221 VideoCodec& VideoCodec::operator=(const VideoCodec& c) { | 224 VideoCodec& VideoCodec::operator=(const VideoCodec& c) { |
222 Codec::operator=(c); | 225 Codec::operator=(c); |
223 return *this; | 226 return *this; |
224 } | 227 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 return codec.HasFeedbackParam( | 300 return codec.HasFeedbackParam( |
298 FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); | 301 FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); |
299 } | 302 } |
300 | 303 |
301 bool HasTransportCc(const Codec& codec) { | 304 bool HasTransportCc(const Codec& codec) { |
302 return codec.HasFeedbackParam( | 305 return codec.HasFeedbackParam( |
303 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); | 306 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); |
304 } | 307 } |
305 | 308 |
306 bool CodecNamesEq(const std::string& name1, const std::string& name2) { | 309 bool CodecNamesEq(const std::string& name1, const std::string& name2) { |
307 return _stricmp(name1.c_str(), name2.c_str()) == 0; | 310 return CodecNamesEq(name1.c_str(), name2.c_str()); |
| 311 } |
| 312 |
| 313 bool CodecNamesEq(const char* name1, const char* name2) { |
| 314 return _stricmp(name1, name2) == 0; |
| 315 } |
| 316 |
| 317 webrtc::VideoCodecType CodecTypeFromName(const std::string& name) { |
| 318 if (CodecNamesEq(name.c_str(), kVp8CodecName)) { |
| 319 return webrtc::kVideoCodecVP8; |
| 320 } else if (CodecNamesEq(name.c_str(), kVp9CodecName)) { |
| 321 return webrtc::kVideoCodecVP9; |
| 322 } else if (CodecNamesEq(name.c_str(), kH264CodecName)) { |
| 323 return webrtc::kVideoCodecH264; |
| 324 } |
| 325 return webrtc::kVideoCodecUnknown; |
| 326 } |
| 327 |
| 328 bool IsCodecSupported(const std::vector<VideoCodec>& supported_codecs, |
| 329 const VideoCodec& codec) { |
| 330 return std::any_of(supported_codecs.begin(), supported_codecs.end(), |
| 331 [&codec](const VideoCodec& supported_codec) -> bool { |
| 332 return CodecNamesEq(codec.name, supported_codec.name); |
| 333 }); |
308 } | 334 } |
309 | 335 |
310 } // namespace cricket | 336 } // namespace cricket |
OLD | NEW |