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

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

Issue 1411673003: Added protobuf message for loss-based BWE events, and wired it up to the send side bandwidth estima… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 5 years, 1 month 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 17
18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
19 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 19 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
20 20
21 namespace webrtc { 21 namespace webrtc {
22
23 class RtcEventLog;
24
22 class SendSideBandwidthEstimation { 25 class SendSideBandwidthEstimation {
23 public: 26 public:
24 SendSideBandwidthEstimation(); 27 SendSideBandwidthEstimation();
25 virtual ~SendSideBandwidthEstimation(); 28 virtual ~SendSideBandwidthEstimation();
26 29
27 void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const; 30 void CurrentEstimate(int* bitrate, uint8_t* loss, int64_t* rtt) const;
28 31
29 // Call periodically to update estimate. 32 // Call periodically to update estimate.
30 void UpdateEstimate(int64_t now_ms); 33 void UpdateEstimate(int64_t now_ms);
31 34
32 // Call when we receive a RTCP message with TMMBR or REMB. 35 // Call when we receive a RTCP message with TMMBR or REMB.
33 void UpdateReceiverEstimate(int64_t now_ms, uint32_t bandwidth); 36 void UpdateReceiverEstimate(int64_t now_ms, uint32_t bandwidth);
34 37
35 // Call when we receive a RTCP message with a ReceiveBlock. 38 // Call when we receive a RTCP message with a ReceiveBlock.
36 void UpdateReceiverBlock(uint8_t fraction_loss, 39 void UpdateReceiverBlock(uint8_t fraction_loss,
37 int64_t rtt, 40 int64_t rtt,
38 int number_of_packets, 41 int number_of_packets,
39 int64_t now_ms); 42 int64_t now_ms);
40 43
41 void SetSendBitrate(int bitrate); 44 void SetSendBitrate(int bitrate);
42 void SetMinMaxBitrate(int min_bitrate, int max_bitrate); 45 void SetMinMaxBitrate(int min_bitrate, int max_bitrate);
43 int GetMinBitrate() const; 46 int GetMinBitrate() const;
44 47
48 void SetEventLog(RtcEventLog* event_log);
49
45 private: 50 private:
46 enum UmaState { kNoUpdate, kFirstDone, kDone }; 51 enum UmaState { kNoUpdate, kFirstDone, kDone };
47 52
48 bool IsInStartPhase(int64_t now_ms) const; 53 bool IsInStartPhase(int64_t now_ms) const;
49 54
50 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets); 55 void UpdateUmaStats(int64_t now_ms, int64_t rtt, int lost_packets);
51 56
52 // Returns the input bitrate capped to the thresholds defined by the max, 57 // Returns the input bitrate capped to the thresholds defined by the max,
53 // min and incoming bandwidth. 58 // min and incoming bandwidth.
54 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate); 59 uint32_t CapBitrateToThresholds(int64_t now_ms, uint32_t bitrate);
(...skipping 19 matching lines...) Expand all
74 uint8_t last_fraction_loss_; 79 uint8_t last_fraction_loss_;
75 int64_t last_round_trip_time_ms_; 80 int64_t last_round_trip_time_ms_;
76 81
77 uint32_t bwe_incoming_; 82 uint32_t bwe_incoming_;
78 int64_t time_last_decrease_ms_; 83 int64_t time_last_decrease_ms_;
79 int64_t first_report_time_ms_; 84 int64_t first_report_time_ms_;
80 int initially_lost_packets_; 85 int initially_lost_packets_;
81 int bitrate_at_2_seconds_kbps_; 86 int bitrate_at_2_seconds_kbps_;
82 UmaState uma_update_state_; 87 UmaState uma_update_state_;
83 std::vector<bool> rampup_uma_stats_updated_; 88 std::vector<bool> rampup_uma_stats_updated_;
89 RtcEventLog* event_log_;
84 }; 90 };
85 } // namespace webrtc 91 } // namespace webrtc
86 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_ 92 #endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_SIDE_BANDWIDTH_ESTIMATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698