| OLD | NEW |
| 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 Loading... |
| 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(¶ms_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(¶ms_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 Loading... |
| 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 |
| OLD | NEW |