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

Side by Side Diff: webrtc/media/base/codec.cc

Issue 2509273002: Unify VideoCodecType to/from string functionality (Closed)
Patch Set: Rebase and update unknown string in WebRtcVideoEncoderFactory Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « webrtc/media/base/codec.h ('k') | webrtc/media/engine/internalencoderfactory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 317 }
318 318
319 bool CodecNamesEq(const std::string& name1, const std::string& name2) { 319 bool CodecNamesEq(const std::string& name1, const std::string& name2) {
320 return CodecNamesEq(name1.c_str(), name2.c_str()); 320 return CodecNamesEq(name1.c_str(), name2.c_str());
321 } 321 }
322 322
323 bool CodecNamesEq(const char* name1, const char* name2) { 323 bool CodecNamesEq(const char* name1, const char* name2) {
324 return _stricmp(name1, name2) == 0; 324 return _stricmp(name1, name2) == 0;
325 } 325 }
326 326
327 webrtc::VideoCodecType CodecTypeFromName(const std::string& name) {
328 if (CodecNamesEq(name.c_str(), kVp8CodecName)) {
329 return webrtc::kVideoCodecVP8;
330 } else if (CodecNamesEq(name.c_str(), kVp9CodecName)) {
331 return webrtc::kVideoCodecVP9;
332 } else if (CodecNamesEq(name.c_str(), kH264CodecName)) {
333 return webrtc::kVideoCodecH264;
334 }
335 return webrtc::kVideoCodecUnknown;
336 }
337
338 const VideoCodec* FindMatchingCodec( 327 const VideoCodec* FindMatchingCodec(
339 const std::vector<VideoCodec>& supported_codecs, 328 const std::vector<VideoCodec>& supported_codecs,
340 const VideoCodec& codec) { 329 const VideoCodec& codec) {
341 for (const VideoCodec& supported_codec : supported_codecs) { 330 for (const VideoCodec& supported_codec : supported_codecs) {
342 if (!CodecNamesEq(codec.name, supported_codec.name)) 331 if (!CodecNamesEq(codec.name, supported_codec.name))
343 continue; 332 continue;
344 if (CodecNamesEq(codec.name.c_str(), kH264CodecName) && 333 if (CodecNamesEq(codec.name.c_str(), kH264CodecName) &&
345 !IsSameH264Profile(codec.params, supported_codec.params)) { 334 !IsSameH264Profile(codec.params, supported_codec.params)) {
346 continue; 335 continue;
347 } 336 }
348 return &supported_codec; 337 return &supported_codec;
349 } 338 }
350 return nullptr; 339 return nullptr;
351 } 340 }
352 341
353 } // namespace cricket 342 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/codec.h ('k') | webrtc/media/engine/internalencoderfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698