| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 // always high priority and that they are the only high priority packets. | 424 // always high priority and that they are the only high priority packets. |
| 425 if (paused_ && packet.priority != kHighPriority) | 425 if (paused_ && packet.priority != kHighPriority) |
| 426 return false; | 426 return false; |
| 427 critsect_->Leave(); | 427 critsect_->Leave(); |
| 428 const bool success = callback_->TimeToSendPacket(packet.ssrc, | 428 const bool success = callback_->TimeToSendPacket(packet.ssrc, |
| 429 packet.sequence_number, | 429 packet.sequence_number, |
| 430 packet.capture_time_ms, | 430 packet.capture_time_ms, |
| 431 packet.retransmission); | 431 packet.retransmission); |
| 432 critsect_->Enter(); | 432 critsect_->Enter(); |
| 433 | 433 |
| 434 // TODO(holmer): High priority packets should only be accounted for if we are | 434 if (success) { |
| 435 // allocating bandwidth for audio. | |
| 436 if (success && packet.priority != kHighPriority) { | |
| 437 // Update media bytes sent. | |
| 438 prober_->PacketSent(clock_->TimeInMilliseconds(), packet.bytes); | 435 prober_->PacketSent(clock_->TimeInMilliseconds(), packet.bytes); |
| 439 media_budget_->UseBudget(packet.bytes); | 436 // TODO(holmer): High priority packets should only be accounted for if we |
| 440 padding_budget_->UseBudget(packet.bytes); | 437 // are allocating bandwidth for audio. |
| 438 if (packet.priority != kHighPriority) { |
| 439 // Update media bytes sent. |
| 440 media_budget_->UseBudget(packet.bytes); |
| 441 padding_budget_->UseBudget(packet.bytes); |
| 442 } |
| 441 } | 443 } |
| 442 | 444 |
| 443 return success; | 445 return success; |
| 444 } | 446 } |
| 445 | 447 |
| 446 void PacedSender::SendPadding(size_t padding_needed) { | 448 void PacedSender::SendPadding(size_t padding_needed) { |
| 447 critsect_->Leave(); | 449 critsect_->Leave(); |
| 448 size_t bytes_sent = callback_->TimeToSendPadding(padding_needed); | 450 size_t bytes_sent = callback_->TimeToSendPadding(padding_needed); |
| 449 critsect_->Enter(); | 451 critsect_->Enter(); |
| 450 | 452 |
| 451 if (bytes_sent > 0) { | 453 if (bytes_sent > 0) { |
| 452 prober_->PacketSent(clock_->TimeInMilliseconds(), bytes_sent); | 454 prober_->PacketSent(clock_->TimeInMilliseconds(), bytes_sent); |
| 453 media_budget_->UseBudget(bytes_sent); | 455 media_budget_->UseBudget(bytes_sent); |
| 454 padding_budget_->UseBudget(bytes_sent); | 456 padding_budget_->UseBudget(bytes_sent); |
| 455 } | 457 } |
| 456 } | 458 } |
| 457 | 459 |
| 458 void PacedSender::UpdateBytesPerInterval(int64_t delta_time_ms) { | 460 void PacedSender::UpdateBytesPerInterval(int64_t delta_time_ms) { |
| 459 media_budget_->IncreaseBudget(delta_time_ms); | 461 media_budget_->IncreaseBudget(delta_time_ms); |
| 460 padding_budget_->IncreaseBudget(delta_time_ms); | 462 padding_budget_->IncreaseBudget(delta_time_ms); |
| 461 } | 463 } |
| 462 } // namespace webrtc | 464 } // namespace webrtc |
| OLD | NEW |