OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_H_ |
| 13 |
| 14 #include <memory> |
| 15 #include <vector> |
| 16 |
| 17 #include "webrtc/base/constructormagic.h" |
| 18 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller.h" |
| 19 |
| 20 namespace webrtc { |
| 21 |
| 22 class ControllerManager { |
| 23 public: |
| 24 virtual ~ControllerManager() = default; |
| 25 |
| 26 // Sort controllers based on their significance. |
| 27 virtual std::vector<Controller*> GetSortedControllers( |
| 28 const Controller::NetworkMetrics& metrics) = 0; |
| 29 |
| 30 virtual std::vector<Controller*> GetControllers() const = 0; |
| 31 }; |
| 32 |
| 33 class ControllerManagerImpl final : public ControllerManager { |
| 34 public: |
| 35 struct Config { |
| 36 Config(); |
| 37 ~Config(); |
| 38 }; |
| 39 |
| 40 explicit ControllerManagerImpl(const Config& config); |
| 41 |
| 42 // Dependency injection for testing. |
| 43 ControllerManagerImpl(const Config& config, |
| 44 std::vector<std::unique_ptr<Controller>> controllers); |
| 45 |
| 46 ~ControllerManagerImpl() override; |
| 47 |
| 48 // Sort controllers based on their significance. |
| 49 std::vector<Controller*> GetSortedControllers( |
| 50 const Controller::NetworkMetrics& metrics) override; |
| 51 |
| 52 std::vector<Controller*> GetControllers() const override; |
| 53 |
| 54 private: |
| 55 const Config config_; |
| 56 |
| 57 std::vector<std::unique_ptr<Controller>> controllers_; |
| 58 |
| 59 std::vector<Controller*> default_sorted_controllers_; |
| 60 |
| 61 RTC_DISALLOW_COPY_AND_ASSIGN(ControllerManagerImpl); |
| 62 }; |
| 63 |
| 64 } // namespace webrtc |
| 65 |
| 66 #endif // WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_
H_ |
OLD | NEW |