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/criticalsection.h" |
18 #include "webrtc/base/optional.h" | 19 #include "webrtc/base/optional.h" |
19 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
20 #include "webrtc/modules/include/module.h" | 21 #include "webrtc/modules/include/module.h" |
21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
22 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
23 | 24 |
24 namespace webrtc { | 25 namespace webrtc { |
25 class AlrDetector; | 26 class AlrDetector; |
26 class BitrateProber; | 27 class BitrateProber; |
27 class Clock; | 28 class Clock; |
28 class CriticalSectionWrapper; | |
29 class ProbeClusterCreatedObserver; | 29 class ProbeClusterCreatedObserver; |
30 class RtcEventLog; | 30 class RtcEventLog; |
31 | 31 |
32 namespace paced_sender { | 32 namespace paced_sender { |
33 class IntervalBudget; | 33 class IntervalBudget; |
34 struct Packet; | 34 struct Packet; |
35 class PacketQueue; | 35 class PacketQueue; |
36 } // namespace paced_sender | 36 } // namespace paced_sender |
37 | 37 |
38 class PacedSender : public Module, public RtpPacketSender { | 38 class PacedSender : public Module, public RtpPacketSender { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 bool SendPacket(const paced_sender::Packet& packet, | 155 bool SendPacket(const paced_sender::Packet& packet, |
156 const PacedPacketInfo& cluster_info) | 156 const PacedPacketInfo& cluster_info) |
157 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 157 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
158 size_t SendPadding(size_t padding_needed, const PacedPacketInfo& cluster_info) | 158 size_t SendPadding(size_t padding_needed, const PacedPacketInfo& cluster_info) |
159 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 159 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
160 | 160 |
161 const Clock* const clock_; | 161 const Clock* const clock_; |
162 PacketSender* const packet_sender_; | 162 PacketSender* const packet_sender_; |
163 std::unique_ptr<AlrDetector> alr_detector_ GUARDED_BY(critsect_); | 163 std::unique_ptr<AlrDetector> alr_detector_ GUARDED_BY(critsect_); |
164 | 164 |
165 std::unique_ptr<CriticalSectionWrapper> critsect_; | 165 rtc::CriticalSection critsect_; |
166 bool paused_ GUARDED_BY(critsect_); | 166 bool paused_ GUARDED_BY(critsect_); |
167 // This is the media budget, keeping track of how many bits of media | 167 // This is the media budget, keeping track of how many bits of media |
168 // we can pace out during the current interval. | 168 // we can pace out during the current interval. |
169 std::unique_ptr<paced_sender::IntervalBudget> media_budget_ | 169 std::unique_ptr<paced_sender::IntervalBudget> media_budget_ |
170 GUARDED_BY(critsect_); | 170 GUARDED_BY(critsect_); |
171 // This is the padding budget, keeping track of how many bits of padding we're | 171 // This is the padding budget, keeping track of how many bits of padding we're |
172 // allowed to send out during the current interval. This budget will be | 172 // allowed to send out during the current interval. This budget will be |
173 // utilized when there's no media to send. | 173 // utilized when there's no media to send. |
174 std::unique_ptr<paced_sender::IntervalBudget> padding_budget_ | 174 std::unique_ptr<paced_sender::IntervalBudget> padding_budget_ |
175 GUARDED_BY(critsect_); | 175 GUARDED_BY(critsect_); |
176 | 176 |
177 std::unique_ptr<BitrateProber> prober_ GUARDED_BY(critsect_); | 177 std::unique_ptr<BitrateProber> prober_ GUARDED_BY(critsect_); |
178 bool probing_send_failure_; | 178 bool probing_send_failure_; |
179 // Actual configured bitrates (media_budget_ may temporarily be higher in | 179 // Actual configured bitrates (media_budget_ may temporarily be higher in |
180 // order to meet pace time constraint). | 180 // order to meet pace time constraint). |
181 uint32_t estimated_bitrate_bps_ GUARDED_BY(critsect_); | 181 uint32_t estimated_bitrate_bps_ GUARDED_BY(critsect_); |
182 uint32_t min_send_bitrate_kbps_ GUARDED_BY(critsect_); | 182 uint32_t min_send_bitrate_kbps_ GUARDED_BY(critsect_); |
183 uint32_t max_padding_bitrate_kbps_ GUARDED_BY(critsect_); | 183 uint32_t max_padding_bitrate_kbps_ GUARDED_BY(critsect_); |
184 uint32_t pacing_bitrate_kbps_ GUARDED_BY(critsect_); | 184 uint32_t pacing_bitrate_kbps_ GUARDED_BY(critsect_); |
185 | 185 |
186 int64_t time_last_update_us_ GUARDED_BY(critsect_); | 186 int64_t time_last_update_us_ GUARDED_BY(critsect_); |
187 | 187 |
188 std::unique_ptr<paced_sender::PacketQueue> packets_ GUARDED_BY(critsect_); | 188 std::unique_ptr<paced_sender::PacketQueue> packets_ GUARDED_BY(critsect_); |
189 uint64_t packet_counter_; | 189 uint64_t packet_counter_; |
190 ProcessThread* process_thread_ = nullptr; | 190 ProcessThread* process_thread_ = nullptr; |
191 }; | 191 }; |
192 } // namespace webrtc | 192 } // namespace webrtc |
193 #endif // WEBRTC_MODULES_PACING_PACED_SENDER_H_ | 193 #endif // WEBRTC_MODULES_PACING_PACED_SENDER_H_ |
OLD | NEW |