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

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

Issue 2493133002: Stop using hardcoded payload types for video codecs (Closed)
Patch Set: Rebase again 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
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/internalencoderfactory.h"
12
13 #include <utility>
14
15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
17 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
18
19 namespace cricket {
20
21 // static
22 WebRtcVideoEncoderFactory& InternalEncoderFactory::GetInstance() {
23 static InternalEncoderFactory instance;
24 return instance;
25 }
26
27 InternalEncoderFactory::InternalEncoderFactory() {
28 supported_codecs_.push_back(cricket::VideoCodec(kVp8CodecName));
29 if (webrtc::VP9Encoder::IsSupported())
30 supported_codecs_.push_back(cricket::VideoCodec(kVp9CodecName));
31 if (webrtc::H264Encoder::IsSupported()) {
32 cricket::VideoCodec codec(kH264CodecName);
33 // TODO(magjed): Move setting these parameters into webrtc::H264Encoder
34 // instead.
35 // TODO(hta): Set FMTP parameters for all codecs of type H264.
36 codec.SetParam(kH264FmtpProfileLevelId,
37 kH264ProfileLevelConstrainedBaseline);
38 codec.SetParam(kH264FmtpLevelAsymmetryAllowed, "1");
39 codec.SetParam(kH264FmtpPacketizationMode, "1");
40 supported_codecs_.push_back(std::move(codec));
41 }
42
43 supported_codecs_.push_back(cricket::VideoCodec(kRedCodecName));
44 supported_codecs_.push_back(cricket::VideoCodec(kUlpfecCodecName));
45 }
46
47 InternalEncoderFactory::~InternalEncoderFactory() {}
48
49 // WebRtcVideoEncoderFactory implementation.
50 webrtc::VideoEncoder* InternalEncoderFactory::CreateVideoEncoder(
51 const cricket::VideoCodec& codec) {
52 switch (CodecTypeFromName(codec.name)) {
53 case webrtc::kVideoCodecH264:
54 return webrtc::H264Encoder::Create();
55 case webrtc::kVideoCodecVP8:
56 return webrtc::VP8Encoder::Create();
57 case webrtc::kVideoCodecVP9:
58 return webrtc::VP9Encoder::Create();
59 default:
60 return nullptr;
61 }
62 }
63
64 const std::vector<cricket::VideoCodec>&
65 InternalEncoderFactory::supported_codecs() const {
66 return supported_codecs_;
67 }
68
69 void InternalEncoderFactory::DestroyVideoEncoder(
70 webrtc::VideoEncoder* encoder) {
71 delete encoder;
72 }
73
74 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/internalencoderfactory.h ('k') | webrtc/media/engine/payload_type_mapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698