audio_state.h (2302B)
1 /* 2 * Copyright (c) 2015 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 #ifndef CALL_AUDIO_STATE_H_ 11 #define CALL_AUDIO_STATE_H_ 12 13 #include "api/audio/audio_device.h" 14 #include "api/audio/audio_mixer.h" 15 #include "api/audio/audio_processing.h" 16 #include "api/ref_count.h" 17 #include "api/scoped_refptr.h" 18 #include "modules/async_audio_processing/async_audio_processing.h" 19 20 namespace webrtc { 21 22 class AudioTransport; 23 24 // AudioState holds the state which must be shared between multiple instances of 25 // webrtc::Call for audio processing purposes. 26 class AudioState : public RefCountInterface { 27 public: 28 struct Config { 29 Config(); 30 ~Config(); 31 32 // The audio mixer connected to active receive streams. One per 33 // AudioState. 34 scoped_refptr<AudioMixer> audio_mixer; 35 36 // The audio processing module. 37 scoped_refptr<webrtc::AudioProcessing> audio_processing; 38 39 // TODO(solenberg): Temporary: audio device module. 40 scoped_refptr<webrtc::AudioDeviceModule> audio_device_module; 41 42 scoped_refptr<AsyncAudioProcessing::Factory> async_audio_processing_factory; 43 }; 44 45 virtual AudioProcessing* audio_processing() = 0; 46 virtual AudioTransport* audio_transport() = 0; 47 48 // Enable/disable playout of the audio channels. Enabled by default. 49 // This will stop playout of the underlying audio device but start a task 50 // which will poll for audio data every 10ms to ensure that audio processing 51 // happens and the audio stats are updated. 52 virtual void SetPlayout(bool enabled) = 0; 53 54 // Enable/disable recording of the audio channels. Enabled by default. 55 // This will stop recording of the underlying audio device and no audio 56 // packets will be encoded or transmitted. 57 virtual void SetRecording(bool enabled) = 0; 58 59 virtual void SetStereoChannelSwapping(bool enable) = 0; 60 61 static scoped_refptr<AudioState> Create(const AudioState::Config& config); 62 63 ~AudioState() override {} 64 }; 65 } // namespace webrtc 66 67 #endif // CALL_AUDIO_STATE_H_