OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Set the external ADM. This can only be called before Init. | 107 // Set the external ADM. This can only be called before Init. |
108 bool SetAudioDeviceModule(webrtc::AudioDeviceModule* adm); | 108 bool SetAudioDeviceModule(webrtc::AudioDeviceModule* adm); |
109 | 109 |
110 // Starts AEC dump using existing file. | 110 // Starts AEC dump using existing file. |
111 bool StartAecDump(rtc::PlatformFile file); | 111 bool StartAecDump(rtc::PlatformFile file); |
112 | 112 |
113 // Create a VoiceEngine Channel. | 113 // Create a VoiceEngine Channel. |
114 int CreateMediaVoiceChannel(); | 114 int CreateMediaVoiceChannel(); |
115 | 115 |
116 private: | 116 private: |
117 typedef std::vector<WebRtcVoiceMediaChannel*> ChannelList; | |
118 | |
119 void Construct(); | 117 void Construct(); |
120 void ConstructCodecs(); | 118 void ConstructCodecs(); |
121 bool GetVoeCodec(int index, webrtc::CodecInst* codec); | 119 bool GetVoeCodec(int index, webrtc::CodecInst* codec); |
122 bool InitInternal(); | 120 bool InitInternal(); |
123 void SetTraceFilter(int filter); | 121 void SetTraceFilter(int filter); |
124 void SetTraceOptions(const std::string& options); | 122 void SetTraceOptions(const std::string& options); |
125 // Applies either options or overrides. Every option that is "set" | 123 // Every option that is "set" will be applied. Every option not "set" will be |
126 // will be applied. Every option not "set" will be ignored. This | 124 // ignored. This allows us to selectively turn on and off different options |
127 // allows us to selectively turn on and off different options easily | 125 // easily at any time. |
128 // at any time. | |
129 bool ApplyOptions(const AudioOptions& options); | 126 bool ApplyOptions(const AudioOptions& options); |
130 // Overrides, when set, take precedence over the options on a | |
131 // per-option basis. For example, if AGC is set in options and AEC | |
132 // is set in overrides, AGC and AEC will be both be set. Overrides | |
133 // can also turn off options. For example, if AGC is set to "on" in | |
134 // options and AGC is set to "off" in overrides, the result is that | |
135 // AGC will be off until different overrides are applied or until | |
136 // the overrides are cleared. Only one set of overrides is present | |
137 // at a time (they do not "stack"). And when the overrides are | |
138 // cleared, the media engine's state reverts back to the options set | |
139 // via SetOptions. This allows us to have both "persistent options" | |
140 // (the normal options) and "temporary options" (overrides). | |
141 bool SetOptionOverrides(const AudioOptions& options); | |
142 bool ClearOptionOverrides(); | |
143 | 127 |
144 // webrtc::TraceCallback: | 128 // webrtc::TraceCallback: |
145 void Print(webrtc::TraceLevel level, const char* trace, int length) override; | 129 void Print(webrtc::TraceLevel level, const char* trace, int length) override; |
146 | 130 |
147 // webrtc::VoiceEngineObserver: | 131 // webrtc::VoiceEngineObserver: |
148 void CallbackOnError(int channel, int errCode) override; | 132 void CallbackOnError(int channel, int errCode) override; |
149 | 133 |
150 // Given the device type, name, and id, find device id. Return true and | 134 // Given the device type, name, and id, find device id. Return true and |
151 // set the output parameter rtc_id if successful. | 135 // set the output parameter rtc_id if successful. |
152 bool FindWebRtcAudioDeviceId( | 136 bool FindWebRtcAudioDeviceId( |
(...skipping 11 matching lines...) Expand all Loading... |
164 // The primary instance of WebRtc VoiceEngine. | 148 // The primary instance of WebRtc VoiceEngine. |
165 rtc::scoped_ptr<VoEWrapper> voe_wrapper_; | 149 rtc::scoped_ptr<VoEWrapper> voe_wrapper_; |
166 rtc::scoped_ptr<VoETraceWrapper> tracing_; | 150 rtc::scoped_ptr<VoETraceWrapper> tracing_; |
167 // The external audio device manager | 151 // The external audio device manager |
168 webrtc::AudioDeviceModule* adm_; | 152 webrtc::AudioDeviceModule* adm_; |
169 int log_filter_; | 153 int log_filter_; |
170 std::string log_options_; | 154 std::string log_options_; |
171 bool is_dumping_aec_; | 155 bool is_dumping_aec_; |
172 std::vector<AudioCodec> codecs_; | 156 std::vector<AudioCodec> codecs_; |
173 std::vector<RtpHeaderExtension> rtp_header_extensions_; | 157 std::vector<RtpHeaderExtension> rtp_header_extensions_; |
174 ChannelList channels_; | 158 std::vector<WebRtcVoiceMediaChannel*> channels_; |
175 // channels_ can be read from WebRtc callback thread. We need a lock on that | 159 // channels_ can be read from WebRtc callback thread. We need a lock on that |
176 // callback as well as the RegisterChannel/UnregisterChannel. | 160 // callback as well as the RegisterChannel/UnregisterChannel. |
177 rtc::CriticalSection channels_cs_; | 161 rtc::CriticalSection channels_cs_; |
178 webrtc::AgcConfig default_agc_config_; | 162 webrtc::AgcConfig default_agc_config_; |
179 | 163 |
180 webrtc::Config voe_config_; | 164 webrtc::Config voe_config_; |
181 | 165 |
182 bool initialized_; | 166 bool initialized_; |
183 // See SetOptions and SetOptionOverrides for a description of the | |
184 // difference between options and overrides. | |
185 // options_ are the base options, which combined with the | |
186 // option_overrides_, create the current options being used. | |
187 // options_ is stored so that when option_overrides_ is cleared, we | |
188 // can restore the options_ without the option_overrides. | |
189 AudioOptions options_; | 167 AudioOptions options_; |
190 AudioOptions option_overrides_; | |
191 | 168 |
192 // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns | 169 // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns |
193 // values, and apply them in case they are missing in the audio options. We | 170 // values, and apply them in case they are missing in the audio options. We |
194 // need to do this because SetExtraOptions() will revert to defaults for | 171 // need to do this because SetExtraOptions() will revert to defaults for |
195 // options which are not provided. | 172 // options which are not provided. |
196 Settable<bool> extended_filter_aec_; | 173 Settable<bool> extended_filter_aec_; |
197 Settable<bool> delay_agnostic_aec_; | 174 Settable<bool> delay_agnostic_aec_; |
198 Settable<bool> experimental_ns_; | 175 Settable<bool> experimental_ns_; |
199 }; | 176 }; |
200 | 177 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; | 351 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; |
375 | 352 |
376 // Do not lock this on the VoE media processor thread; potential for deadlock | 353 // Do not lock this on the VoE media processor thread; potential for deadlock |
377 // exists. | 354 // exists. |
378 mutable rtc::CriticalSection receive_channels_cs_; | 355 mutable rtc::CriticalSection receive_channels_cs_; |
379 }; | 356 }; |
380 | 357 |
381 } // namespace cricket | 358 } // namespace cricket |
382 | 359 |
383 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ | 360 #endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_ |
OLD | NEW |