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

Side by Side Diff: webrtc/media/engine/webrtcvideoencoderfactory.cc

Issue 2859223003: WebRtcVideoEncoderFactory cleanup (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/media/engine/webrtcvideoencoderfactory.h"
12
13 #include "webrtc/common_types.h"
14
15 namespace cricket {
16
17 webrtc::VideoEncoder* WebRtcVideoEncoderFactory::CreateVideoEncoder(
18 const cricket::VideoCodec& codec) {
19 return CreateVideoEncoder(webrtc::PayloadNameToCodecType(codec.name)
20 .value_or(webrtc::kVideoCodecUnknown));
21 }
22
23 const std::vector<cricket::VideoCodec>&
24 WebRtcVideoEncoderFactory::supported_codecs() const {
25 codecs_.clear();
26 const std::vector<VideoCodec>& encoder_codecs = codecs();
27 for (const VideoCodec& encoder_codec : encoder_codecs) {
28 codecs_.push_back(cricket::VideoCodec(encoder_codec.name));
29 }
30 return codecs_;
31 }
32
33 webrtc::VideoEncoder* WebRtcVideoEncoderFactory::CreateVideoEncoder(
34 webrtc::VideoCodecType type) {
35 const cricket::VideoCodec codec(
36 webrtc::CodecTypeToPayloadName(type).value_or("Unknown codec"));
37 return CreateVideoEncoder(codec);
38 }
39
40 const std::vector<WebRtcVideoEncoderFactory::VideoCodec>&
41 WebRtcVideoEncoderFactory::codecs() const {
42 encoder_codecs_.clear();
43 const std::vector<cricket::VideoCodec>& codecs = supported_codecs();
44 for (const cricket::VideoCodec& codec : codecs) {
45 encoder_codecs_.push_back(
46 VideoCodec(webrtc::PayloadNameToCodecType(codec.name)
47 .value_or(webrtc::kVideoCodecUnknown),
48 codec.name));
49 }
50 return encoder_codecs_;
51 }
52
53 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoencoderfactory.h ('k') | webrtc/media/engine/webrtcvideoencoderfactory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698