OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_AUDIO_AUDIO_STATE_H_ | 11 #ifndef WEBRTC_AUDIO_AUDIO_STATE_H_ |
12 #define WEBRTC_AUDIO_AUDIO_STATE_H_ | 12 #define WEBRTC_AUDIO_AUDIO_STATE_H_ |
13 | 13 |
14 #include <memory> | |
15 | |
16 #include "webrtc/api/audio/audio_mixer.h" | |
14 #include "webrtc/api/call/audio_state.h" | 17 #include "webrtc/api/call/audio_state.h" |
18 #include "webrtc/audio/audio_transport_proxy.h" | |
the sun
2016/10/27 10:06:46
You can get away with forward-declaring the AudioT
aleloi
2016/11/01 15:17:35
Style guide (https://engdoc.corp.google.com/eng/do
| |
15 #include "webrtc/audio/scoped_voe_interface.h" | 19 #include "webrtc/audio/scoped_voe_interface.h" |
16 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
17 #include "webrtc/base/criticalsection.h" | 21 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/base/thread_checker.h" | 22 #include "webrtc/base/thread_checker.h" |
23 #include "webrtc/modules/audio_device/include/audio_device_defines.h" | |
19 #include "webrtc/voice_engine/include/voe_base.h" | 24 #include "webrtc/voice_engine/include/voe_base.h" |
20 | 25 |
21 namespace webrtc { | 26 namespace webrtc { |
22 namespace internal { | 27 namespace internal { |
23 | 28 |
24 class AudioState final : public webrtc::AudioState, | 29 class AudioState final : public webrtc::AudioState, |
25 public webrtc::VoiceEngineObserver { | 30 public webrtc::VoiceEngineObserver { |
26 public: | 31 public: |
27 explicit AudioState(const AudioState::Config& config); | 32 explicit AudioState(const AudioState::Config& config); |
28 ~AudioState() override; | 33 ~AudioState() override; |
29 | 34 |
30 VoiceEngine* voice_engine(); | 35 VoiceEngine* voice_engine(); |
36 | |
37 // The Audio Device currently connected or nullptr. | |
38 AudioDeviceModule* audio_device(); | |
the sun
2016/10/27 10:06:46
This is an internal util, make it private.
aleloi
2016/11/01 15:17:35
Missed that! I used it previously in audio_receive
| |
39 rtc::scoped_refptr<AudioMixer> mixer() const; | |
31 bool typing_noise_detected() const; | 40 bool typing_noise_detected() const; |
32 | 41 |
33 private: | 42 private: |
34 // rtc::RefCountInterface implementation. | 43 // rtc::RefCountInterface implementation. |
35 int AddRef() const override; | 44 int AddRef() const override; |
36 int Release() const override; | 45 int Release() const override; |
37 | 46 |
38 // webrtc::VoiceEngineObserver implementation. | 47 // webrtc::VoiceEngineObserver implementation. |
39 void CallbackOnError(int channel_id, int err_code) override; | 48 void CallbackOnError(int channel_id, int err_code) override; |
40 | 49 |
41 rtc::ThreadChecker thread_checker_; | 50 rtc::ThreadChecker thread_checker_; |
42 rtc::ThreadChecker process_thread_checker_; | 51 rtc::ThreadChecker process_thread_checker_; |
43 const webrtc::AudioState::Config config_; | 52 const webrtc::AudioState::Config config_; |
44 | 53 |
45 // We hold one interface pointer to the VoE to make sure it is kept alive. | 54 // We hold one interface pointer to the VoE to make sure it is kept alive. |
46 ScopedVoEInterface<VoEBase> voe_base_; | 55 ScopedVoEInterface<VoEBase> voe_base_; |
47 | 56 |
48 // The critical section isn't strictly needed in this case, but xSAN bots may | 57 // The critical section isn't strictly needed in this case, but xSAN bots may |
49 // trigger on unprotected cross-thread access. | 58 // trigger on unprotected cross-thread access. |
50 rtc::CriticalSection crit_sect_; | 59 rtc::CriticalSection crit_sect_; |
51 bool typing_noise_detected_ GUARDED_BY(crit_sect_) = false; | 60 bool typing_noise_detected_ GUARDED_BY(crit_sect_) = false; |
52 | 61 |
53 // Reference count; implementation copied from rtc::RefCountedObject. | 62 // Reference count; implementation copied from rtc::RefCountedObject. |
54 mutable volatile int ref_count_ = 0; | 63 mutable volatile int ref_count_ = 0; |
55 | 64 |
65 rtc::scoped_refptr<AudioMixer> mixer_; | |
the sun
2016/10/27 10:06:46
This should really live in the AudioState::Config,
aleloi
2016/11/01 15:17:35
Moved in dependence CL.
| |
66 // Transports mixed audio from the mixer to the audio device and | |
67 // recorded audio to the VoE AudioTransport. | |
68 std::unique_ptr<AudioTransportProxy> audio_transport_proxy_; | |
69 | |
56 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioState); | 70 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AudioState); |
57 }; | 71 }; |
58 } // namespace internal | 72 } // namespace internal |
59 } // namespace webrtc | 73 } // namespace webrtc |
60 | 74 |
61 #endif // WEBRTC_AUDIO_AUDIO_STATE_H_ | 75 #endif // WEBRTC_AUDIO_AUDIO_STATE_H_ |
OLD | NEW |