| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 void CancelPop(const Packet& packet) { prio_queue_.push(&(*packet.this_it)); } | 123 void CancelPop(const Packet& packet) { prio_queue_.push(&(*packet.this_it)); } |
| 124 | 124 |
| 125 void FinalizePop(const Packet& packet) { | 125 void FinalizePop(const Packet& packet) { |
| 126 RemoveFromDupeSet(packet); | 126 RemoveFromDupeSet(packet); |
| 127 bytes_ -= packet.bytes; | 127 bytes_ -= packet.bytes; |
| 128 queue_time_sum_ -= (time_last_updated_ - packet.enqueue_time_ms); | 128 queue_time_sum_ -= (time_last_updated_ - packet.enqueue_time_ms); |
| 129 packet_list_.erase(packet.this_it); | 129 packet_list_.erase(packet.this_it); |
| 130 RTC_DCHECK_EQ(packet_list_.size(), prio_queue_.size()); | 130 RTC_DCHECK_EQ(packet_list_.size(), prio_queue_.size()); |
| 131 if (packet_list_.empty()) | 131 if (packet_list_.empty()) |
| 132 RTC_DCHECK_EQ(0u, queue_time_sum_); | 132 RTC_DCHECK_EQ(0, queue_time_sum_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool Empty() const { return prio_queue_.empty(); } | 135 bool Empty() const { return prio_queue_.empty(); } |
| 136 | 136 |
| 137 size_t SizeInPackets() const { return prio_queue_.size(); } | 137 size_t SizeInPackets() const { return prio_queue_.size(); } |
| 138 | 138 |
| 139 uint64_t SizeInBytes() const { return bytes_; } | 139 uint64_t SizeInBytes() const { return bytes_; } |
| 140 | 140 |
| 141 int64_t OldestEnqueueTimeMs() const { | 141 int64_t OldestEnqueueTimeMs() const { |
| 142 auto it = packet_list_.rbegin(); | 142 auto it = packet_list_.rbegin(); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 paused_ = true; | 278 paused_ = true; |
| 279 } | 279 } |
| 280 | 280 |
| 281 void PacedSender::Resume() { | 281 void PacedSender::Resume() { |
| 282 LOG(LS_INFO) << "PacedSender resumed."; | 282 LOG(LS_INFO) << "PacedSender resumed."; |
| 283 CriticalSectionScoped cs(critsect_.get()); | 283 CriticalSectionScoped cs(critsect_.get()); |
| 284 paused_ = false; | 284 paused_ = false; |
| 285 } | 285 } |
| 286 | 286 |
| 287 void PacedSender::SetProbingEnabled(bool enabled) { | 287 void PacedSender::SetProbingEnabled(bool enabled) { |
| 288 RTC_CHECK_EQ(0u, packet_counter_); | 288 RTC_CHECK_EQ(0, packet_counter_); |
| 289 CriticalSectionScoped cs(critsect_.get()); | 289 CriticalSectionScoped cs(critsect_.get()); |
| 290 prober_->SetEnabled(enabled); | 290 prober_->SetEnabled(enabled); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void PacedSender::SetEstimatedBitrate(uint32_t bitrate_bps) { | 293 void PacedSender::SetEstimatedBitrate(uint32_t bitrate_bps) { |
| 294 if (bitrate_bps == 0) | 294 if (bitrate_bps == 0) |
| 295 LOG(LS_ERROR) << "PacedSender is not designed to handle 0 bitrate."; | 295 LOG(LS_ERROR) << "PacedSender is not designed to handle 0 bitrate."; |
| 296 CriticalSectionScoped cs(critsect_.get()); | 296 CriticalSectionScoped cs(critsect_.get()); |
| 297 estimated_bitrate_bps_ = bitrate_bps; | 297 estimated_bitrate_bps_ = bitrate_bps; |
| 298 padding_budget_->set_target_rate_kbps( | 298 padding_budget_->set_target_rate_kbps( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 if (capture_time_ms < 0) | 331 if (capture_time_ms < 0) |
| 332 capture_time_ms = now_ms; | 332 capture_time_ms = now_ms; |
| 333 | 333 |
| 334 packets_->Push(paced_sender::Packet(priority, ssrc, sequence_number, | 334 packets_->Push(paced_sender::Packet(priority, ssrc, sequence_number, |
| 335 capture_time_ms, now_ms, bytes, | 335 capture_time_ms, now_ms, bytes, |
| 336 retransmission, packet_counter_++)); | 336 retransmission, packet_counter_++)); |
| 337 } | 337 } |
| 338 | 338 |
| 339 int64_t PacedSender::ExpectedQueueTimeMs() const { | 339 int64_t PacedSender::ExpectedQueueTimeMs() const { |
| 340 CriticalSectionScoped cs(critsect_.get()); | 340 CriticalSectionScoped cs(critsect_.get()); |
| 341 RTC_DCHECK_GT(pacing_bitrate_kbps_, 0u); | 341 RTC_DCHECK_GT(pacing_bitrate_kbps_, 0); |
| 342 return static_cast<int64_t>(packets_->SizeInBytes() * 8 / | 342 return static_cast<int64_t>(packets_->SizeInBytes() * 8 / |
| 343 pacing_bitrate_kbps_); | 343 pacing_bitrate_kbps_); |
| 344 } | 344 } |
| 345 | 345 |
| 346 bool PacedSender::InApplicationLimitedRegion() const { | 346 bool PacedSender::InApplicationLimitedRegion() const { |
| 347 CriticalSectionScoped cs(critsect_.get()); | 347 CriticalSectionScoped cs(critsect_.get()); |
| 348 return alr_detector_->InApplicationLimitedRegion(); | 348 return alr_detector_->InApplicationLimitedRegion(); |
| 349 } | 349 } |
| 350 | 350 |
| 351 size_t PacedSender::QueueSizePackets() const { | 351 size_t PacedSender::QueueSizePackets() const { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 void PacedSender::UpdateBudgetWithElapsedTime(int64_t delta_time_ms) { | 500 void PacedSender::UpdateBudgetWithElapsedTime(int64_t delta_time_ms) { |
| 501 media_budget_->IncreaseBudget(delta_time_ms); | 501 media_budget_->IncreaseBudget(delta_time_ms); |
| 502 padding_budget_->IncreaseBudget(delta_time_ms); | 502 padding_budget_->IncreaseBudget(delta_time_ms); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void PacedSender::UpdateBudgetWithBytesSent(size_t bytes_sent) { | 505 void PacedSender::UpdateBudgetWithBytesSent(size_t bytes_sent) { |
| 506 media_budget_->UseBudget(bytes_sent); | 506 media_budget_->UseBudget(bytes_sent); |
| 507 padding_budget_->UseBudget(bytes_sent); | 507 padding_budget_->UseBudget(bytes_sent); |
| 508 } | 508 } |
| 509 } // namespace webrtc | 509 } // namespace webrtc |
| OLD | NEW |