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 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/stats.h" | |
stefan-webrtc
2017/05/30 09:45:13
Do we have to include this here, or can we forward
gnish2
2017/05/30 15:13:21
Done.
| |
25 | |
26 namespace webrtc { | |
27 namespace testing { | |
28 namespace bwe { | |
29 | |
30 class BbrBweSender : public BweSender { | |
31 public: | |
32 BbrBweSender(int kbps, BitrateObserver* observer, Clock* clock); | |
33 virtual ~BbrBweSender(); | |
34 | |
35 enum Mode { | |
36 // Startup phase. | |
37 STARTUP, | |
38 // Queue draining phase,which where created during startup. | |
39 DRAIN, | |
40 // Cruising. | |
41 PROBE_BW, | |
42 // Temporarily decreasing throughtput in order to measure | |
43 // minimum RTT. | |
44 PROBE_RTT | |
45 }; | |
46 | |
47 void OnPacketsSent(const Packets& packets) override; | |
stefan-webrtc
2017/05/30 09:45:14
Please group overrides and non-overrides separatel
gnish2
2017/05/30 15:13:21
Done.
| |
48 void EnterStartup(); | |
philipel
2017/05/30 09:43:38
All functions that you expect to only be used by t
gnish2
2017/05/30 15:13:21
Done.
| |
49 void EnterDrain(const FeedbackPacket& feedback); | |
50 void EnterCruise(const FeedbackPacket& feedback); | |
51 void EnterDecreasingThroughput(const FeedbackPacket& feedback); | |
52 bool UpdateBandwidthAndMinRtt( | |
53 int64_t now, | |
54 const std::vector<std::pair<uint64_t, int64_t>>& feedback_vector, | |
55 int64_t bytes_acked); | |
56 void TryExitingStartup(); | |
57 void TryExitingDrain(int64_t now); | |
58 void EnterProbeBw(int64_t now); | |
59 void EnterProbeRtt(int64_t now); | |
60 void TryExitingProbeRtt(int64_t now); | |
61 void TryUpdatingCyclePhase(int64_t now); | |
62 int GetPacketSize(const uint64_t sequence_number); | |
stefan-webrtc
2017/05/30 09:45:14
No need for const for pass-by-value parameters.
S
gnish2
2017/05/30 15:13:21
Done.
| |
63 int GetFeedbackIntervalMs() const override; | |
stefan-webrtc
2017/05/30 09:45:14
Return int64_t which is typically used for time.
gnish2
2017/05/30 15:13:21
This is overrode function,which's return type in s
| |
64 void GiveFeedback(const FeedbackPacket& feedback) override; | |
65 | |
66 int64_t TimeUntilNextProcess() override; | |
67 void Process() override; | |
68 | |
69 private: | |
70 Clock* const clock_; | |
71 BitrateObserver* const observer_; | |
72 int64_t last_feedback_ms_ = 0; | |
stefan-webrtc
2017/05/30 09:45:13
Please initialize in initializer list.
gnish2
2017/05/30 15:13:21
Done.
| |
73 std::map<uint16_t, int64_t> send_time_; | |
stefan-webrtc
2017/05/30 09:45:14
Map from what to what? Add a comment above.
gnish2
2017/05/30 15:13:21
Done.
| |
74 Mode mode_; | |
75 ConnectionState* stats_; | |
76 uint64_t round_trip_end_; | |
77 int64_t rt_count_; | |
stefan-webrtc
2017/05/30 09:45:13
rtt_count_?
gnish2
2017/05/30 15:13:21
Done.
| |
78 int64_t last_packet_sent_; | |
79 }; | |
80 | |
81 class BbrBweReceiver : public BweReceiver { | |
82 public: | |
83 explicit BbrBweReceiver(int flow_id); | |
84 virtual ~BbrBweReceiver(); | |
85 void ReceivePacket(int64_t arrival_time_ms, | |
86 const MediaPacket& media_packet) override; | |
87 FeedbackPacket* GetFeedback(int64_t now_ms) override; | |
88 static const int64_t kReceivingRateTimeWindowMs; | |
89 int64_t last_feedback_ms_; | |
stefan-webrtc
2017/05/30 09:45:14
private?
gnish2
2017/05/30 15:13:21
Done.
| |
90 | |
91 private: | |
92 SimulatedClock clock_; | |
93 std::vector<std::pair<uint64_t, int64_t>> packet_feedbacks_; | |
94 }; | |
95 } // namespace bwe | |
96 } // namespace testing | |
97 } // namespace webrtc | |
98 | |
99 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_BBR_H_ | |
OLD | NEW |