Chromium Code Reviews| Index: webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc |
| diff --git a/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc b/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..32fb4fc7d8bca86d88fc92a128a6b13cb365365c |
| --- /dev/null |
| +++ b/webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.cc |
| @@ -0,0 +1,78 @@ |
| +/* |
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#include <utility> |
| + |
| +#include "webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.h" |
|
kwiberg-webrtc
2016/09/09 11:56:15
[insert bleeding-eyes emoji here]
minyue-webrtc
2016/09/12 11:36:11
sorry for the long line, but what should I better
kwiberg-webrtc
2016/09/12 13:33:50
The only thing you can do is make the file and dir
|
| + |
| +namespace webrtc { |
| + |
| +AudioNetworkAdaptorImpl::Config::Config() = default; |
| + |
| +AudioNetworkAdaptorImpl::Config::~Config() = default; |
| + |
| +AudioNetworkAdaptorImpl::AudioNetworkAdaptorImpl(const Config& config) |
| + : config_(config), |
| + controller_manager_( |
| + new ControllerManager(config_.controller_manager_config)) {} |
|
kwiberg-webrtc
2016/09/13 11:11:42
I think you still declare this constructor in the
minyue-webrtc
2016/09/13 11:48:50
oh, my bad, how could I have missed this change.
|
| + |
| +AudioNetworkAdaptorImpl::AudioNetworkAdaptorImpl( |
| + const Config& config, |
| + std::unique_ptr<ControllerManager> controller_manager) |
| + : config_(config), controller_manager_(std::move(controller_manager)) { |
| + RTC_DCHECK(controller_manager_); |
| +} |
|
kwiberg-webrtc
2016/09/09 11:56:15
Would it be a huge burden on a lot of callers to h
minyue-webrtc
2016/09/12 11:36:11
removed AudioNetworkAdaptorImpl(const Config& conf
kwiberg-webrtc
2016/09/12 13:33:50
Excellent!
|
| + |
| +AudioNetworkAdaptorImpl::~AudioNetworkAdaptorImpl() = default; |
| + |
| +void AudioNetworkAdaptorImpl::SetUplinkBandwidth(int uplink_bandwidth_bps) { |
| + last_metrics_.uplink_bandwidth_bps = rtc::Optional<int>(uplink_bandwidth_bps); |
| + |
| + // TODO(minyue): Add debug dumping. |
| +} |
| + |
| +void AudioNetworkAdaptorImpl::SetUplinkPacketLossFraction( |
| + float uplink_packet_loss_fraction) { |
| + last_metrics_.uplink_packet_loss_fraction = |
| + rtc::Optional<float>(uplink_packet_loss_fraction); |
| + |
| + // TODO(minyue): Add debug dumping. |
| +} |
| + |
| +AudioNetworkAdaptor::EncoderRuntimeConfig |
| +AudioNetworkAdaptorImpl::GetEncoderRuntimeConfig() { |
| + EncoderRuntimeConfig config; |
| + auto controllers = controller_manager_->GetSortedControllers(last_metrics_); |
| + for (auto& controller : controllers) |
|
kwiberg-webrtc
2016/09/09 11:56:15
Do you have to store the controllers in a temporar
minyue-webrtc
2016/09/12 11:36:11
Good point. I think I can make it cleaner. See new
kwiberg-webrtc
2016/09/12 13:33:50
Yes, that was exactly what I was thinking.
|
| + controller->MakeDecision(last_metrics_, &config); |
| + |
| + // TODO(minyue): Add debug dumping. |
| + |
| + return config; |
| +} |
| + |
| +void AudioNetworkAdaptorImpl::SetReceiverFrameLengthRange( |
| + int min_frame_length_ms, |
| + int max_frame_length_ms) { |
| + Controller::Constraints constraints; |
| + constraints.receiver_frame_length_range = |
| + rtc::Optional<Controller::Constraints::FrameLengthRange>( |
| + Controller::Constraints::FrameLengthRange(min_frame_length_ms, |
| + max_frame_length_ms)); |
| + auto controllers = controller_manager_->GetControllers(); |
| + for (auto& controller : controllers) |
| + controller->SetConstraints(constraints); |
| +} |
| + |
| +void AudioNetworkAdaptorImpl::StartDebugDump(FILE* file_handle) { |
| + // TODO(minyue): Implement this method. |
| +} |
| + |
| +} // namespace webrtc |