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 |
| 12 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ |
| 13 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ |
| 14 |
| 15 #include <climits> |
| 16 #include <map> |
| 17 #include <memory> |
| 18 #include <utility> |
| 19 #include <vector> |
| 20 |
| 21 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" |
| 22 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" |
| 23 #include "webrtc/modules/remote_bitrate_estimator/test/bwe.h" |
| 24 |
| 25 namespace webrtc { |
| 26 namespace testing { |
| 27 namespace bwe { |
| 28 class MaxBandwidthFilter; |
| 29 class MinRttFilter; |
| 30 class CongestionWindow; |
| 31 class BbrBweSender : public BweSender { |
| 32 public: |
| 33 BbrBweSender(); |
| 34 virtual ~BbrBweSender(); |
| 35 enum Mode { |
| 36 // Startup phase. |
| 37 STARTUP, |
| 38 // Queue draining phase, which where created during startup. |
| 39 DRAIN, |
| 40 // Cruising, probing new bandwidth. |
| 41 PROBE_BW, |
| 42 // Temporarily limiting congestion window size in order to measure |
| 43 // minimum RTT. |
| 44 PROBE_RTT |
| 45 }; |
| 46 struct PacketStats { |
| 47 PacketStats() {} |
| 48 PacketStats(int64_t send_time_, size_t payload_size_) |
| 49 : send_time(send_time_), payload_size(payload_size_) {} |
| 50 |
| 51 int64_t send_time; |
| 52 size_t payload_size; |
| 53 }; |
| 54 void OnPacketsSent(const Packets& packets) override; |
| 55 int GetFeedbackIntervalMs() const override; |
| 56 void GiveFeedback(const FeedbackPacket& feedback) override; |
| 57 int64_t TimeUntilNextProcess() override; |
| 58 void Process() override; |
| 59 |
| 60 private: |
| 61 void EnterStartup(); |
| 62 bool UpdateBandwidthAndMinRtt(); |
| 63 void TryExitingStartup(); |
| 64 void TryExitingDrain(int64_t now); |
| 65 void EnterProbeBw(int64_t now); |
| 66 void EnterProbeRtt(int64_t now); |
| 67 void TryExitingProbeRtt(int64_t now); |
| 68 void TryUpdatingCyclePhase(int64_t now); |
| 69 }; |
| 70 |
| 71 class BbrBweReceiver : public BweReceiver { |
| 72 public: |
| 73 explicit BbrBweReceiver(int flow_id); |
| 74 virtual ~BbrBweReceiver(); |
| 75 void ReceivePacket(int64_t arrival_time_ms, |
| 76 const MediaPacket& media_packet) override; |
| 77 FeedbackPacket* GetFeedback(int64_t now_ms) override; |
| 78 |
| 79 private: |
| 80 SimulatedClock clock_; |
| 81 std::vector<std::pair<uint64_t, int64_t>> packet_feedbacks_; |
| 82 }; |
| 83 } // namespace bwe |
| 84 } // namespace testing |
| 85 } // namespace webrtc |
| 86 |
| 87 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ |
OLD | NEW |