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

Side by Side Diff: webrtc/modules/video_coding/video_sender.cc

Issue 1682253005: Fix SetRates for encoders with internal sources. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed fake_encoder. Created 4 years, 8 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
« no previous file with comments | « no previous file | webrtc/modules/video_coding/video_sender_unittest.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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 int32_t VideoSender::SetChannelParameters(uint32_t target_bitrate, 196 int32_t VideoSender::SetChannelParameters(uint32_t target_bitrate,
197 uint8_t lossRate, 197 uint8_t lossRate,
198 int64_t rtt) { 198 int64_t rtt) {
199 uint32_t target_rate = 199 uint32_t target_rate =
200 _mediaOpt.SetTargetRates(target_bitrate, lossRate, rtt, 200 _mediaOpt.SetTargetRates(target_bitrate, lossRate, rtt,
201 protection_callback_, qm_settings_callback_); 201 protection_callback_, qm_settings_callback_);
202 202
203 uint32_t input_frame_rate = _mediaOpt.InputFrameRate(); 203 uint32_t input_frame_rate = _mediaOpt.InputFrameRate();
204 204
205 rtc::CritScope cs(&params_crit_); 205 EncoderParameters encoder_params = {target_rate, lossRate, rtt,
206 encoder_params_ = {target_rate, lossRate, rtt, input_frame_rate}; 206 input_frame_rate};
207 bool encoder_has_internal_source;
208 {
209 rtc::CritScope cs(&params_crit_);
210 encoder_params_ = encoder_params;
211 encoder_has_internal_source = encoder_has_internal_source_;
212 }
213
214 // For encoders with internal sources, we need to tell the encoder directly,
215 // instead of waiting for an AddVideoFrame that will never come (internal
216 // source encoders don't get input frames).
217 if (encoder_has_internal_source) {
218 rtc::CritScope cs(&encoder_crit_);
219 if (_encoder) {
220 SetEncoderParameters(encoder_params);
221 }
222 }
207 223
208 return VCM_OK; 224 return VCM_OK;
209 } 225 }
210 226
211 void VideoSender::SetEncoderParameters(EncoderParameters params) { 227 void VideoSender::SetEncoderParameters(EncoderParameters params) {
212 if (params.target_bitrate == 0) 228 if (params.target_bitrate == 0)
213 return; 229 return;
214 230
215 if (params.input_frame_rate == 0) { 231 if (params.input_frame_rate == 0) {
216 // No frame rate estimate available, use default. 232 // No frame rate estimate available, use default.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // 10 kbps. 394 // 10 kbps.
379 int window_bps = std::max(threshold_bps / 10, 10000); 395 int window_bps = std::max(threshold_bps / 10, 10000);
380 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); 396 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps);
381 } 397 }
382 398
383 bool VideoSender::VideoSuspended() const { 399 bool VideoSender::VideoSuspended() const {
384 return _mediaOpt.IsVideoSuspended(); 400 return _mediaOpt.IsVideoSuspended();
385 } 401 }
386 } // namespace vcm 402 } // namespace vcm
387 } // namespace webrtc 403 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/video_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698