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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 void CheckDecision(ChannelController* controller, | 34 void CheckDecision(ChannelController* controller, |
35 const rtc::Optional<int>& uplink_bandwidth_bps, | 35 const rtc::Optional<int>& uplink_bandwidth_bps, |
36 size_t expected_num_channels) { | 36 size_t expected_num_channels) { |
37 if (uplink_bandwidth_bps) { | 37 if (uplink_bandwidth_bps) { |
38 Controller::NetworkMetrics network_metrics; | 38 Controller::NetworkMetrics network_metrics; |
39 network_metrics.uplink_bandwidth_bps = uplink_bandwidth_bps; | 39 network_metrics.uplink_bandwidth_bps = uplink_bandwidth_bps; |
40 controller->UpdateNetworkMetrics(network_metrics); | 40 controller->UpdateNetworkMetrics(network_metrics); |
41 } | 41 } |
42 AudioNetworkAdaptor::EncoderRuntimeConfig config; | 42 AudioEncoderRuntimeConfig config; |
43 controller->MakeDecision(&config); | 43 controller->MakeDecision(&config); |
44 EXPECT_EQ(rtc::Optional<size_t>(expected_num_channels), config.num_channels); | 44 EXPECT_EQ(rtc::Optional<size_t>(expected_num_channels), config.num_channels); |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 TEST(ChannelControllerTest, OutputInitValueWhenUplinkBandwidthUnknown) { | 49 TEST(ChannelControllerTest, OutputInitValueWhenUplinkBandwidthUnknown) { |
50 constexpr int kInitChannels = 2; | 50 constexpr int kInitChannels = 2; |
51 auto controller = CreateChannelController(kInitChannels); | 51 auto controller = CreateChannelController(kInitChannels); |
52 CheckDecision(controller.get(), rtc::Optional<int>(), kInitChannels); | 52 CheckDecision(controller.get(), rtc::Optional<int>(), kInitChannels); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 // Use between-thresholds bandwidth to check output remains at 2. | 96 // Use between-thresholds bandwidth to check output remains at 2. |
97 CheckDecision(controller.get(), rtc::Optional<int>(kMediumBandwidthBps), 2); | 97 CheckDecision(controller.get(), rtc::Optional<int>(kMediumBandwidthBps), 2); |
98 | 98 |
99 // Use low bandwidth to check output switch to 1. | 99 // Use low bandwidth to check output switch to 1. |
100 CheckDecision(controller.get(), rtc::Optional<int>(kChannel2To1BandwidthBps), | 100 CheckDecision(controller.get(), rtc::Optional<int>(kChannel2To1BandwidthBps), |
101 1); | 101 1); |
102 } | 102 } |
103 | 103 |
104 } // namespace webrtc | 104 } // namespace webrtc |
OLD | NEW |