Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: webrtc/modules/pacing/paced_sender.h

Issue 2999073002: Tweaked version of BBR for WebRTC. (Closed)
Patch Set: Updated according to comments. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/pacing/BUILD.gn ('k') | webrtc/modules/pacing/paced_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/modules/include/module.h" 18 #include "webrtc/modules/pacing/pacer.h"
19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
20 #include "webrtc/rtc_base/criticalsection.h" 19 #include "webrtc/rtc_base/criticalsection.h"
21 #include "webrtc/rtc_base/optional.h" 20 #include "webrtc/rtc_base/optional.h"
22 #include "webrtc/rtc_base/thread_annotations.h" 21 #include "webrtc/rtc_base/thread_annotations.h"
23 #include "webrtc/typedefs.h" 22 #include "webrtc/typedefs.h"
24 23
25 namespace webrtc { 24 namespace webrtc {
26 class AlrDetector; 25 class AlrDetector;
27 class BitrateProber; 26 class BitrateProber;
28 class Clock; 27 class Clock;
29 class ProbeClusterCreatedObserver; 28 class ProbeClusterCreatedObserver;
30 class RtcEventLog; 29 class RtcEventLog;
31 class IntervalBudget; 30 class IntervalBudget;
32 31
33 namespace paced_sender { 32 namespace paced_sender {
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 Pacer {
39 public: 39 public:
40 class PacketSender { 40 class PacketSender {
41 public: 41 public:
42 // Note: packets sent as a result of a callback should not pass by this 42 // Note: packets sent as a result of a callback should not pass by this
43 // module again. 43 // module again.
44 // Called when it's time to send a queued packet. 44 // Called when it's time to send a queued packet.
45 // Returns false if packet cannot be sent. 45 // Returns false if packet cannot be sent.
46 virtual bool TimeToSendPacket(uint32_t ssrc, 46 virtual bool TimeToSendPacket(uint32_t ssrc,
47 uint16_t sequence_number, 47 uint16_t sequence_number,
48 int64_t capture_time_ms, 48 int64_t capture_time_ms,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Enable bitrate probing. Enabled by default, mostly here to simplify 86 // Enable bitrate probing. Enabled by default, mostly here to simplify
87 // testing. Must be called before any packets are being sent to have an 87 // testing. Must be called before any packets are being sent to have an
88 // effect. 88 // effect.
89 void SetProbingEnabled(bool enabled); 89 void SetProbingEnabled(bool enabled);
90 90
91 // Sets the estimated capacity of the network. Must be called once before 91 // Sets the estimated capacity of the network. Must be called once before
92 // packets can be sent. 92 // packets can be sent.
93 // |bitrate_bps| is our estimate of what we are allowed to send on average. 93 // |bitrate_bps| is our estimate of what we are allowed to send on average.
94 // We will pace out bursts of packets at a bitrate of 94 // We will pace out bursts of packets at a bitrate of
95 // |bitrate_bps| * kDefaultPaceMultiplier. 95 // |bitrate_bps| * kDefaultPaceMultiplier.
96 virtual void SetEstimatedBitrate(uint32_t bitrate_bps); 96 void SetEstimatedBitrate(uint32_t bitrate_bps) override;
97 97
98 // Sets the minimum send bitrate and maximum padding bitrate requested by send 98 // Sets the minimum send bitrate and maximum padding bitrate requested by send
99 // streams. 99 // streams.
100 // |min_send_bitrate_bps| might be higher that the estimated available network 100 // |min_send_bitrate_bps| might be higher that the estimated available network
101 // bitrate and if so, the pacer will send with |min_send_bitrate_bps|. 101 // bitrate and if so, the pacer will send with |min_send_bitrate_bps|.
102 // |max_padding_bitrate_bps| might be higher than the estimate available 102 // |max_padding_bitrate_bps| might be higher than the estimate available
103 // network bitrate and if so, the pacer will send padding packets to reach 103 // network bitrate and if so, the pacer will send padding packets to reach
104 // the min of the estimated available bitrate and |max_padding_bitrate_bps|. 104 // the min of the estimated available bitrate and |max_padding_bitrate_bps|.
105 void SetSendBitrateLimits(int min_send_bitrate_bps, 105 void SetSendBitrateLimits(int min_send_bitrate_bps,
106 int max_padding_bitrate_bps); 106 int max_padding_bitrate_bps);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 // Returns the number of milliseconds until the module want a worker thread 143 // Returns the number of milliseconds until the module want a worker thread
144 // to call Process. 144 // to call Process.
145 int64_t TimeUntilNextProcess() override; 145 int64_t TimeUntilNextProcess() override;
146 146
147 // Process any pending packets in the queue(s). 147 // Process any pending packets in the queue(s).
148 void Process() override; 148 void Process() override;
149 149
150 // Called when the prober is associated with a process thread. 150 // Called when the prober is associated with a process thread.
151 void ProcessThreadAttached(ProcessThread* process_thread) override; 151 void ProcessThreadAttached(ProcessThread* process_thread) override;
152
153 void SetPacingFactor(float pacing_factor); 152 void SetPacingFactor(float pacing_factor);
154 void SetQueueTimeLimit(int limit_ms); 153 void SetQueueTimeLimit(int limit_ms);
155 154
156 private: 155 private:
157 // Updates the number of bytes that can be sent for the next time interval. 156 // Updates the number of bytes that can be sent for the next time interval.
158 void UpdateBudgetWithElapsedTime(int64_t delta_time_in_ms) 157 void UpdateBudgetWithElapsedTime(int64_t delta_time_in_ms)
159 EXCLUSIVE_LOCKS_REQUIRED(critsect_); 158 EXCLUSIVE_LOCKS_REQUIRED(critsect_);
160 void UpdateBudgetWithBytesSent(size_t bytes) 159 void UpdateBudgetWithBytesSent(size_t bytes)
161 EXCLUSIVE_LOCKS_REQUIRED(critsect_); 160 EXCLUSIVE_LOCKS_REQUIRED(critsect_);
162 161
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 193
195 std::unique_ptr<paced_sender::PacketQueue> packets_ GUARDED_BY(critsect_); 194 std::unique_ptr<paced_sender::PacketQueue> packets_ GUARDED_BY(critsect_);
196 uint64_t packet_counter_; 195 uint64_t packet_counter_;
197 ProcessThread* process_thread_ = nullptr; 196 ProcessThread* process_thread_ = nullptr;
198 197
199 float pacing_factor_ GUARDED_BY(critsect_); 198 float pacing_factor_ GUARDED_BY(critsect_);
200 int64_t queue_time_limit GUARDED_BY(critsect_); 199 int64_t queue_time_limit GUARDED_BY(critsect_);
201 }; 200 };
202 } // namespace webrtc 201 } // namespace webrtc
203 #endif // WEBRTC_MODULES_PACING_PACED_SENDER_H_ 202 #endif // WEBRTC_MODULES_PACING_PACED_SENDER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/BUILD.gn ('k') | webrtc/modules/pacing/paced_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698