| 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 |
| 11 #ifndef WEBRTC_MODULES_PACING_PACED_SENDER_H_ | 11 #ifndef WEBRTC_MODULES_PACING_PACED_SENDER_H_ |
| 12 #define WEBRTC_MODULES_PACING_PACED_SENDER_H_ | 12 #define WEBRTC_MODULES_PACING_PACED_SENDER_H_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <set> | 16 #include <set> |
| 17 | 17 |
| 18 #include "webrtc/base/thread_annotations.h" | 18 #include "webrtc/base/thread_annotations.h" |
| 19 #include "webrtc/modules/include/module.h" | 19 #include "webrtc/modules/include/module.h" |
| 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 21 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
| 22 | 22 |
| 23 namespace webrtc { | 23 namespace webrtc { |
| 24 class AlrDetector; |
| 24 class BitrateProber; | 25 class BitrateProber; |
| 25 class Clock; | 26 class Clock; |
| 26 class CriticalSectionWrapper; | 27 class CriticalSectionWrapper; |
| 27 | 28 |
| 28 namespace paced_sender { | 29 namespace paced_sender { |
| 29 class IntervalBudget; | 30 class IntervalBudget; |
| 30 struct Packet; | 31 struct Packet; |
| 31 class PacketQueue; | 32 class PacketQueue; |
| 32 } // namespace paced_sender | 33 } // namespace paced_sender |
| 33 | 34 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 // Returns the number of milliseconds until the module want a worker thread | 127 // Returns the number of milliseconds until the module want a worker thread |
| 127 // to call Process. | 128 // to call Process. |
| 128 int64_t TimeUntilNextProcess() override; | 129 int64_t TimeUntilNextProcess() override; |
| 129 | 130 |
| 130 // Process any pending packets in the queue(s). | 131 // Process any pending packets in the queue(s). |
| 131 void Process() override; | 132 void Process() override; |
| 132 | 133 |
| 133 private: | 134 private: |
| 134 // Updates the number of bytes that can be sent for the next time interval. | 135 // Updates the number of bytes that can be sent for the next time interval. |
| 135 void UpdateBytesPerInterval(int64_t delta_time_in_ms) | 136 void UpdateBudgetWithElapsedTime(int64_t delta_time_in_ms) |
| 137 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
| 138 void UpdateBudgetWithBytesSent(size_t bytes) |
| 136 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 139 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
| 137 | 140 |
| 138 bool SendPacket(const paced_sender::Packet& packet, int probe_cluster_id) | 141 bool SendPacket(const paced_sender::Packet& packet, int probe_cluster_id) |
| 139 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 142 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
| 140 size_t SendPadding(size_t padding_needed, int probe_cluster_id) | 143 size_t SendPadding(size_t padding_needed, int probe_cluster_id) |
| 141 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 144 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
| 142 | 145 |
| 143 Clock* const clock_; | 146 Clock* const clock_; |
| 144 PacketSender* const packet_sender_; | 147 PacketSender* const packet_sender_; |
| 148 std::unique_ptr<AlrDetector> alr_detector_ GUARDED_BY(critsect_); |
| 145 | 149 |
| 146 std::unique_ptr<CriticalSectionWrapper> critsect_; | 150 std::unique_ptr<CriticalSectionWrapper> critsect_; |
| 147 bool paused_ GUARDED_BY(critsect_); | 151 bool paused_ GUARDED_BY(critsect_); |
| 148 // This is the media budget, keeping track of how many bits of media | 152 // This is the media budget, keeping track of how many bits of media |
| 149 // we can pace out during the current interval. | 153 // we can pace out during the current interval. |
| 150 std::unique_ptr<paced_sender::IntervalBudget> media_budget_ | 154 std::unique_ptr<paced_sender::IntervalBudget> media_budget_ |
| 151 GUARDED_BY(critsect_); | 155 GUARDED_BY(critsect_); |
| 152 // This is the padding budget, keeping track of how many bits of padding we're | 156 // This is the padding budget, keeping track of how many bits of padding we're |
| 153 // allowed to send out during the current interval. This budget will be | 157 // allowed to send out during the current interval. This budget will be |
| 154 // utilized when there's no media to send. | 158 // utilized when there's no media to send. |
| 155 std::unique_ptr<paced_sender::IntervalBudget> padding_budget_ | 159 std::unique_ptr<paced_sender::IntervalBudget> padding_budget_ |
| 156 GUARDED_BY(critsect_); | 160 GUARDED_BY(critsect_); |
| 157 | 161 |
| 158 std::unique_ptr<BitrateProber> prober_ GUARDED_BY(critsect_); | 162 std::unique_ptr<BitrateProber> prober_ GUARDED_BY(critsect_); |
| 159 // Actual configured bitrates (media_budget_ may temporarily be higher in | 163 // Actual configured bitrates (media_budget_ may temporarily be higher in |
| 160 // order to meet pace time constraint). | 164 // order to meet pace time constraint). |
| 161 uint32_t estimated_bitrate_bps_ GUARDED_BY(critsect_); | 165 uint32_t estimated_bitrate_bps_ GUARDED_BY(critsect_); |
| 162 uint32_t min_send_bitrate_kbps_ GUARDED_BY(critsect_); | 166 uint32_t min_send_bitrate_kbps_ GUARDED_BY(critsect_); |
| 163 uint32_t max_padding_bitrate_kbps_ GUARDED_BY(critsect_); | 167 uint32_t max_padding_bitrate_kbps_ GUARDED_BY(critsect_); |
| 164 uint32_t pacing_bitrate_kbps_ GUARDED_BY(critsect_); | 168 uint32_t pacing_bitrate_kbps_ GUARDED_BY(critsect_); |
| 165 | 169 |
| 166 int64_t time_last_update_us_ GUARDED_BY(critsect_); | 170 int64_t time_last_update_us_ GUARDED_BY(critsect_); |
| 167 | 171 |
| 168 std::unique_ptr<paced_sender::PacketQueue> packets_ GUARDED_BY(critsect_); | 172 std::unique_ptr<paced_sender::PacketQueue> packets_ GUARDED_BY(critsect_); |
| 169 uint64_t packet_counter_; | 173 uint64_t packet_counter_; |
| 170 }; | 174 }; |
| 171 } // namespace webrtc | 175 } // namespace webrtc |
| 172 #endif // WEBRTC_MODULES_PACING_PACED_SENDER_H_ | 176 #endif // WEBRTC_MODULES_PACING_PACED_SENDER_H_ |
| OLD | NEW |