| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. | 51 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. |
| 52 // It uses the WebRtc VoiceEngine library for audio handling. | 52 // It uses the WebRtc VoiceEngine library for audio handling. |
| 53 class WebRtcVoiceEngine final : public webrtc::TraceCallback { | 53 class WebRtcVoiceEngine final : public webrtc::TraceCallback { |
| 54 friend class WebRtcVoiceMediaChannel; | 54 friend class WebRtcVoiceMediaChannel; |
| 55 public: | 55 public: |
| 56 WebRtcVoiceEngine( | 56 WebRtcVoiceEngine( |
| 57 webrtc::AudioDeviceModule* adm, | 57 webrtc::AudioDeviceModule* adm, |
| 58 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory, | 58 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory, |
| 59 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, | 59 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
| 60 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer); | 60 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
| 61 rtc::TaskQueue* low_priority_worker_queue); |
| 61 // Dependency injection for testing. | 62 // Dependency injection for testing. |
| 62 WebRtcVoiceEngine( | 63 WebRtcVoiceEngine( |
| 63 webrtc::AudioDeviceModule* adm, | 64 webrtc::AudioDeviceModule* adm, |
| 64 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory, | 65 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory, |
| 65 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, | 66 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
| 66 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, | 67 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
| 68 rtc::TaskQueue* low_priority_worker_queue, |
| 67 VoEWrapper* voe_wrapper); | 69 VoEWrapper* voe_wrapper); |
| 68 ~WebRtcVoiceEngine() override; | 70 ~WebRtcVoiceEngine() override; |
| 69 | 71 |
| 70 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const; | 72 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const; |
| 71 VoiceMediaChannel* CreateChannel(webrtc::Call* call, | 73 VoiceMediaChannel* CreateChannel(webrtc::Call* call, |
| 72 const MediaConfig& config, | 74 const MediaConfig& config, |
| 73 const AudioOptions& options); | 75 const AudioOptions& options); |
| 74 | 76 |
| 75 int GetInputLevel(); | 77 int GetInputLevel(); |
| 76 | 78 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 105 // ignored. This allows us to selectively turn on and off different options | 107 // ignored. This allows us to selectively turn on and off different options |
| 106 // easily at any time. | 108 // easily at any time. |
| 107 bool ApplyOptions(const AudioOptions& options); | 109 bool ApplyOptions(const AudioOptions& options); |
| 108 | 110 |
| 109 // webrtc::TraceCallback: | 111 // webrtc::TraceCallback: |
| 110 void Print(webrtc::TraceLevel level, const char* trace, int length) override; | 112 void Print(webrtc::TraceLevel level, const char* trace, int length) override; |
| 111 | 113 |
| 112 void StartAecDump(const std::string& filename); | 114 void StartAecDump(const std::string& filename); |
| 113 int CreateVoEChannel(); | 115 int CreateVoEChannel(); |
| 114 | 116 |
| 115 rtc::TaskQueue low_priority_worker_queue_; | |
| 116 | |
| 117 webrtc::AudioDeviceModule* adm(); | 117 webrtc::AudioDeviceModule* adm(); |
| 118 webrtc::AudioProcessing* apm(); | 118 webrtc::AudioProcessing* apm(); |
| 119 webrtc::voe::TransmitMixer* transmit_mixer(); | 119 webrtc::voe::TransmitMixer* transmit_mixer(); |
| 120 | 120 |
| 121 AudioCodecs CollectCodecs( | 121 AudioCodecs CollectCodecs( |
| 122 const std::vector<webrtc::AudioCodecSpec>& specs) const; | 122 const std::vector<webrtc::AudioCodecSpec>& specs) const; |
| 123 | 123 |
| 124 rtc::ThreadChecker signal_thread_checker_; | 124 rtc::ThreadChecker signal_thread_checker_; |
| 125 rtc::ThreadChecker worker_thread_checker_; | 125 rtc::ThreadChecker worker_thread_checker_; |
| 126 | 126 |
| 127 // The audio device manager. | 127 // The audio device manager. |
| 128 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_; | 128 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_; |
| 129 rtc::scoped_refptr<webrtc::AudioEncoderFactory> encoder_factory_; | 129 rtc::scoped_refptr<webrtc::AudioEncoderFactory> encoder_factory_; |
| 130 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_; | 130 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_; |
| 131 // Reference to the APM, owned by VoE. | 131 // Reference to the APM, owned by VoE. |
| 132 webrtc::AudioProcessing* apm_ = nullptr; | 132 webrtc::AudioProcessing* apm_ = nullptr; |
| 133 // Reference to the TransmitMixer, owned by VoE. | 133 // Reference to the TransmitMixer, owned by VoE. |
| 134 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; | 134 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; |
| 135 // The primary instance of WebRtc VoiceEngine. | 135 // The primary instance of WebRtc VoiceEngine. |
| 136 std::unique_ptr<VoEWrapper> voe_wrapper_; | 136 std::unique_ptr<VoEWrapper> voe_wrapper_; |
| 137 rtc::scoped_refptr<webrtc::AudioState> audio_state_; | 137 rtc::scoped_refptr<webrtc::AudioState> audio_state_; |
| 138 std::vector<AudioCodec> send_codecs_; | 138 std::vector<AudioCodec> send_codecs_; |
| 139 std::vector<AudioCodec> recv_codecs_; | 139 std::vector<AudioCodec> recv_codecs_; |
| 140 std::vector<WebRtcVoiceMediaChannel*> channels_; | 140 std::vector<WebRtcVoiceMediaChannel*> channels_; |
| 141 webrtc::VoEBase::ChannelConfig channel_config_; | 141 webrtc::VoEBase::ChannelConfig channel_config_; |
| 142 bool is_dumping_aec_ = false; | |
| 143 | 142 |
| 144 webrtc::AgcConfig default_agc_config_; | 143 webrtc::AgcConfig default_agc_config_; |
| 145 // Cache received extended_filter_aec, delay_agnostic_aec, experimental_ns | 144 // Cache received extended_filter_aec, delay_agnostic_aec, experimental_ns |
| 146 // level controller, and intelligibility_enhancer values, and apply them | 145 // 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 | 146 // 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 | 147 // SetExtraOptions() will revert to defaults for options which are not |
| 149 // provided. | 148 // provided. |
| 150 rtc::Optional<bool> extended_filter_aec_; | 149 rtc::Optional<bool> extended_filter_aec_; |
| 151 rtc::Optional<bool> delay_agnostic_aec_; | 150 rtc::Optional<bool> delay_agnostic_aec_; |
| 152 rtc::Optional<bool> experimental_ns_; | 151 rtc::Optional<bool> experimental_ns_; |
| 153 rtc::Optional<bool> intelligibility_enhancer_; | 152 rtc::Optional<bool> intelligibility_enhancer_; |
| 154 rtc::Optional<bool> level_control_; | 153 rtc::Optional<bool> level_control_; |
| 155 | 154 |
| 156 webrtc::AudioProcessing::Config apm_config_; | 155 webrtc::AudioProcessing::Config apm_config_; |
| 157 | 156 |
| 157 rtc::TaskQueue* low_priority_worker_queue_; |
| 158 |
| 158 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceEngine); | 159 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceEngine); |
| 159 }; | 160 }; |
| 160 | 161 |
| 161 // WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses | 162 // WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses |
| 162 // WebRtc Voice Engine. | 163 // WebRtc Voice Engine. |
| 163 class WebRtcVoiceMediaChannel final : public VoiceMediaChannel, | 164 class WebRtcVoiceMediaChannel final : public VoiceMediaChannel, |
| 164 public webrtc::Transport { | 165 public webrtc::Transport { |
| 165 public: | 166 public: |
| 166 WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, | 167 WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, |
| 167 const MediaConfig& config, | 168 const MediaConfig& config, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 299 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
| 299 | 300 |
| 300 rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec> | 301 rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec> |
| 301 send_codec_spec_; | 302 send_codec_spec_; |
| 302 | 303 |
| 303 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); | 304 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); |
| 304 }; | 305 }; |
| 305 } // namespace cricket | 306 } // namespace cricket |
| 306 | 307 |
| 307 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ | 308 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ |
| OLD | NEW |