OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer); | 60 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer); |
61 // Dependency injection for testing. | 61 // Dependency injection for testing. |
62 WebRtcVoiceEngine( | 62 WebRtcVoiceEngine( |
63 webrtc::AudioDeviceModule* adm, | 63 webrtc::AudioDeviceModule* adm, |
64 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory, | 64 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory, |
65 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, | 65 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
66 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, | 66 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
67 VoEWrapper* voe_wrapper); | 67 VoEWrapper* voe_wrapper); |
68 ~WebRtcVoiceEngine() override; | 68 ~WebRtcVoiceEngine() override; |
69 | 69 |
| 70 // Does initialization that needs to occur on the worker thread. |
| 71 void Init(); |
| 72 |
70 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const; | 73 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const; |
71 VoiceMediaChannel* CreateChannel(webrtc::Call* call, | 74 VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
72 const MediaConfig& config, | 75 const MediaConfig& config, |
73 const AudioOptions& options); | 76 const AudioOptions& options); |
74 | 77 |
75 int GetInputLevel(); | 78 int GetInputLevel(); |
76 | 79 |
77 const std::vector<AudioCodec>& send_codecs() const; | 80 const std::vector<AudioCodec>& send_codecs() const; |
78 const std::vector<AudioCodec>& recv_codecs() const; | 81 const std::vector<AudioCodec>& recv_codecs() const; |
79 RtpCapabilities GetCapabilities() const; | 82 RtpCapabilities GetCapabilities() const; |
(...skipping 25 matching lines...) Expand all Loading... |
105 // ignored. This allows us to selectively turn on and off different options | 108 // ignored. This allows us to selectively turn on and off different options |
106 // easily at any time. | 109 // easily at any time. |
107 bool ApplyOptions(const AudioOptions& options); | 110 bool ApplyOptions(const AudioOptions& options); |
108 | 111 |
109 // webrtc::TraceCallback: | 112 // webrtc::TraceCallback: |
110 void Print(webrtc::TraceLevel level, const char* trace, int length) override; | 113 void Print(webrtc::TraceLevel level, const char* trace, int length) override; |
111 | 114 |
112 void StartAecDump(const std::string& filename); | 115 void StartAecDump(const std::string& filename); |
113 int CreateVoEChannel(); | 116 int CreateVoEChannel(); |
114 | 117 |
115 rtc::TaskQueue low_priority_worker_queue_; | 118 std::unique_ptr<rtc::TaskQueue> low_priority_worker_queue_; |
116 | 119 |
117 webrtc::AudioDeviceModule* adm(); | 120 webrtc::AudioDeviceModule* adm(); |
118 webrtc::AudioProcessing* apm(); | 121 webrtc::AudioProcessing* apm(); |
119 webrtc::voe::TransmitMixer* transmit_mixer(); | 122 webrtc::voe::TransmitMixer* transmit_mixer(); |
120 | 123 |
121 AudioCodecs CollectCodecs( | 124 AudioCodecs CollectCodecs( |
122 const std::vector<webrtc::AudioCodecSpec>& specs) const; | 125 const std::vector<webrtc::AudioCodecSpec>& specs) const; |
123 | 126 |
124 rtc::ThreadChecker signal_thread_checker_; | 127 rtc::ThreadChecker signal_thread_checker_; |
125 rtc::ThreadChecker worker_thread_checker_; | 128 rtc::ThreadChecker worker_thread_checker_; |
126 | 129 |
127 // The audio device manager. | 130 // The audio device manager. |
128 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_; | 131 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_; |
129 rtc::scoped_refptr<webrtc::AudioEncoderFactory> encoder_factory_; | 132 rtc::scoped_refptr<webrtc::AudioEncoderFactory> encoder_factory_; |
130 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_; | 133 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_; |
| 134 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer_; |
131 // Reference to the APM, owned by VoE. | 135 // Reference to the APM, owned by VoE. |
132 webrtc::AudioProcessing* apm_ = nullptr; | 136 webrtc::AudioProcessing* apm_ = nullptr; |
133 // Reference to the TransmitMixer, owned by VoE. | 137 // Reference to the TransmitMixer, owned by VoE. |
134 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; | 138 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; |
135 // The primary instance of WebRtc VoiceEngine. | 139 // The primary instance of WebRtc VoiceEngine. |
136 std::unique_ptr<VoEWrapper> voe_wrapper_; | 140 std::unique_ptr<VoEWrapper> voe_wrapper_; |
137 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 141 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
138 std::vector<AudioCodec> send_codecs_; | 142 std::vector<AudioCodec> send_codecs_; |
139 std::vector<AudioCodec> recv_codecs_; | 143 std::vector<AudioCodec> recv_codecs_; |
140 std::vector<WebRtcVoiceMediaChannel*> channels_; | 144 std::vector<WebRtcVoiceMediaChannel*> channels_; |
141 webrtc::VoEBase::ChannelConfig channel_config_; | 145 webrtc::VoEBase::ChannelConfig channel_config_; |
142 bool is_dumping_aec_ = false; | 146 bool is_dumping_aec_ = false; |
| 147 bool initialized_ = false; |
143 | 148 |
144 webrtc::AgcConfig default_agc_config_; | 149 webrtc::AgcConfig default_agc_config_; |
145 // Cache received extended_filter_aec, delay_agnostic_aec, experimental_ns | 150 // Cache received extended_filter_aec, delay_agnostic_aec, experimental_ns |
146 // level controller, and intelligibility_enhancer values, and apply them | 151 // level controller, and intelligibility_enhancer values, and apply them |
147 // in case they are missing in the audio options. We need to do this because | 152 // in case they are missing in the audio options. We need to do this because |
148 // SetExtraOptions() will revert to defaults for options which are not | 153 // SetExtraOptions() will revert to defaults for options which are not |
149 // provided. | 154 // provided. |
150 rtc::Optional<bool> extended_filter_aec_; | 155 rtc::Optional<bool> extended_filter_aec_; |
151 rtc::Optional<bool> delay_agnostic_aec_; | 156 rtc::Optional<bool> delay_agnostic_aec_; |
152 rtc::Optional<bool> experimental_ns_; | 157 rtc::Optional<bool> experimental_ns_; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 303 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
299 | 304 |
300 rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec> | 305 rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec> |
301 send_codec_spec_; | 306 send_codec_spec_; |
302 | 307 |
303 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); | 308 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); |
304 }; | 309 }; |
305 } // namespace cricket | 310 } // namespace cricket |
306 | 311 |
307 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ | 312 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ |
OLD | NEW |