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 MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_CONGESTION_WINDOW_H_
13 #define MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_CONGESTION_WINDOW_H_
14 
15 #include "modules/remote_bitrate_estimator/test/estimators/bbr.h"
16 
17 #include "api/optional.h"
18 
19 namespace webrtc {
20 namespace testing {
21 namespace bwe {
22 class CongestionWindow {
23  public:
24   CongestionWindow();
25   ~CongestionWindow();
26   int GetCongestionWindow(BbrBweSender::Mode mode,
27                           int64_t bandwidth_estimate,
28                           rtc::Optional<int64_t> min_rtt,
29                           float gain);
30   int GetTargetCongestionWindow(int64_t bandwidth_estimate,
31                                 rtc::Optional<int64_t> min_rtt,
32                                 float gain);
33   // Packet sent from sender, meaning it is inflight until we receive it and we
34   // should add packet's size to data_inflight.
35   void PacketSent(size_t sent_packet_size);
36 
37   // Ack was received by sender, meaning packet is no longer inflight.
38   void AckReceived(size_t received_packet_size);
39 
data_inflight()40   size_t data_inflight() { return data_inflight_bytes_; }
41 
42  private:
43   size_t data_inflight_bytes_;
44 };
45 }  // namespace bwe
46 }  // namespace testing
47 }  // namespace webrtc
48 
49 #endif  // MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_ESTIMATORS_CONGESTION_WINDOW_H_
50