| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 rtc::CritScope cs(&modules_crit_); | 43 rtc::CritScope cs(&modules_crit_); |
| 44 RTC_DCHECK(std::find(rtp_modules_.begin(), rtp_modules_.end(), rtp_module) != | 44 RTC_DCHECK(std::find(rtp_modules_.begin(), rtp_modules_.end(), rtp_module) != |
| 45 rtp_modules_.end()); | 45 rtp_modules_.end()); |
| 46 rtp_modules_.remove(rtp_module); | 46 rtp_modules_.remove(rtp_module); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool PacketRouter::TimeToSendPacket(uint32_t ssrc, | 49 bool PacketRouter::TimeToSendPacket(uint32_t ssrc, |
| 50 uint16_t sequence_number, | 50 uint16_t sequence_number, |
| 51 int64_t capture_timestamp, | 51 int64_t capture_timestamp, |
| 52 bool retransmission, | 52 bool retransmission, |
| 53 int probe_cluster_id) { | 53 const PacedPacketInfo& pacing_info) { |
| 54 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread()); | 54 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread()); |
| 55 rtc::CritScope cs(&modules_crit_); | 55 rtc::CritScope cs(&modules_crit_); |
| 56 for (auto* rtp_module : rtp_modules_) { | 56 for (auto* rtp_module : rtp_modules_) { |
| 57 if (!rtp_module->SendingMedia()) | 57 if (!rtp_module->SendingMedia()) |
| 58 continue; | 58 continue; |
| 59 if (ssrc == rtp_module->SSRC() || ssrc == rtp_module->FlexfecSsrc()) { | 59 if (ssrc == rtp_module->SSRC() || ssrc == rtp_module->FlexfecSsrc()) { |
| 60 return rtp_module->TimeToSendPacket(ssrc, sequence_number, | 60 return rtp_module->TimeToSendPacket(ssrc, sequence_number, |
| 61 capture_timestamp, retransmission, | 61 capture_timestamp, retransmission, |
| 62 probe_cluster_id); | 62 pacing_info); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 size_t PacketRouter::TimeToSendPadding(size_t bytes_to_send, | 68 size_t PacketRouter::TimeToSendPadding(size_t bytes_to_send, |
| 69 int probe_cluster_id) { | 69 const PacedPacketInfo& pacing_info) { |
| 70 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread()); | 70 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread()); |
| 71 size_t total_bytes_sent = 0; | 71 size_t total_bytes_sent = 0; |
| 72 rtc::CritScope cs(&modules_crit_); | 72 rtc::CritScope cs(&modules_crit_); |
| 73 // Rtp modules are ordered by which stream can most benefit from padding. | 73 // Rtp modules are ordered by which stream can most benefit from padding. |
| 74 for (RtpRtcp* module : rtp_modules_) { | 74 for (RtpRtcp* module : rtp_modules_) { |
| 75 if (module->SendingMedia() && module->HasBweExtensions()) { | 75 if (module->SendingMedia() && module->HasBweExtensions()) { |
| 76 size_t bytes_sent = module->TimeToSendPadding( | 76 size_t bytes_sent = module->TimeToSendPadding( |
| 77 bytes_to_send - total_bytes_sent, probe_cluster_id); | 77 bytes_to_send - total_bytes_sent, pacing_info); |
| 78 total_bytes_sent += bytes_sent; | 78 total_bytes_sent += bytes_sent; |
| 79 if (total_bytes_sent >= bytes_to_send) | 79 if (total_bytes_sent >= bytes_to_send) |
| 80 break; | 80 break; |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 return total_bytes_sent; | 83 return total_bytes_sent; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void PacketRouter::SetTransportWideSequenceNumber(uint16_t sequence_number) { | 86 void PacketRouter::SetTransportWideSequenceNumber(uint16_t sequence_number) { |
| 87 rtc::AtomicOps::ReleaseStore(&transport_seq_, sequence_number); | 87 rtc::AtomicOps::ReleaseStore(&transport_seq_, sequence_number); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 109 rtc::CritScope cs(&modules_crit_); | 109 rtc::CritScope cs(&modules_crit_); |
| 110 for (auto* rtp_module : rtp_modules_) { | 110 for (auto* rtp_module : rtp_modules_) { |
| 111 packet->SetSenderSsrc(rtp_module->SSRC()); | 111 packet->SetSenderSsrc(rtp_module->SSRC()); |
| 112 if (rtp_module->SendFeedbackPacket(*packet)) | 112 if (rtp_module->SendFeedbackPacket(*packet)) |
| 113 return true; | 113 return true; |
| 114 } | 114 } |
| 115 return false; | 115 return false; |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace webrtc | 118 } // namespace webrtc |
| OLD | NEW |