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 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 ChannelController::~ChannelController() = default; | 36 ChannelController::~ChannelController() = default; |
37 | 37 |
38 void ChannelController::UpdateNetworkMetrics( | 38 void ChannelController::UpdateNetworkMetrics( |
39 const NetworkMetrics& network_metrics) { | 39 const NetworkMetrics& network_metrics) { |
40 if (network_metrics.uplink_bandwidth_bps) | 40 if (network_metrics.uplink_bandwidth_bps) |
41 uplink_bandwidth_bps_ = network_metrics.uplink_bandwidth_bps; | 41 uplink_bandwidth_bps_ = network_metrics.uplink_bandwidth_bps; |
42 } | 42 } |
43 | 43 |
44 void ChannelController::MakeDecision( | 44 void ChannelController::MakeDecision(AudioEncoderRuntimeConfig* config) { |
45 AudioNetworkAdaptor::EncoderRuntimeConfig* config) { | |
46 // Decision on |num_channels| should not have been made. | 45 // Decision on |num_channels| should not have been made. |
47 RTC_DCHECK(!config->num_channels); | 46 RTC_DCHECK(!config->num_channels); |
48 | 47 |
49 if (uplink_bandwidth_bps_) { | 48 if (uplink_bandwidth_bps_) { |
50 if (channels_to_encode_ == 2 && | 49 if (channels_to_encode_ == 2 && |
51 *uplink_bandwidth_bps_ <= config_.channel_2_to_1_bandwidth_bps) { | 50 *uplink_bandwidth_bps_ <= config_.channel_2_to_1_bandwidth_bps) { |
52 channels_to_encode_ = 1; | 51 channels_to_encode_ = 1; |
53 } else if (channels_to_encode_ == 1 && | 52 } else if (channels_to_encode_ == 1 && |
54 *uplink_bandwidth_bps_ >= config_.channel_1_to_2_bandwidth_bps) { | 53 *uplink_bandwidth_bps_ >= config_.channel_1_to_2_bandwidth_bps) { |
55 channels_to_encode_ = | 54 channels_to_encode_ = |
56 std::min(static_cast<size_t>(2), config_.num_encoder_channels); | 55 std::min(static_cast<size_t>(2), config_.num_encoder_channels); |
57 } | 56 } |
58 } | 57 } |
59 config->num_channels = rtc::Optional<size_t>(channels_to_encode_); | 58 config->num_channels = rtc::Optional<size_t>(channels_to_encode_); |
60 } | 59 } |
61 | 60 |
62 } // namespace webrtc | 61 } // namespace webrtc |
OLD | NEW |