Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: webrtc/modules/bitrate_controller/send_side_bandwidth_estimation.h

Issue 2110113003: Reland of "Move RtcEventLog object from inside VoiceEngine to Call.", "Fix to make the start/stop f… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 * 9 *
10 * FEC and NACK added bitrate is handled outside class 10 * FEC and NACK added bitrate is handled outside class
11 */ 11 */
12 12
13 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ 13 #ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_
14 #define WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ 14 #define WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_
15 15
16 #include <deque> 16 #include <deque>
17 #include <utility> 17 #include <utility>
18 #include <vector> 18 #include <vector>
19 19
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
22 22
23 namespace webrtc { 23 namespace webrtc {
24 24
25 class RtcEventLog; 25 class RtcEventLog;
26 26
27 class SendSideBandwidthEstimation { 27 class SendSideBandwidthEstimation {
28 public: 28 public:
29 SendSideBandwidthEstimation(); 29 SendSideBandwidthEstimation() = delete;
30 explicit SendSideBandwidthEstimation(RtcEventLog* event_log);
30 virtual ~SendSideBandwidthEstimation(); 31 virtual ~SendSideBandwidthEstimation();
31 32
32 void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const; 33 void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const;
33 34
34 // Call periodically to update estimate. 35 // Call periodically to update estimate.
35 void UpdateEstimate(int64_t now_ms); 36 void UpdateEstimate(int64_t now_ms);
36 37
37 // Call when we receive a RTCP message with TMMBR or REMB. 38 // Call when we receive a RTCP message with TMMBR or REMB.
38 void UpdateReceiverEstimate(int64_t now_ms, uint32_t bandwidth); 39 void UpdateReceiverEstimate(int64_t now_ms, uint32_t bandwidth);
39 40
40 // Call when a new delay-based estimate is available. 41 // Call when a new delay-based estimate is available.
41 void UpdateDelayBasedEstimate(int64_t now_ms, uint32_t bitrate_bps); 42 void UpdateDelayBasedEstimate(int64_t now_ms, uint32_t bitrate_bps);
42 43
43 // Call when we receive a RTCP message with a ReceiveBlock. 44 // Call when we receive a RTCP message with a ReceiveBlock.
44 void UpdateReceiverBlock(uint8_t fraction_loss, 45 void UpdateReceiverBlock(uint8_t fraction_loss,
45 int64_t rtt, 46 int64_t rtt,
46 int number_of_packets, 47 int number_of_packets,
47 int64_t now_ms); 48 int64_t now_ms);
48 49
49 void SetBitrates(int send_bitrate, 50 void SetBitrates(int send_bitrate,
50 int min_bitrate, 51 int min_bitrate,
51 int max_bitrate); 52 int max_bitrate);
52 void SetSendBitrate(int bitrate); 53 void SetSendBitrate(int bitrate);
53 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); 54 void SetMinMaxBitrate(int min_bitrate, int max_bitrate);
54 int GetMinBitrate() const; 55 int GetMinBitrate() const;
55 56
56 void SetEventLog(RtcEventLog* event_log);
57
58 private: 57 private:
59 enum UmaState { kNoUpdate, kFirstDone, kDone }; 58 enum UmaState { kNoUpdate, kFirstDone, kDone };
60 59
61 bool IsInStartPhase(int64_t now_ms) const; 60 bool IsInStartPhase(int64_t now_ms) const;
62 61
63 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); 62 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets);
64 63
65 // Returns the input bitrate capped to the thresholds defined by the max, 64 // Returns the input bitrate capped to the thresholds defined by the max,
66 // min and incoming bandwidth. 65 // min and incoming bandwidth.
67 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate); 66 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate);
(...skipping 24 matching lines...) Expand all
92 int64_t time_last_decrease_ms_; 91 int64_t time_last_decrease_ms_;
93 int64_t first_report_time_ms_; 92 int64_t first_report_time_ms_;
94 int initially_lost_packets_; 93 int initially_lost_packets_;
95 int bitrate_at_2_seconds_kbps_; 94 int bitrate_at_2_seconds_kbps_;
96 UmaState uma_update_state_; 95 UmaState uma_update_state_;
97 std::vector<bool> rampup_uma_stats_updated_; 96 std::vector<bool> rampup_uma_stats_updated_;
98 RtcEventLog* event_log_; 97 RtcEventLog* event_log_;
99 }; 98 };
100 } // namespace webrtc 99 } // namespace webrtc
101 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ 100 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698