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

Side by Side Diff: webrtc/config.cc

Issue 2047513002: Add proper lifetime of encoder-specific settings. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: typo Created 4 years, 6 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
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 #include "webrtc/config.h" 10 #include "webrtc/config.h"
11 11
12 #include <sstream> 12 #include <sstream>
13 #include <string> 13 #include <string>
14 14
15 #include "webrtc/base/checks.h"
16
15 namespace webrtc { 17 namespace webrtc {
16 std::string FecConfig::ToString() const { 18 std::string FecConfig::ToString() const {
17 std::stringstream ss; 19 std::stringstream ss;
18 ss << "{ulpfec_payload_type: " << ulpfec_payload_type; 20 ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
19 ss << ", red_payload_type: " << red_payload_type; 21 ss << ", red_payload_type: " << red_payload_type;
20 ss << ", red_rtx_payload_type: " << red_rtx_payload_type; 22 ss << ", red_rtx_payload_type: " << red_rtx_payload_type;
21 ss << '}'; 23 ss << '}';
22 return ss.str(); 24 return ss.str();
23 } 25 }
24 26
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 ss << ", "; 92 ss << ", ";
91 } 93 }
92 ss << ']'; 94 ss << ']';
93 95
94 ss << '}'; 96 ss << '}';
95 return ss.str(); 97 return ss.str();
96 } 98 }
97 99
98 VideoEncoderConfig::VideoEncoderConfig() 100 VideoEncoderConfig::VideoEncoderConfig()
99 : content_type(ContentType::kRealtimeVideo), 101 : content_type(ContentType::kRealtimeVideo),
100 encoder_specific_settings(NULL), 102 encoder_specific_settings(nullptr),
101 min_transmit_bitrate_bps(0) { 103 min_transmit_bitrate_bps(0) {}
102 }
103 104
104 VideoEncoderConfig::~VideoEncoderConfig() = default; 105 VideoEncoderConfig::~VideoEncoderConfig() = default;
105 106
106 std::string VideoEncoderConfig::ToString() const { 107 std::string VideoEncoderConfig::ToString() const {
107 std::stringstream ss; 108 std::stringstream ss;
108 109
109 ss << "{streams: ["; 110 ss << "{streams: [";
110 for (size_t i = 0; i < streams.size(); ++i) { 111 for (size_t i = 0; i < streams.size(); ++i) {
111 ss << streams[i].ToString(); 112 ss << streams[i].ToString();
112 if (i != streams.size() - 1) 113 if (i != streams.size() - 1)
(...skipping 10 matching lines...) Expand all
123 break; 124 break;
124 } 125 }
125 ss << ", encoder_specific_settings: "; 126 ss << ", encoder_specific_settings: ";
126 ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL"); 127 ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
127 128
128 ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps; 129 ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
129 ss << '}'; 130 ss << '}';
130 return ss.str(); 131 return ss.str();
131 } 132 }
132 133
134 void VideoEncoderConfig::EncoderSpecificSettings::FillEncoderSpecificSettings(
135 VideoCodec* codec) const {
136 if (codec->codecType == kVideoCodecH264) {
137 FillVideoCodecH264(&codec->codecSpecific.H264);
138 } else if (codec->codecType == kVideoCodecVP8) {
139 FillVideoCodecVp8(&codec->codecSpecific.VP8);
140 } else if (codec->codecType == kVideoCodecVP9) {
141 FillVideoCodecVp9(&codec->codecSpecific.VP9);
142 } else {
143 RTC_NOTREACHED() << "Encoder specifics set/used for unknown codec type.";
144 }
145 }
146
147 void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecH264(
148 VideoCodecH264* h264_settings) const {
149 RTC_NOTREACHED();
150 }
151
152 void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp8(
153 VideoCodecVP8* vp9_settings) const {
154 RTC_NOTREACHED();
155 }
156
157 void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp9(
158 VideoCodecVP9* vp8_settings) const {
159 RTC_NOTREACHED();
160 }
161
162 VideoEncoderConfig::H264EncoderSpecificSettings::H264EncoderSpecificSettings(
163 const VideoCodecH264& specifics)
164 : specifics_(specifics) {}
165
166 void VideoEncoderConfig::H264EncoderSpecificSettings::FillVideoCodecH264(
167 VideoCodecH264* h264_settings) const {
168 *h264_settings = specifics_;
169 }
170
171 VideoEncoderConfig::Vp8EncoderSpecificSettings::Vp8EncoderSpecificSettings(
172 const VideoCodecVP8& specifics)
173 : specifics_(specifics) {}
174
175 void VideoEncoderConfig::Vp8EncoderSpecificSettings::FillVideoCodecVp8(
176 VideoCodecVP8* vp8_settings) const {
177 *vp8_settings = specifics_;
178 }
179
180 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings(
181 const VideoCodecVP9& specifics)
182 : specifics_(specifics) {}
183
184 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9(
185 VideoCodecVP9* vp9_settings) const {
186 *vp9_settings = specifics_;
187 }
188
133 } // namespace webrtc 189 } // namespace webrtc
OLDNEW
« webrtc/config.h ('K') | « webrtc/config.h ('k') | webrtc/media/engine/fakewebrtccall.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698