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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 | 286 |
| 287 void PacedSender::SetMinimumSendBitrate(int bitrate_bps) { | 287 void PacedSender::SetMinimumSendBitrate(int bitrate_bps) { |
| 288 CriticalSectionScoped cs(critsect_.get()); | 288 CriticalSectionScoped cs(critsect_.get()); |
| 289 min_send_bitrate_kbps_ = bitrate_bps / 1000; | 289 min_send_bitrate_kbps_ = bitrate_bps / 1000; |
| 290 target_bitrate_kbps_ = | 290 target_bitrate_kbps_ = |
| 291 std::max(min_send_bitrate_kbps_, estimated_bitrate_bps_ / 1000) * | 291 std::max(min_send_bitrate_kbps_, estimated_bitrate_bps_ / 1000) * |
| 292 kDefaultPaceMultiplier; | 292 kDefaultPaceMultiplier; |
| 293 } | 293 } |
| 294 | 294 |
| 295 void PacedSender::SetNetWorkEstimateTargetBitrate(uint32_t bitrate_bps) { | 295 void PacedSender::SetNetWorkEstimateTargetBitrate(uint32_t bitrate_bps) { |
| 296 LOG(LS_INFO) << "SetNetWorkEstimateTargetBitrate, bitrate " << bitrate_bps; | 296 LOG(LS_VERBOSE) << "SetNetWorkEstimateTargetBitrate, bitrate " << bitrate_bps; |
| 297 | 297 |
| 298 CriticalSectionScoped cs(critsect_.get()); | 298 CriticalSectionScoped cs(critsect_.get()); |
| 299 estimated_bitrate_bps_ = bitrate_bps; | 299 estimated_bitrate_bps_ = bitrate_bps; |
| 300 target_bitrate_kbps_ = | 300 target_bitrate_kbps_ = |
| 301 std::max(min_send_bitrate_kbps_, estimated_bitrate_bps_ / 1000) * | 301 std::max(min_send_bitrate_kbps_, estimated_bitrate_bps_ / 1000) * |
| 302 kDefaultPaceMultiplier; | 302 kDefaultPaceMultiplier; |
| 303 } | 303 } |
| 304 | 304 |
| 305 void PacedSender::SetPaddingBitrate(int bitrate_bps) { | 305 void PacedSender::SetPaddingBitrate(int bitrate_bps) { |
| 306 CriticalSectionScoped cs(critsect_.get()); | 306 CriticalSectionScoped cs(critsect_.get()); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 321 prober_->OnIncomingPacket(estimated_bitrate_bps_, bytes, now_ms); | 321 prober_->OnIncomingPacket(estimated_bitrate_bps_, bytes, now_ms); |
| 322 | 322 |
| 323 if (capture_time_ms < 0) | 323 if (capture_time_ms < 0) |
| 324 capture_time_ms = now_ms; | 324 capture_time_ms = now_ms; |
| 325 | 325 |
| 326 packets_->Push(paced_sender::Packet(priority, ssrc, sequence_number, | 326 packets_->Push(paced_sender::Packet(priority, ssrc, sequence_number, |
| 327 capture_time_ms, now_ms, bytes, | 327 capture_time_ms, now_ms, bytes, |
| 328 retransmission, packet_counter_++)); | 328 retransmission, packet_counter_++)); |
| 329 } | 329 } |
| 330 | 330 |
| 331 bool PacedSender::CanSendMorePackets() const { | |
| 332 CriticalSectionScoped cs(critsect_.get()); | |
| 333 return !paused_ && ExpectedQueueTimeMs() < PacedSender::kMaxQueueLengthMs; | |
|
stefan-webrtc
2016/05/02 10:56:30
This method takes the lock twice, once on line 332
| |
| 334 } | |
| 335 | |
| 331 int64_t PacedSender::ExpectedQueueTimeMs() const { | 336 int64_t PacedSender::ExpectedQueueTimeMs() const { |
| 332 CriticalSectionScoped cs(critsect_.get()); | 337 CriticalSectionScoped cs(critsect_.get()); |
| 333 RTC_DCHECK_GT(target_bitrate_kbps_, 0u); | 338 RTC_DCHECK_GT(target_bitrate_kbps_, 0u); |
| 334 return static_cast<int64_t>(packets_->SizeInBytes() * 8 / | 339 return static_cast<int64_t>(packets_->SizeInBytes() * 8 / |
| 335 target_bitrate_kbps_); | 340 target_bitrate_kbps_); |
| 336 } | 341 } |
| 337 | 342 |
| 338 size_t PacedSender::QueueSizePackets() const { | 343 size_t PacedSender::QueueSizePackets() const { |
| 339 CriticalSectionScoped cs(critsect_.get()); | 344 CriticalSectionScoped cs(critsect_.get()); |
| 340 return packets_->SizeInPackets(); | 345 return packets_->SizeInPackets(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 media_budget_->UseBudget(bytes_sent); | 472 media_budget_->UseBudget(bytes_sent); |
| 468 padding_budget_->UseBudget(bytes_sent); | 473 padding_budget_->UseBudget(bytes_sent); |
| 469 } | 474 } |
| 470 } | 475 } |
| 471 | 476 |
| 472 void PacedSender::UpdateBytesPerInterval(int64_t delta_time_ms) { | 477 void PacedSender::UpdateBytesPerInterval(int64_t delta_time_ms) { |
| 473 media_budget_->IncreaseBudget(delta_time_ms); | 478 media_budget_->IncreaseBudget(delta_time_ms); |
| 474 padding_budget_->IncreaseBudget(delta_time_ms); | 479 padding_budget_->IncreaseBudget(delta_time_ms); |
| 475 } | 480 } |
| 476 } // namespace webrtc | 481 } // namespace webrtc |
| OLD | NEW |