Chromium Code Reviews| Index: webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h |
| diff --git a/webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h b/webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h |
| index 6027c42fd24a55806d1da0fc4b40f83e73ff81b7..c2ac9e35efbf9a42ca1cea1cb6da8d94202ef862 100644 |
| --- a/webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h |
| +++ b/webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h |
| @@ -11,6 +11,7 @@ |
| #ifndef WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_H_ |
| #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_H_ |
| +#include <map> |
| #include <memory> |
| #include <vector> |
| @@ -19,6 +20,8 @@ |
| namespace webrtc { |
| +class Clock; |
| + |
| class ControllerManager { |
| public: |
| virtual ~ControllerManager() = default; |
| @@ -33,15 +36,23 @@ class ControllerManager { |
| class ControllerManagerImpl final : public ControllerManager { |
| public: |
| struct Config { |
| - Config(); |
| + Config(int min_reordering_time_ms, |
| + float min_reordering_squared_distance, |
| + const Clock* clock); |
| ~Config(); |
| + int min_reordering_time_ms; |
| + float min_reordering_squared_distance; |
| + const Clock* clock; |
| }; |
| explicit ControllerManagerImpl(const Config& config); |
| // Dependency injection for testing. |
| - ControllerManagerImpl(const Config& config, |
| - std::vector<std::unique_ptr<Controller>> controllers); |
| + ControllerManagerImpl( |
| + const Config& config, |
| + std::vector<std::unique_ptr<Controller>>&& controllers, |
|
minyue-webrtc
2016/09/21 07:42:59
I switched order to 2nd and 3rd args. It reads mor
hlundin-webrtc
2016/09/21 12:39:45
Acknowledged.
|
| + const std::map<const Controller*, std::pair<int, float>>& |
| + chracteristic_points); |
| ~ControllerManagerImpl() override; |
| @@ -52,12 +63,33 @@ class ControllerManagerImpl final : public ControllerManager { |
| std::vector<Controller*> GetControllers() const override; |
| private: |
| + // Scoring point is a subset of NetworkMetrics that is used for comparing the |
| + // significance of controllers. |
| + struct ScoringPoint { |
| + ScoringPoint(int uplink_bandwidth_bps, float uplink_packet_loss_fraction); |
| + |
| + // Calculate the normalized [0,1] distance between two scoring points. |
| + float SquaredDistanceTo(const ScoringPoint& scoring_point) const; |
| + |
| + int uplink_bandwidth_bps; |
| + float uplink_packet_loss_fraction; |
| + }; |
| + |
| const Config config_; |
| std::vector<std::unique_ptr<Controller>> controllers_; |
| + rtc::Optional<int64_t> last_reordering_time_ms_; |
| + ScoringPoint last_scoring_point_; |
| + |
| std::vector<Controller*> default_sorted_controllers_; |
| + std::vector<Controller*> sorted_controllers_; |
| + |
| + // |scoring_points_| saves the characteristic scoring points of various |
| + // controllers. |
| + std::map<const Controller*, ScoringPoint> controller_scoring_points_; |
| + |
| RTC_DISALLOW_COPY_AND_ASSIGN(ControllerManagerImpl); |
| }; |