LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_coding/audio_network_adaptor - audio_network_adaptor_impl.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 48 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include "webrtc/modules/audio_coding/audio_network_adaptor/audio_network_adaptor_impl.h"
      12             : 
      13             : #include <utility>
      14             : 
      15             : namespace webrtc {
      16             : 
      17           0 : AudioNetworkAdaptorImpl::Config::Config()
      18           0 :     : event_log(nullptr), clock(nullptr){};
      19             : 
      20             : AudioNetworkAdaptorImpl::Config::~Config() = default;
      21             : 
      22           0 : AudioNetworkAdaptorImpl::AudioNetworkAdaptorImpl(
      23             :     const Config& config,
      24             :     std::unique_ptr<ControllerManager> controller_manager,
      25           0 :     std::unique_ptr<DebugDumpWriter> debug_dump_writer)
      26             :     : config_(config),
      27           0 :       controller_manager_(std::move(controller_manager)),
      28           0 :       debug_dump_writer_(std::move(debug_dump_writer)) {
      29           0 :   RTC_DCHECK(controller_manager_);
      30           0 : }
      31             : 
      32             : AudioNetworkAdaptorImpl::~AudioNetworkAdaptorImpl() = default;
      33             : 
      34           0 : void AudioNetworkAdaptorImpl::SetUplinkBandwidth(int uplink_bandwidth_bps) {
      35           0 :   last_metrics_.uplink_bandwidth_bps = rtc::Optional<int>(uplink_bandwidth_bps);
      36           0 :   DumpNetworkMetrics();
      37           0 : }
      38             : 
      39           0 : void AudioNetworkAdaptorImpl::SetUplinkPacketLossFraction(
      40             :     float uplink_packet_loss_fraction) {
      41             :   last_metrics_.uplink_packet_loss_fraction =
      42           0 :       rtc::Optional<float>(uplink_packet_loss_fraction);
      43           0 :   DumpNetworkMetrics();
      44           0 : }
      45             : 
      46           0 : void AudioNetworkAdaptorImpl::SetRtt(int rtt_ms) {
      47           0 :   last_metrics_.rtt_ms = rtc::Optional<int>(rtt_ms);
      48           0 :   DumpNetworkMetrics();
      49           0 : }
      50             : 
      51           0 : void AudioNetworkAdaptorImpl::SetTargetAudioBitrate(
      52             :     int target_audio_bitrate_bps) {
      53             :   last_metrics_.target_audio_bitrate_bps =
      54           0 :       rtc::Optional<int>(target_audio_bitrate_bps);
      55           0 :   DumpNetworkMetrics();
      56           0 : }
      57             : 
      58           0 : void AudioNetworkAdaptorImpl::SetOverhead(size_t overhead_bytes_per_packet) {
      59             :   last_metrics_.overhead_bytes_per_packet =
      60           0 :       rtc::Optional<size_t>(overhead_bytes_per_packet);
      61           0 :   DumpNetworkMetrics();
      62           0 : }
      63             : 
      64             : AudioNetworkAdaptor::EncoderRuntimeConfig
      65           0 : AudioNetworkAdaptorImpl::GetEncoderRuntimeConfig() {
      66           0 :   EncoderRuntimeConfig config;
      67           0 :   for (auto& controller :
      68           0 :        controller_manager_->GetSortedControllers(last_metrics_))
      69           0 :     controller->MakeDecision(last_metrics_, &config);
      70             : 
      71             :   // TODO(minyue): Add debug dumping.
      72           0 :   if (debug_dump_writer_)
      73           0 :     debug_dump_writer_->DumpEncoderRuntimeConfig(
      74           0 :         config, config_.clock->TimeInMilliseconds());
      75             : 
      76           0 :   return config;
      77             : }
      78             : 
      79           0 : void AudioNetworkAdaptorImpl::StartDebugDump(FILE* file_handle) {
      80           0 :   debug_dump_writer_ = DebugDumpWriter::Create(file_handle);
      81           0 : }
      82             : 
      83           0 : void AudioNetworkAdaptorImpl::StopDebugDump() {
      84           0 :   debug_dump_writer_.reset(nullptr);
      85           0 : }
      86             : 
      87           0 : void AudioNetworkAdaptorImpl::DumpNetworkMetrics() {
      88           0 :   if (debug_dump_writer_)
      89           0 :     debug_dump_writer_->DumpNetworkMetrics(last_metrics_,
      90           0 :                                            config_.clock->TimeInMilliseconds());
      91           0 : }
      92             : 
      93             : }  // namespace webrtc

Generated by: LCOV version 1.13