| 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_PROBE_CONTROLLER_H_ | 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_CONTROLLER_H_ |
| 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_CONTROLLER_H_ | 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_CONTROLLER_H_ |
| 13 | 13 |
| 14 #include <initializer_list> | 14 #include <initializer_list> |
| 15 | 15 |
| 16 #include "webrtc/base/criticalsection.h" | 16 #include "webrtc/base/criticalsection.h" |
| 17 #include "webrtc/common_types.h" | 17 #include "webrtc/common_types.h" |
| 18 #include "webrtc/modules/pacing/paced_sender.h" | 18 #include "webrtc/modules/pacing/paced_sender.h" |
| 19 | 19 |
| 20 namespace rtc { |
| 21 struct NetworkRoute; |
| 22 } |
| 23 |
| 20 namespace webrtc { | 24 namespace webrtc { |
| 21 | 25 |
| 22 class Clock; | 26 class Clock; |
| 23 | 27 |
| 24 // This class controls initiation of probing to estimate initial channel | 28 // This class controls initiation of probing to estimate initial channel |
| 25 // capacity. There is also support for probing during a session when max | 29 // capacity. There is also support for probing during a session when max |
| 26 // bitrate is adjusted by an application. | 30 // bitrate is adjusted by an application. |
| 27 class ProbeController { | 31 class ProbeController { |
| 28 public: | 32 public: |
| 29 ProbeController(PacedSender* pacer, Clock* clock); | 33 ProbeController(PacedSender* pacer, Clock* clock); |
| 30 | 34 |
| 31 void SetBitrates(int min_bitrate_bps, | 35 void SetBitrates(int start_bitrate_bps, |
| 32 int start_bitrate_bps, | 36 int min_bitrate_bps, |
| 33 int max_bitrate_bps); | 37 int max_bitrate_bps); |
| 38 |
| 39 void OnNetworkRouteChanged(const rtc::NetworkRoute& route); |
| 40 |
| 34 void SetEstimatedBitrate(int bitrate_bps); | 41 void SetEstimatedBitrate(int bitrate_bps); |
| 35 | 42 |
| 36 private: | 43 private: |
| 37 void InitiateProbing(std::initializer_list<int> bitrates_to_probe, | 44 void InitiateProbing(std::initializer_list<int> bitrates_to_probe, |
| 38 int min_bitrate_to_probe_further_bps) | 45 int min_bitrate_to_probe_further_bps) |
| 39 EXCLUSIVE_LOCKS_REQUIRED(critsect_); | 46 EXCLUSIVE_LOCKS_REQUIRED(critsect_); |
| 40 enum class State { | 47 enum class State { |
| 41 // Initial state where no probing has been triggered yet. | 48 // Initial state where no probing has been triggered yet. |
| 42 kInit, | 49 kInit, |
| 43 // Waiting for probing results to continue further probing. | 50 // Waiting for probing results to continue further probing. |
| 44 kWaitingForProbingResult, | 51 kWaitingForProbingResult, |
| 45 // Probing is complete. | 52 // Probing is complete. |
| 46 kProbingComplete, | 53 kProbingComplete, |
| 47 }; | 54 }; |
| 48 rtc::CriticalSection critsect_; | 55 rtc::CriticalSection critsect_; |
| 49 PacedSender* const pacer_; | 56 PacedSender* const pacer_; |
| 50 Clock* const clock_; | 57 Clock* const clock_; |
| 51 State state_ GUARDED_BY(critsect_); | 58 State state_ GUARDED_BY(critsect_); |
| 52 int min_bitrate_to_probe_further_bps_ GUARDED_BY(critsect_); | 59 int min_bitrate_to_probe_further_bps_ GUARDED_BY(critsect_); |
| 53 int64_t time_last_probing_initiated_ms_ GUARDED_BY(critsect_); | 60 int64_t time_last_probing_initiated_ms_ GUARDED_BY(critsect_); |
| 54 int estimated_bitrate_bps_ GUARDED_BY(critsect_); | 61 int estimated_bitrate_bps_ GUARDED_BY(critsect_); |
| 62 int start_bitrate_bps_ GUARDED_BY(critsect_); |
| 55 int max_bitrate_bps_ GUARDED_BY(critsect_); | 63 int max_bitrate_bps_ GUARDED_BY(critsect_); |
| 56 int64_t last_alr_probing_time_ GUARDED_BY(critsect_); | 64 int64_t last_alr_probing_time_ GUARDED_BY(critsect_); |
| 57 | 65 |
| 58 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ProbeController); | 66 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ProbeController); |
| 59 }; | 67 }; |
| 60 | 68 |
| 61 } // namespace webrtc | 69 } // namespace webrtc |
| 62 | 70 |
| 63 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_CONTROLLER_H_ | 71 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_PROBE_CONTROLLER_H_ |
| OLD | NEW |