Chromium Code Reviews| 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 |
| 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ | 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ | 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 #include <map> | 15 #include <map> |
| 16 #include <memory> | 16 #include <memory> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
| 21 #include "webrtc/base/criticalsection.h" | 21 #include "webrtc/base/criticalsection.h" |
| 22 #include "webrtc/base/rate_statistics.h" | 22 #include "webrtc/base/rate_statistics.h" |
| 23 #include "webrtc/base/thread_checker.h" | 23 #include "webrtc/base/thread_checker.h" |
| 24 #include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h" | 24 #include "webrtc/modules/congestion_controller/probe_bitrate_estimator.h" |
| 25 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | |
|
danilchap
2016/08/19 17:19:34
prefer forward declaration over including header w
Irfan
2016/08/23 05:46:57
Done
| |
| 25 #include "webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h" | 26 #include "webrtc/modules/remote_bitrate_estimator/aimd_rate_control.h" |
| 26 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" | 27 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" |
| 27 #include "webrtc/modules/remote_bitrate_estimator/inter_arrival.h" | 28 #include "webrtc/modules/remote_bitrate_estimator/inter_arrival.h" |
| 28 #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" | 29 #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" |
| 29 #include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" | 30 #include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" |
| 30 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 31 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 31 | 32 |
| 32 namespace webrtc { | 33 namespace webrtc { |
| 33 | 34 |
| 34 class DelayBasedBwe : public RemoteBitrateEstimator { | 35 class DelayBasedBwe : public RemoteBitrateEstimator { |
| 35 public: | 36 public: |
| 36 DelayBasedBwe(RemoteBitrateObserver* observer, Clock* clock); | 37 DelayBasedBwe(CongestionController* controller, Clock* clock); |
| 37 virtual ~DelayBasedBwe() {} | 38 virtual ~DelayBasedBwe() {} |
| 38 | 39 |
| 39 void IncomingPacketFeedbackVector( | 40 void IncomingPacketFeedbackVector( |
| 40 const std::vector<PacketInfo>& packet_feedback_vector) override; | 41 const std::vector<PacketInfo>& packet_feedback_vector) override; |
| 41 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 42 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
| 42 bool LatestEstimate(std::vector<uint32_t>* ssrcs, | 43 bool LatestEstimate(std::vector<uint32_t>* ssrcs, |
| 43 uint32_t* bitrate_bps) const override; | 44 uint32_t* bitrate_bps) const override; |
| 44 void SetMinBitrate(int min_bitrate_bps) override; | 45 void SetMinBitrate(int min_bitrate_bps) override; |
| 45 | 46 |
| 46 // Required by RemoteBitrateEstimator but does nothing. | 47 // Required by RemoteBitrateEstimator but does nothing. |
| 47 void Process() override; | 48 void Process() override; |
| 48 // Required by RemoteBitrateEstimator but does nothing. | 49 // Required by RemoteBitrateEstimator but does nothing. |
| 49 int64_t TimeUntilNextProcess() override; | 50 int64_t TimeUntilNextProcess() override; |
| 50 // Required by RemoteBitrateEstimator but does nothing. | 51 // Required by RemoteBitrateEstimator but does nothing. |
| 51 void RemoveStream(uint32_t ssrc) override; | 52 void RemoveStream(uint32_t ssrc) override; |
| 52 void IncomingPacket(int64_t arrival_time_ms, | 53 void IncomingPacket(int64_t arrival_time_ms, |
| 53 size_t payload_size, | 54 size_t payload_size, |
| 54 const RTPHeader& header) override { | 55 const RTPHeader& header) override { |
| 55 RTC_NOTREACHED(); | 56 RTC_NOTREACHED(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 void IncomingPacketInfo(const PacketInfo& info); | 60 void IncomingPacketInfo(const PacketInfo& info); |
| 61 // Updates the current remote rate estimate and returns true if a valid | |
| 62 // estimate exists. | |
| 63 bool UpdateEstimate(int64_t packet_arrival_time_ms, | |
| 64 int64_t now_ms, | |
| 65 int* target_bitrate_bps); | |
| 60 | 66 |
| 61 rtc::ThreadChecker network_thread_; | 67 rtc::ThreadChecker network_thread_; |
| 62 Clock* const clock_; | 68 Clock* const clock_; |
| 63 RemoteBitrateObserver* const observer_; | 69 CongestionController* const controller_; |
| 64 std::unique_ptr<InterArrival> inter_arrival_; | 70 std::unique_ptr<InterArrival> inter_arrival_; |
| 65 std::unique_ptr<OveruseEstimator> estimator_; | 71 std::unique_ptr<OveruseEstimator> estimator_; |
| 66 OveruseDetector detector_; | 72 OveruseDetector detector_; |
| 67 RateStatistics incoming_bitrate_; | 73 RateStatistics incoming_bitrate_; |
| 68 int64_t first_packet_time_ms_; | |
| 69 int64_t last_update_ms_; | 74 int64_t last_update_ms_; |
| 70 int64_t last_seen_packet_ms_; | 75 int64_t last_seen_packet_ms_; |
| 71 bool uma_recorded_; | 76 bool uma_recorded_; |
| 72 | 77 |
| 73 rtc::CriticalSection crit_; | 78 rtc::CriticalSection crit_; |
| 74 AimdRateControl remote_rate_ GUARDED_BY(&crit_); | 79 AimdRateControl remote_rate_ GUARDED_BY(&crit_); |
| 75 ProbeBitrateEstimator probe_bitrate_estimator_ GUARDED_BY(&crit_); | 80 ProbeBitrateEstimator probe_bitrate_estimator_ GUARDED_BY(&crit_); |
| 76 | 81 |
| 77 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); | 82 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DelayBasedBwe); |
| 78 }; | 83 }; |
| 79 | 84 |
| 80 } // namespace webrtc | 85 } // namespace webrtc |
| 81 | 86 |
| 82 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ | 87 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_DELAY_BASED_BWE_H_ |
| OLD | NEW |