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: feedback: comment and rename parameters Created 4 years, 5 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 NackConfig::ToString() const { 18 std::string NackConfig::ToString() const {
17 std::stringstream ss; 19 std::stringstream ss;
18 ss << "{rtp_history_ms: " << rtp_history_ms; 20 ss << "{rtp_history_ms: " << rtp_history_ms;
19 ss << '}'; 21 ss << '}';
20 return ss.str(); 22 return ss.str();
21 } 23 }
22 24
23 std::string FecConfig::ToString() const { 25 std::string FecConfig::ToString() const {
24 std::stringstream ss; 26 std::stringstream ss;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 ss << ", "; 108 ss << ", ";
107 } 109 }
108 ss << ']'; 110 ss << ']';
109 111
110 ss << '}'; 112 ss << '}';
111 return ss.str(); 113 return ss.str();
112 } 114 }
113 115
114 VideoEncoderConfig::VideoEncoderConfig() 116 VideoEncoderConfig::VideoEncoderConfig()
115 : content_type(ContentType::kRealtimeVideo), 117 : content_type(ContentType::kRealtimeVideo),
116 encoder_specific_settings(NULL), 118 encoder_specific_settings(nullptr),
117 min_transmit_bitrate_bps(0), 119 min_transmit_bitrate_bps(0),
118 expect_encode_from_texture(false) {} 120 expect_encode_from_texture(false) {}
119 121
120 VideoEncoderConfig::~VideoEncoderConfig() = default; 122 VideoEncoderConfig::~VideoEncoderConfig() = default;
121 123
122 std::string VideoEncoderConfig::ToString() const { 124 std::string VideoEncoderConfig::ToString() const {
123 std::stringstream ss; 125 std::stringstream ss;
124 126
125 ss << "{streams: ["; 127 ss << "{streams: [";
126 for (size_t i = 0; i < streams.size(); ++i) { 128 for (size_t i = 0; i < streams.size(); ++i) {
(...skipping 12 matching lines...) Expand all
139 break; 141 break;
140 } 142 }
141 ss << ", encoder_specific_settings: "; 143 ss << ", encoder_specific_settings: ";
142 ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL"); 144 ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
143 145
144 ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps; 146 ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
145 ss << '}'; 147 ss << '}';
146 return ss.str(); 148 return ss.str();
147 } 149 }
148 150
151 void VideoEncoderConfig::EncoderSpecificSettings::FillEncoderSpecificSettings(
152 VideoCodec* codec) const {
153 if (codec->codecType == kVideoCodecH264) {
154 FillVideoCodecH264(&codec->codecSpecific.H264);
155 } else if (codec->codecType == kVideoCodecVP8) {
156 FillVideoCodecVp8(&codec->codecSpecific.VP8);
157 } else if (codec->codecType == kVideoCodecVP9) {
158 FillVideoCodecVp9(&codec->codecSpecific.VP9);
159 } else {
160 RTC_NOTREACHED() << "Encoder specifics set/used for unknown codec type.";
161 }
162 }
163
164 void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecH264(
165 VideoCodecH264* h264_settings) const {
166 RTC_NOTREACHED();
167 }
168
169 void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp8(
170 VideoCodecVP8* vp9_settings) const {
mflodman 2016/08/04 13:53:23 s/vp9_settings/vp8_settings
pbos-webrtc 2016/08/08 20:42:21 Done.
171 RTC_NOTREACHED();
172 }
173
174 void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp9(
175 VideoCodecVP9* vp8_settings) const {
mflodman 2016/08/04 13:53:23 s/vp8_settings/vp9_settings
pbos-webrtc 2016/08/08 20:42:21 Done.
176 RTC_NOTREACHED();
177 }
178
179 VideoEncoderConfig::H264EncoderSpecificSettings::H264EncoderSpecificSettings(
180 const VideoCodecH264& specifics)
181 : specifics_(specifics) {}
182
183 void VideoEncoderConfig::H264EncoderSpecificSettings::FillVideoCodecH264(
184 VideoCodecH264* h264_settings) const {
185 *h264_settings = specifics_;
186 }
187
188 VideoEncoderConfig::Vp8EncoderSpecificSettings::Vp8EncoderSpecificSettings(
189 const VideoCodecVP8& specifics)
190 : specifics_(specifics) {}
191
192 void VideoEncoderConfig::Vp8EncoderSpecificSettings::FillVideoCodecVp8(
193 VideoCodecVP8* vp8_settings) const {
194 *vp8_settings = specifics_;
195 }
196
197 VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings(
198 const VideoCodecVP9& specifics)
199 : specifics_(specifics) {}
200
201 void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9(
202 VideoCodecVP9* vp9_settings) const {
203 *vp9_settings = specifics_;
204 }
205
149 } // namespace webrtc 206 } // 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