OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h" | 24 #include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h" |
25 #include "webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h" | 25 #include "webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h" |
26 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 26 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
27 #include "webrtc/modules/remote_bitrate_estimator/inter_arrival.h" | 27 #include "webrtc/modules/remote_bitrate_estimator/inter_arrival.h" |
28 #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" | 28 #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" |
29 #include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" | 29 #include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" |
30 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 30 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
31 | 31 |
32 namespace webrtc { | 32 namespace webrtc { |
33 | 33 |
| 34 class CongestionController; |
| 35 |
34 class DelayBasedBwe : public RemoteBitrateEstimator { | 36 class DelayBasedBwe : public RemoteBitrateEstimator { |
35 public: | 37 public: |
36 DelayBasedBwe(RemoteBitrateObserver* observer, Clock* clock); | 38 DelayBasedBwe(CongestionController* controller, Clock* clock); |
37 virtual ~DelayBasedBwe() {} | 39 virtual ~DelayBasedBwe() {} |
38 | 40 |
39 void IncomingPacketFeedbackVector( | 41 void IncomingPacketFeedbackVector( |
40 const std::vector<PacketInfo>& packet_feedback_vector) override; | 42 const std::vector<PacketInfo>& packet_feedback_vector) override; |
41 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 43 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
42 bool LatestEstimate(std::vector<uint32_t>* ssrcs, | 44 bool LatestEstimate(std::vector<uint32_t>* ssrcs, |
43 int* bitrate_bps) const override; | 45 int* bitrate_bps) const override; |
44 void SetMinBitrate(int min_bitrate_bps) override; | 46 void SetMinBitrate(int min_bitrate_bps) override; |
45 | 47 |
46 // Required by RemoteBitrateEstimator but does nothing. | 48 // Required by RemoteBitrateEstimator but does nothing. |
47 void Process() override; | 49 void Process() override; |
48 // Required by RemoteBitrateEstimator but does nothing. | 50 // Required by RemoteBitrateEstimator but does nothing. |
49 int64_t TimeUntilNextProcess() override; | 51 int64_t TimeUntilNextProcess() override; |
50 // Required by RemoteBitrateEstimator but does nothing. | 52 // Required by RemoteBitrateEstimator but does nothing. |
51 void RemoveStream(uint32_t ssrc) override; | 53 void RemoveStream(uint32_t ssrc) override; |
52 void IncomingPacket(int64_t arrival_time_ms, | 54 void IncomingPacket(int64_t arrival_time_ms, |
53 size_t payload_size, | 55 size_t payload_size, |
54 const RTPHeader& header) override { | 56 const RTPHeader& header) override { |
55 RTC_NOTREACHED(); | 57 RTC_NOTREACHED(); |
56 } | 58 } |
57 | 59 |
58 private: | 60 private: |
59 void IncomingPacketInfo(const PacketInfo& info); | 61 void IncomingPacketInfo(const PacketInfo& info); |
| 62 // Updates the current remote rate estimate and returns true if a valid |
| 63 // estimate exists. |
| 64 bool UpdateEstimate(int64_t packet_arrival_time_ms, |
| 65 int64_t now_ms, |
| 66 int* target_bitrate_bps); |
60 | 67 |
61 rtc::ThreadChecker network_thread_; | 68 rtc::ThreadChecker network_thread_; |
62 Clock* const clock_; | 69 Clock* const clock_; |
63 RemoteBitrateObserver* const observer_; | 70 CongestionController* const controller_; |
64 std::unique_ptr<InterArrival> inter_arrival_; | 71 std::unique_ptr<InterArrival> inter_arrival_; |
65 std::unique_ptr<OveruseEstimator> estimator_; | 72 std::unique_ptr<OveruseEstimator> estimator_; |
66 OveruseDetector detector_; | 73 OveruseDetector detector_; |
67 RateStatistics incoming_bitrate_; | 74 RateStatistics incoming_bitrate_; |
68 int64_t first_packet_time_ms_; | |
69 int64_t last_update_ms_; | 75 int64_t last_update_ms_; |
70 int64_t last_seen_packet_ms_; | 76 int64_t last_seen_packet_ms_; |
71 bool uma_recorded_; | 77 bool uma_recorded_; |
72 | 78 |
73 rtc::CriticalSection crit_; | 79 rtc::CriticalSection crit_; |
74 AimdRateControl remote_rate_ GUARDED_BY(&crit_); | 80 AimdRateControl remote_rate_ GUARDED_BY(&crit_); |
75 ProbeBitrateEstimator probe_bitrate_estimator_ GUARDED_BY(&crit_); | 81 ProbeBitrateEstimator probe_bitrate_estimator_ GUARDED_BY(&crit_); |
76 | 82 |
77 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); | 83 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); |
78 }; | 84 }; |
79 | 85 |
80 } // namespace webrtc | 86 } // namespace webrtc |
81 | 87 |
82 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ | 88 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ |
OLD | NEW |