Chromium Code Reviews| Index: webrtc/modules/pacing/paced_sender.h |
| diff --git a/webrtc/modules/pacing/paced_sender.h b/webrtc/modules/pacing/paced_sender.h |
| index c904d4b6b77d1db50dcd23a7ba41e921651d5052..0547182755edf1dfc487f82c48c31d9c7d02df77 100644 |
| --- a/webrtc/modules/pacing/paced_sender.h |
| +++ b/webrtc/modules/pacing/paced_sender.h |
| @@ -12,9 +12,11 @@ |
| #define WEBRTC_MODULES_PACING_PACED_SENDER_H_ |
| #include <list> |
| +#include <map> |
| #include <memory> |
| #include <set> |
| +#include "webrtc/base/checks.h" |
| #include "webrtc/base/thread_annotations.h" |
| #include "webrtc/modules/include/module.h" |
| #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| @@ -33,6 +35,13 @@ class PacketQueue; |
| class PacedSender : public Module, public RtpPacketSender { |
| public: |
| + enum class State { |
| + kInit, |
| + kWaitForProbingResult, |
| + kStartupProbing, |
| + kNormal, |
| + }; |
| + |
| class PacketSender { |
| public: |
| // Note: packets sent as a result of a callback should not pass by this |
| @@ -64,7 +73,10 @@ class PacedSender : public Module, public RtpPacketSender { |
| // overshoots from the encoder. |
| static const float kDefaultPaceMultiplier; |
| - static const size_t kMinProbePacketSize = 200; |
| + // TODO(isheriff): Large enough to allow measurements up-to 7 Mbps. |
| + // This requirement will go away when we cluster multiple packets as a single |
| + // probe. |
| + static const size_t kMinProbePacketSize = 1000; |
|
stefan-webrtc
2016/08/16 11:27:04
I'm not sure about introducing this change. It wil
Irfan
2016/08/16 18:12:47
I will go ahead and revert this. Since I plan to a
|
| PacedSender(Clock* clock, |
| PacketSender* packet_sender); |
| @@ -87,7 +99,7 @@ class PacedSender : public Module, public RtpPacketSender { |
| // |bitrate_bps| is our estimate of what we are allowed to send on average. |
| // We will pace out bursts of packets at a bitrate of |
| // |bitrate_bps| * kDefaultPaceMultiplier. |
| - virtual void SetEstimatedBitrate(uint32_t bitrate_bps); |
| + virtual void SetEstimatedBitrate(int bitrate_bps); |
| // Sets the minimum send bitrate and maximum padding bitrate requested by send |
| // streams. |
| @@ -128,6 +140,9 @@ class PacedSender : public Module, public RtpPacketSender { |
| // Process any pending packets in the queue(s). |
| void Process() override; |
| + State PacingState(); |
| + void OnProbingBitrateMeasured(int bitrate_bps); |
| + |
| private: |
| // Updates the number of bytes that can be sent for the next time interval. |
| void UpdateBytesPerInterval(int64_t delta_time_in_ms) |
| @@ -156,15 +171,21 @@ class PacedSender : public Module, public RtpPacketSender { |
| std::unique_ptr<BitrateProber> prober_ GUARDED_BY(critsect_); |
| // Actual configured bitrates (media_budget_ may temporarily be higher in |
| // order to meet pace time constraint). |
| - uint32_t estimated_bitrate_bps_ GUARDED_BY(critsect_); |
| - uint32_t min_send_bitrate_kbps_ GUARDED_BY(critsect_); |
| - uint32_t max_padding_bitrate_kbps_ GUARDED_BY(critsect_); |
| - uint32_t pacing_bitrate_kbps_ GUARDED_BY(critsect_); |
| + int estimated_bitrate_bps_ GUARDED_BY(critsect_); |
| + int min_send_bitrate_kbps_ GUARDED_BY(critsect_); |
| + int max_padding_bitrate_kbps_ GUARDED_BY(critsect_); |
| + int pacing_bitrate_kbps_ GUARDED_BY(critsect_); |
| int64_t time_last_update_us_ GUARDED_BY(critsect_); |
| std::unique_ptr<paced_sender::PacketQueue> packets_ GUARDED_BY(critsect_); |
| uint64_t packet_counter_; |
| + // TODO(isheriff): Adding critsect_ gets clang complaints even with |
| + // critsect_ protection turned on! |
| + State pacing_state_; |
| + int64_t start_time_wait_probe_result_ms_ GUARDED_BY(critsect_); |
| + int min_bitrate_to_probe_further_ GUARDED_BY(critsect_); |
| + int bitrate_below_expected_count_ GUARDED_BY(critsect_) = 0; |
|
stefan-webrtc
2016/08/16 11:27:05
Initialize in initializer list instead.
Irfan
2016/08/16 18:12:47
Will do, but I seem to recall seeing in style this
|
| }; |
| } // namespace webrtc |
| #endif // WEBRTC_MODULES_PACING_PACED_SENDER_H_ |