Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 if (enable) { | 390 if (enable) { |
| 391 // kInterpolation is currently not supported. | 391 // kInterpolation is currently not supported. |
| 392 LOG_F(LS_ERROR) << "Not supported."; | 392 LOG_F(LS_ERROR) << "Not supported."; |
| 393 return -1; | 393 return -1; |
| 394 } | 394 } |
| 395 vpm_->SetInputFrameResampleMode(resampling_mode); | 395 vpm_->SetInputFrameResampleMode(resampling_mode); |
| 396 | 396 |
| 397 return 0; | 397 return 0; |
| 398 } | 398 } |
| 399 | 399 |
| 400 int ViEEncoder::GetPaddingNeededBps(int bitrate_bps) const { | 400 int ViEEncoder::GetPaddingNeededBps() const { |
| 401 int64_t time_of_last_frame_activity_ms; | 401 int64_t time_of_last_frame_activity_ms; |
| 402 int min_transmit_bitrate_bps; | 402 int min_transmit_bitrate_bps; |
| 403 int bitrate_bps; | |
| 403 { | 404 { |
| 404 CriticalSectionScoped cs(data_cs_.get()); | 405 CriticalSectionScoped cs(data_cs_.get()); |
| 405 bool send_padding = | 406 bool send_padding = |
| 406 send_padding_ || video_suspended_ || min_transmit_bitrate_kbps_ > 0; | 407 send_padding_ || video_suspended_ || min_transmit_bitrate_kbps_ > 0; |
| 407 if (!send_padding) | 408 if (!send_padding) |
| 408 return 0; | 409 return 0; |
| 409 time_of_last_frame_activity_ms = time_of_last_frame_activity_ms_; | 410 time_of_last_frame_activity_ms = time_of_last_frame_activity_ms_; |
| 410 min_transmit_bitrate_bps = 1000 * min_transmit_bitrate_kbps_; | 411 min_transmit_bitrate_bps = 1000 * min_transmit_bitrate_kbps_; |
| 412 bitrate_bps = last_observed_bitrate_bps_; | |
| 411 } | 413 } |
| 412 | 414 |
| 415 bool video_is_suspended = vcm_->VideoSuspended(); | |
| 416 | |
|
pbos-webrtc
2015/07/15 10:52:36
git cl format, yo.
stefan-webrtc
2015/07/15 10:54:52
Done.
| |
| 417 | |
| 413 VideoCodec send_codec; | 418 VideoCodec send_codec; |
| 414 if (vcm_->SendCodec(&send_codec) != 0) | 419 if (vcm_->SendCodec(&send_codec) != 0) |
| 415 return 0; | 420 return 0; |
| 416 SimulcastStream* stream_configs = send_codec.simulcastStream; | |
| 417 // Allocate the bandwidth between the streams. | |
| 418 std::vector<uint32_t> stream_bitrates = AllocateStreamBitrates( | |
| 419 bitrate_bps, stream_configs, send_codec.numberOfSimulcastStreams); | |
| 420 | |
| 421 bool video_is_suspended = vcm_->VideoSuspended(); | |
| 422 | 421 |
| 423 // Find the max amount of padding we can allow ourselves to send at this | 422 // Find the max amount of padding we can allow ourselves to send at this |
| 424 // point, based on which streams are currently active and what our current | 423 // point, based on which streams are currently active and what our current |
| 425 // available bandwidth is. | 424 // available bandwidth is. |
| 426 int pad_up_to_bitrate_bps = 0; | 425 int pad_up_to_bitrate_bps = 0; |
| 427 if (send_codec.numberOfSimulcastStreams == 0) { | 426 if (send_codec.numberOfSimulcastStreams == 0) { |
| 428 pad_up_to_bitrate_bps = send_codec.minBitrate * 1000; | 427 pad_up_to_bitrate_bps = send_codec.minBitrate * 1000; |
| 429 } else { | 428 } else { |
| 429 SimulcastStream* stream_configs = send_codec.simulcastStream; | |
| 430 pad_up_to_bitrate_bps = | 430 pad_up_to_bitrate_bps = |
| 431 stream_configs[send_codec.numberOfSimulcastStreams - 1].minBitrate * | 431 stream_configs[send_codec.numberOfSimulcastStreams - 1].minBitrate * |
| 432 1000; | 432 1000; |
| 433 for (int i = 0; i < send_codec.numberOfSimulcastStreams - 1; ++i) { | 433 for (int i = 0; i < send_codec.numberOfSimulcastStreams - 1; ++i) { |
| 434 pad_up_to_bitrate_bps += stream_configs[i].targetBitrate * 1000; | 434 pad_up_to_bitrate_bps += stream_configs[i].targetBitrate * 1000; |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 | 437 |
| 438 // Disable padding if only sending one stream and video isn't suspended and | 438 // Disable padding if only sending one stream and video isn't suspended and |
| 439 // min-transmit bitrate isn't used (applied later). | 439 // min-transmit bitrate isn't used (applied later). |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 869 const uint32_t width, | 869 const uint32_t width, |
| 870 const uint32_t height) { | 870 const uint32_t height) { |
| 871 return vpm_->SetTargetResolution(width, height, frame_rate); | 871 return vpm_->SetTargetResolution(width, height, frame_rate); |
| 872 } | 872 } |
| 873 | 873 |
| 874 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { | 874 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { |
| 875 vpm_->SetTargetFramerate(frame_rate); | 875 vpm_->SetTargetFramerate(frame_rate); |
| 876 } | 876 } |
| 877 | 877 |
| 878 } // namespace webrtc | 878 } // namespace webrtc |
| OLD | NEW |