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