OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BBR_PACED_SENDER_H_ |
| 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BBR_PACED_SENDER_H_ |
| 13 |
| 14 #include <list> |
| 15 #include <memory> |
| 16 |
| 17 #include "webrtc/modules/pacing/paced_sender.h" |
| 18 #include "webrtc/modules/pacing/pacer.h" |
| 19 |
| 20 namespace webrtc { |
| 21 namespace testing { |
| 22 namespace bwe { |
| 23 class CongestionWindow; |
| 24 } |
| 25 } // namespace testing |
| 26 |
| 27 struct Packet { |
| 28 Packet(RtpPacketSender::Priority priority, |
| 29 uint32_t ssrc, |
| 30 uint16_t seq_number, |
| 31 int64_t capture_time_ms, |
| 32 int64_t enqueue_time_ms, |
| 33 size_t size_in_bytes, |
| 34 bool retransmission) |
| 35 : priority(priority), |
| 36 ssrc(ssrc), |
| 37 sequence_number(seq_number), |
| 38 capture_time_ms(capture_time_ms), |
| 39 enqueue_time_ms(enqueue_time_ms), |
| 40 size_in_bytes(size_in_bytes), |
| 41 retransmission(retransmission) {} |
| 42 RtpPacketSender::Priority priority; |
| 43 uint32_t ssrc; |
| 44 uint16_t sequence_number; |
| 45 int64_t capture_time_ms; |
| 46 int64_t enqueue_time_ms; |
| 47 size_t size_in_bytes; |
| 48 bool retransmission; |
| 49 }; |
| 50 |
| 51 class Clock; |
| 52 class RtcEventLog; |
| 53 struct Packet; |
| 54 class BbrPacedSender : public Pacer { |
| 55 public: |
| 56 BbrPacedSender(const Clock* clock, |
| 57 PacedSender::PacketSender* packet_sender, |
| 58 RtcEventLog* event_log); |
| 59 ~BbrPacedSender() override; |
| 60 void SetEstimatedBitrateAndCongestionWindow( |
| 61 uint32_t bitrate_bps, |
| 62 bool in_probe_rtt, |
| 63 uint64_t congestion_window) override; |
| 64 void SetMinBitrate(int min_send_bitrate_bps); |
| 65 void InsertPacket(RtpPacketSender::Priority priority, |
| 66 uint32_t ssrc, |
| 67 uint16_t sequence_number, |
| 68 int64_t capture_time_ms, |
| 69 size_t bytes, |
| 70 bool retransmission) override; |
| 71 int64_t TimeUntilNextProcess() override; |
| 72 void OnBytesAcked(size_t bytes) override; |
| 73 void Process() override; |
| 74 bool TryToSendPacket(Packet* packet); |
| 75 |
| 76 private: |
| 77 const Clock* const clock_; |
| 78 PacedSender::PacketSender* const packet_sender_; |
| 79 uint32_t estimated_bitrate_bps_; |
| 80 uint32_t min_send_bitrate_kbps_; |
| 81 uint32_t pacing_bitrate_kbps_; |
| 82 int64_t time_last_update_us_; |
| 83 int64_t time_last_update_ms_; |
| 84 int64_t next_packet_send_time_; |
| 85 float rounding_error_time_ms_; |
| 86 std::list<Packet*> packets_; |
| 87 // TODO(gnish): integrate |max_data_inflight| into congestion window class. |
| 88 size_t max_data_inflight_bytes_; |
| 89 std::unique_ptr<testing::bwe::CongestionWindow> congestion_window_; |
| 90 }; |
| 91 } // namespace webrtc |
| 92 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BBR_PACED_SENDER_H_ |
OLD | NEW |