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

Side by Side Diff: webrtc/media/engine/internalencoderfactory.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.cc ('k') | webrtc/media/engine/webrtcvideoencoderfactory.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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 25 matching lines...) Expand all
36 36
37 supported_codecs_.push_back(cricket::VideoCodec(kRedCodecName)); 37 supported_codecs_.push_back(cricket::VideoCodec(kRedCodecName));
38 supported_codecs_.push_back(cricket::VideoCodec(kUlpfecCodecName)); 38 supported_codecs_.push_back(cricket::VideoCodec(kUlpfecCodecName));
39 } 39 }
40 40
41 InternalEncoderFactory::~InternalEncoderFactory() {} 41 InternalEncoderFactory::~InternalEncoderFactory() {}
42 42
43 // WebRtcVideoEncoderFactory implementation. 43 // WebRtcVideoEncoderFactory implementation.
44 webrtc::VideoEncoder* InternalEncoderFactory::CreateVideoEncoder( 44 webrtc::VideoEncoder* InternalEncoderFactory::CreateVideoEncoder(
45 const cricket::VideoCodec& codec) { 45 const cricket::VideoCodec& codec) {
46 switch (CodecTypeFromName(codec.name)) { 46 const webrtc::VideoCodecType codec_type =
47 webrtc::PayloadNameToCodecType(codec.name)
48 .value_or(webrtc::kVideoCodecUnknown);
49 switch (codec_type) {
47 case webrtc::kVideoCodecH264: 50 case webrtc::kVideoCodecH264:
48 return webrtc::H264Encoder::Create(); 51 return webrtc::H264Encoder::Create();
49 case webrtc::kVideoCodecVP8: 52 case webrtc::kVideoCodecVP8:
50 return webrtc::VP8Encoder::Create(); 53 return webrtc::VP8Encoder::Create();
51 case webrtc::kVideoCodecVP9: 54 case webrtc::kVideoCodecVP9:
52 return webrtc::VP9Encoder::Create(); 55 return webrtc::VP9Encoder::Create();
53 default: 56 default:
54 return nullptr; 57 return nullptr;
55 } 58 }
56 } 59 }
57 60
58 const std::vector<cricket::VideoCodec>& 61 const std::vector<cricket::VideoCodec>&
59 InternalEncoderFactory::supported_codecs() const { 62 InternalEncoderFactory::supported_codecs() const {
60 return supported_codecs_; 63 return supported_codecs_;
61 } 64 }
62 65
63 void InternalEncoderFactory::DestroyVideoEncoder( 66 void InternalEncoderFactory::DestroyVideoEncoder(
64 webrtc::VideoEncoder* encoder) { 67 webrtc::VideoEncoder* encoder) {
65 delete encoder; 68 delete encoder;
66 } 69 }
67 70
68 } // namespace cricket 71 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/codec.cc ('k') | webrtc/media/engine/webrtcvideoencoderfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698