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 { | |
208 rtc::CritScope cs(¶ms_crit_); | |
209 encoder_params_ = encoder_params; | |
210 } | |
211 | |
212 // For encoders with internal sources, we need to tell the encoder directly, | |
213 // instead of waiting for an AddVideoFrame that will never come (internal | |
214 // source encoders don't get input frames). | |
215 { | |
216 rtc::CritScope cs(&encoder_crit_); | |
pbos-webrtc
2016/02/11 10:17:00
I believe that this lock could block (the network
| |
217 if (_encoder && _encoder->InternalSource()) { | |
218 SetEncoderParameters(encoder_params); | |
219 } | |
220 } | |
207 | 221 |
208 return VCM_OK; | 222 return VCM_OK; |
209 } | 223 } |
210 | 224 |
211 void VideoSender::SetEncoderParameters(EncoderParameters params) { | 225 void VideoSender::SetEncoderParameters(EncoderParameters params) { |
212 if (params.target_bitrate == 0) | 226 if (params.target_bitrate == 0) |
213 return; | 227 return; |
214 | 228 |
215 if (params.input_frame_rate == 0) { | 229 if (params.input_frame_rate == 0) { |
216 // No frame rate estimate available, use default. | 230 // No frame rate estimate available, use default. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 // 10 kbps. | 387 // 10 kbps. |
374 int window_bps = std::max(threshold_bps / 10, 10000); | 388 int window_bps = std::max(threshold_bps / 10, 10000); |
375 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 389 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
376 } | 390 } |
377 | 391 |
378 bool VideoSender::VideoSuspended() const { | 392 bool VideoSender::VideoSuspended() const { |
379 return _mediaOpt.IsVideoSuspended(); | 393 return _mediaOpt.IsVideoSuspended(); |
380 } | 394 } |
381 } // namespace vcm | 395 } // namespace vcm |
382 } // namespace webrtc | 396 } // namespace webrtc |
OLD | NEW |