Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h

Issue 2782563003: Replace Clock with timeutils in AudioEncoder. (Closed)
Patch Set: Fix for failing unittest. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_H_
13 13
14 #include <map> 14 #include <map>
15 #include <memory> 15 #include <memory>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/base/constructormagic.h" 18 #include "webrtc/base/constructormagic.h"
19 #include "webrtc/base/protobuf_utils.h" 19 #include "webrtc/base/protobuf_utils.h"
20 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller.h" 20 #include "webrtc/modules/audio_coding/audio_network_adaptor/controller.h"
21 21
22 namespace webrtc { 22 namespace webrtc {
23 23
24 class Clock;
25
26 class ControllerManager { 24 class ControllerManager {
27 public: 25 public:
28 virtual ~ControllerManager() = default; 26 virtual ~ControllerManager() = default;
29 27
30 // Sort controllers based on their significance. 28 // Sort controllers based on their significance.
31 virtual std::vector<Controller*> GetSortedControllers( 29 virtual std::vector<Controller*> GetSortedControllers(
32 const Controller::NetworkMetrics& metrics) = 0; 30 const Controller::NetworkMetrics& metrics) = 0;
33 31
34 virtual std::vector<Controller*> GetControllers() const = 0; 32 virtual std::vector<Controller*> GetControllers() const = 0;
35 }; 33 };
36 34
37 class ControllerManagerImpl final : public ControllerManager { 35 class ControllerManagerImpl final : public ControllerManager {
38 public: 36 public:
39 struct Config { 37 struct Config {
40 Config(int min_reordering_time_ms, 38 Config(int min_reordering_time_ms, float min_reordering_squared_distance);
41 float min_reordering_squared_distance,
42 const Clock* clock);
43 ~Config(); 39 ~Config();
44 // Least time since last reordering for a new reordering to be made. 40 // Least time since last reordering for a new reordering to be made.
45 int min_reordering_time_ms; 41 int min_reordering_time_ms;
46 // Least squared distance from last scoring point for a new reordering to be 42 // Least squared distance from last scoring point for a new reordering to be
47 // made. 43 // made.
48 float min_reordering_squared_distance; 44 float min_reordering_squared_distance;
49 const Clock* clock;
50 }; 45 };
51 46
52 static std::unique_ptr<ControllerManager> Create( 47 static std::unique_ptr<ControllerManager> Create(
53 const ProtoString& config_string, 48 const ProtoString& config_string,
54 size_t num_encoder_channels, 49 size_t num_encoder_channels,
55 rtc::ArrayView<const int> encoder_frame_lengths_ms, 50 rtc::ArrayView<const int> encoder_frame_lengths_ms,
56 int min_encoder_bitrate_bps, 51 int min_encoder_bitrate_bps,
57 size_t intial_channels_to_encode, 52 size_t intial_channels_to_encode,
58 int initial_frame_length_ms, 53 int initial_frame_length_ms,
59 int initial_bitrate_bps, 54 int initial_bitrate_bps,
60 bool initial_fec_enabled, 55 bool initial_fec_enabled,
61 bool initial_dtx_enabled, 56 bool initial_dtx_enabled);
62 const Clock* clock);
63 57
64 explicit ControllerManagerImpl(const Config& config); 58 explicit ControllerManagerImpl(const Config& config);
65 59
66 // Dependency injection for testing. 60 // Dependency injection for testing.
67 ControllerManagerImpl( 61 ControllerManagerImpl(
68 const Config& config, 62 const Config& config,
69 std::vector<std::unique_ptr<Controller>>&& controllers, 63 std::vector<std::unique_ptr<Controller>>&& controllers,
70 const std::map<const Controller*, std::pair<int, float>>& 64 const std::map<const Controller*, std::pair<int, float>>&
71 chracteristic_points); 65 chracteristic_points);
72 66
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // |scoring_points_| saves the characteristic scoring points of various 100 // |scoring_points_| saves the characteristic scoring points of various
107 // controllers. 101 // controllers.
108 std::map<const Controller*, ScoringPoint> controller_scoring_points_; 102 std::map<const Controller*, ScoringPoint> controller_scoring_points_;
109 103
110 RTC_DISALLOW_COPY_AND_ASSIGN(ControllerManagerImpl); 104 RTC_DISALLOW_COPY_AND_ASSIGN(ControllerManagerImpl);
111 }; 105 };
112 106
113 } // namespace webrtc 107 } // namespace webrtc
114 108
115 #endif // WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_ H_ 109 #endif // WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_CONTROLLER_MANAGER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698