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