LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_device - audio_device_impl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 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             : #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H
      12             : #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_IMPL_H
      13             : 
      14             : #if defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE)
      15             : 
      16             : #include <memory>
      17             : 
      18             : #include "webrtc/base/checks.h"
      19             : #include "webrtc/modules/audio_device/audio_device_buffer.h"
      20             : #include "webrtc/modules/audio_device/include/audio_device.h"
      21             : 
      22             : namespace webrtc {
      23             : 
      24             : class AudioDeviceGeneric;
      25             : class AudioManager;
      26             : class CriticalSectionWrapper;
      27             : 
      28             : class AudioDeviceModuleImpl : public AudioDeviceModule {
      29             :  public:
      30             :   enum PlatformType {
      31             :     kPlatformNotSupported = 0,
      32             :     kPlatformWin32 = 1,
      33             :     kPlatformWinCe = 2,
      34             :     kPlatformLinux = 3,
      35             :     kPlatformMac = 4,
      36             :     kPlatformAndroid = 5,
      37             :     kPlatformIOS = 6,
      38             :     kPlatformSndio = 7
      39             :   };
      40             : 
      41             :   int32_t CheckPlatform();
      42             :   int32_t CreatePlatformSpecificObjects();
      43             :   int32_t AttachAudioBuffer();
      44             : 
      45             :   AudioDeviceModuleImpl(const int32_t id, const AudioLayer audioLayer);
      46             :   ~AudioDeviceModuleImpl() override;
      47             : 
      48             :   int64_t TimeUntilNextProcess() override;
      49             :   void Process() override;
      50             : 
      51             :   // Retrieve the currently utilized audio layer
      52             :   int32_t ActiveAudioLayer(AudioLayer* audioLayer) const override;
      53             : 
      54             :   // Error handling
      55             :   ErrorCode LastError() const override;
      56             :   int32_t RegisterEventObserver(AudioDeviceObserver* eventCallback) override;
      57             : 
      58             :   // Full-duplex transportation of PCM audio
      59             :   int32_t RegisterAudioCallback(AudioTransport* audioCallback) override;
      60             : 
      61             :   // Main initializaton and termination
      62             :   int32_t Init() override;
      63             :   int32_t Terminate() override;
      64             :   bool Initialized() const override;
      65             : 
      66             :   // Device enumeration
      67             :   int16_t PlayoutDevices() override;
      68             :   int16_t RecordingDevices() override;
      69             :   int32_t PlayoutDeviceName(uint16_t index,
      70             :                             char name[kAdmMaxDeviceNameSize],
      71             :                             char guid[kAdmMaxGuidSize]) override;
      72             :   int32_t RecordingDeviceName(uint16_t index,
      73             :                               char name[kAdmMaxDeviceNameSize],
      74             :                               char guid[kAdmMaxGuidSize]) override;
      75             : 
      76             :   // Device selection
      77             :   int32_t SetPlayoutDevice(uint16_t index) override;
      78             :   int32_t SetPlayoutDevice(WindowsDeviceType device) override;
      79             :   int32_t SetRecordingDevice(uint16_t index) override;
      80             :   int32_t SetRecordingDevice(WindowsDeviceType device) override;
      81             : 
      82             :   // Audio transport initialization
      83             :   int32_t PlayoutIsAvailable(bool* available) override;
      84             :   int32_t InitPlayout() override;
      85             :   bool PlayoutIsInitialized() const override;
      86             :   int32_t RecordingIsAvailable(bool* available) override;
      87             :   int32_t InitRecording() override;
      88             :   bool RecordingIsInitialized() const override;
      89             : 
      90             :   // Audio transport control
      91             :   int32_t StartPlayout() override;
      92             :   int32_t StopPlayout() override;
      93             :   bool Playing() const override;
      94             :   int32_t StartRecording() override;
      95             :   int32_t StopRecording() override;
      96             :   bool Recording() const override;
      97             : 
      98             :   // Microphone Automatic Gain Control (AGC)
      99             :   int32_t SetAGC(bool enable) override;
     100             :   bool AGC() const override;
     101             : 
     102             :   // Volume control based on the Windows Wave API (Windows only)
     103             :   int32_t SetWaveOutVolume(uint16_t volumeLeft, uint16_t volumeRight) override;
     104             :   int32_t WaveOutVolume(uint16_t* volumeLeft,
     105             :                         uint16_t* volumeRight) const override;
     106             : 
     107             :   // Audio mixer initialization
     108             :   int32_t InitSpeaker() override;
     109             :   bool SpeakerIsInitialized() const override;
     110             :   int32_t InitMicrophone() override;
     111             :   bool MicrophoneIsInitialized() const override;
     112             : 
     113             :   // Speaker volume controls
     114             :   int32_t SpeakerVolumeIsAvailable(bool* available) override;
     115             :   int32_t SetSpeakerVolume(uint32_t volume) override;
     116             :   int32_t SpeakerVolume(uint32_t* volume) const override;
     117             :   int32_t MaxSpeakerVolume(uint32_t* maxVolume) const override;
     118             :   int32_t MinSpeakerVolume(uint32_t* minVolume) const override;
     119             :   int32_t SpeakerVolumeStepSize(uint16_t* stepSize) const override;
     120             : 
     121             :   // Microphone volume controls
     122             :   int32_t MicrophoneVolumeIsAvailable(bool* available) override;
     123             :   int32_t SetMicrophoneVolume(uint32_t volume) override;
     124             :   int32_t MicrophoneVolume(uint32_t* volume) const override;
     125             :   int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const override;
     126             :   int32_t MinMicrophoneVolume(uint32_t* minVolume) const override;
     127             :   int32_t MicrophoneVolumeStepSize(uint16_t* stepSize) const override;
     128             : 
     129             :   // Speaker mute control
     130             :   int32_t SpeakerMuteIsAvailable(bool* available) override;
     131             :   int32_t SetSpeakerMute(bool enable) override;
     132             :   int32_t SpeakerMute(bool* enabled) const override;
     133             : 
     134             :   // Microphone mute control
     135             :   int32_t MicrophoneMuteIsAvailable(bool* available) override;
     136             :   int32_t SetMicrophoneMute(bool enable) override;
     137             :   int32_t MicrophoneMute(bool* enabled) const override;
     138             : 
     139             :   // Microphone boost control
     140             :   int32_t MicrophoneBoostIsAvailable(bool* available) override;
     141             :   int32_t SetMicrophoneBoost(bool enable) override;
     142             :   int32_t MicrophoneBoost(bool* enabled) const override;
     143             : 
     144             :   // Stereo support
     145             :   int32_t StereoPlayoutIsAvailable(bool* available) const override;
     146             :   int32_t SetStereoPlayout(bool enable) override;
     147             :   int32_t StereoPlayout(bool* enabled) const override;
     148             :   int32_t StereoRecordingIsAvailable(bool* available) const override;
     149             :   int32_t SetStereoRecording(bool enable) override;
     150             :   int32_t StereoRecording(bool* enabled) const override;
     151             :   int32_t SetRecordingChannel(const ChannelType channel) override;
     152             :   int32_t RecordingChannel(ChannelType* channel) const override;
     153             : 
     154             :   // Delay information and control
     155             :   int32_t SetPlayoutBuffer(const BufferType type, uint16_t sizeMS = 0) override;
     156             :   int32_t PlayoutBuffer(BufferType* type, uint16_t* sizeMS) const override;
     157             :   int32_t PlayoutDelay(uint16_t* delayMS) const override;
     158             :   int32_t RecordingDelay(uint16_t* delayMS) const override;
     159             : 
     160             :   // CPU load
     161             :   int32_t CPULoad(uint16_t* load) const override;
     162             : 
     163             :   // Recording of raw PCM data
     164             :   int32_t StartRawOutputFileRecording(
     165             :       const char pcmFileNameUTF8[kAdmMaxFileNameSize]) override;
     166             :   int32_t StopRawOutputFileRecording() override;
     167             :   int32_t StartRawInputFileRecording(
     168             :       const char pcmFileNameUTF8[kAdmMaxFileNameSize]) override;
     169             :   int32_t StopRawInputFileRecording() override;
     170             : 
     171             :   // Native sample rate controls (samples/sec)
     172             :   int32_t SetRecordingSampleRate(const uint32_t samplesPerSec) override;
     173             :   int32_t RecordingSampleRate(uint32_t* samplesPerSec) const override;
     174             :   int32_t SetPlayoutSampleRate(const uint32_t samplesPerSec) override;
     175             :   int32_t PlayoutSampleRate(uint32_t* samplesPerSec) const override;
     176             : 
     177             :   // Mobile device specific functions
     178             :   int32_t ResetAudioDevice() override;
     179             :   int32_t SetLoudspeakerStatus(bool enable) override;
     180             :   int32_t GetLoudspeakerStatus(bool* enabled) const override;
     181             : 
     182             :   bool BuiltInAECIsAvailable() const override;
     183             :   int32_t EnableBuiltInAEC(bool enable) override;
     184             :   bool BuiltInAGCIsAvailable() const override;
     185             :   int32_t EnableBuiltInAGC(bool enable) override;
     186             :   bool BuiltInNSIsAvailable() const override;
     187             :   int32_t EnableBuiltInNS(bool enable) override;
     188             : 
     189             : #if defined(WEBRTC_IOS)
     190             :   int GetPlayoutAudioParameters(AudioParameters* params) const override;
     191             :   int GetRecordAudioParameters(AudioParameters* params) const override;
     192             : #endif  // WEBRTC_IOS
     193             : 
     194           0 :   int32_t Id() { return _id; }
     195             : #if defined(WEBRTC_ANDROID)
     196             :   // Only use this acccessor for test purposes on Android.
     197             :   AudioManager* GetAndroidAudioManagerForTest() {
     198             :     return _audioManagerAndroid.get();
     199             :   }
     200             : #endif
     201             :   AudioDeviceBuffer* GetAudioDeviceBuffer() { return &_audioDeviceBuffer; }
     202             : 
     203             :  private:
     204             :   PlatformType Platform() const;
     205             :   AudioLayer PlatformAudioLayer() const;
     206             : 
     207             :   CriticalSectionWrapper& _critSect;
     208             :   CriticalSectionWrapper& _critSectEventCb;
     209             :   CriticalSectionWrapper& _critSectAudioCb;
     210             : 
     211             :   AudioDeviceObserver* _ptrCbAudioDeviceObserver;
     212             : 
     213             :   AudioDeviceGeneric* _ptrAudioDevice;
     214             : 
     215             :   AudioDeviceBuffer _audioDeviceBuffer;
     216             : #if defined(WEBRTC_ANDROID)
     217             :   std::unique_ptr<AudioManager> _audioManagerAndroid;
     218             : #endif
     219             :   int32_t _id;
     220             :   AudioLayer _platformAudioLayer;
     221             :   int64_t _lastProcessTime;
     222             :   PlatformType _platformType;
     223             :   bool _initialized;
     224             :   mutable ErrorCode _lastError;
     225             : };
     226             : 
     227             : }  // namespace webrtc
     228             : 
     229             : #endif  // defined(WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE)
     230             : 
     231             : #endif  // WEBRTC_MODULES_INTERFACE_AUDIO_DEVICE_IMPL_H_

Generated by: LCOV version 1.13