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

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2012 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/voice_engine/shared_data.h"
      12             : 
      13             : #include "webrtc/modules/audio_processing/include/audio_processing.h"
      14             : #include "webrtc/system_wrappers/include/trace.h"
      15             : #include "webrtc/voice_engine/channel.h"
      16             : #include "webrtc/voice_engine/output_mixer.h"
      17             : #include "webrtc/voice_engine/transmit_mixer.h"
      18             : 
      19             : namespace webrtc {
      20             : 
      21             : namespace voe {
      22             : 
      23             : static int32_t _gInstanceCounter = 0;
      24             : 
      25           0 : SharedData::SharedData()
      26           0 :     : _instanceId(++_gInstanceCounter),
      27             :       _channelManager(_gInstanceCounter),
      28             :       _engineStatistics(_gInstanceCounter),
      29             :       _audioDevicePtr(NULL),
      30             :       _moduleProcessThreadPtr(
      31             :           ProcessThread::Create("VoiceProcessThread")),
      32             :       _externalRecording(false),
      33           0 :       _externalPlayout(false) {
      34           0 :     Trace::CreateTrace();
      35           0 :     if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0)
      36             :     {
      37           0 :         _outputMixerPtr->SetEngineInformation(_engineStatistics);
      38             :     }
      39           0 :     if (TransmitMixer::Create(_transmitMixerPtr, _gInstanceCounter) == 0)
      40             :     {
      41           0 :         _transmitMixerPtr->SetEngineInformation(*_moduleProcessThreadPtr,
      42             :                                                 _engineStatistics,
      43           0 :                                                 _channelManager);
      44             :     }
      45           0 :     _audioDeviceLayer = AudioDeviceModule::kPlatformDefaultAudio;
      46           0 : }
      47             : 
      48           0 : SharedData::~SharedData()
      49             : {
      50           0 :     OutputMixer::Destroy(_outputMixerPtr);
      51           0 :     TransmitMixer::Destroy(_transmitMixerPtr);
      52           0 :     if (_audioDevicePtr) {
      53           0 :         _audioDevicePtr->Release();
      54             :     }
      55           0 :     _moduleProcessThreadPtr->Stop();
      56           0 :     Trace::ReturnTrace();
      57           0 : }
      58             : 
      59           0 : void SharedData::set_audio_device(
      60             :     const rtc::scoped_refptr<AudioDeviceModule>& audio_device) {
      61           0 :   _audioDevicePtr = audio_device;
      62           0 : }
      63             : 
      64           0 : void SharedData::set_audio_processing(AudioProcessing* audioproc) {
      65           0 :   audioproc_.reset(audioproc);
      66           0 :   _transmitMixerPtr->SetAudioProcessingModule(audioproc);
      67           0 :   _outputMixerPtr->SetAudioProcessingModule(audioproc);
      68           0 : }
      69             : 
      70           0 : int SharedData::NumOfSendingChannels() {
      71           0 :   ChannelManager::Iterator it(&_channelManager);
      72           0 :   int sending_channels = 0;
      73             : 
      74           0 :   for (ChannelManager::Iterator it(&_channelManager); it.IsValid();
      75           0 :        it.Increment()) {
      76           0 :     if (it.GetChannel()->Sending())
      77           0 :       ++sending_channels;
      78             :   }
      79             : 
      80           0 :   return sending_channels;
      81             : }
      82             : 
      83           0 : int SharedData::NumOfPlayingChannels() {
      84           0 :   ChannelManager::Iterator it(&_channelManager);
      85           0 :   int playout_channels = 0;
      86             : 
      87           0 :   for (ChannelManager::Iterator it(&_channelManager); it.IsValid();
      88           0 :        it.Increment()) {
      89           0 :     if (it.GetChannel()->Playing())
      90           0 :       ++playout_channels;
      91             :   }
      92             : 
      93           0 :   return playout_channels;
      94             : }
      95             : 
      96           0 : void SharedData::SetLastError(int32_t error) const {
      97           0 :   _engineStatistics.SetLastError(error);
      98           0 : }
      99             : 
     100           0 : void SharedData::SetLastError(int32_t error,
     101             :                               TraceLevel level) const {
     102           0 :   _engineStatistics.SetLastError(error, level);
     103           0 : }
     104             : 
     105           0 : void SharedData::SetLastError(int32_t error, TraceLevel level,
     106             :                               const char* msg) const {
     107           0 :   _engineStatistics.SetLastError(error, level, msg);
     108           0 : }
     109             : 
     110             : }  // namespace voe
     111             : 
     112             : }  // namespace webrtc

Generated by: LCOV version 1.13