Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: webrtc/modules/audio_device/linux/audio_device_pulse_linux.h

Issue 3010223002: Update thread annotiation macros in modules to use RTC_ prefix (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 bool RecordingWarning() const override; 192 bool RecordingWarning() const override;
193 bool RecordingError() const override; 193 bool RecordingError() const override;
194 void ClearPlayoutWarning() override; 194 void ClearPlayoutWarning() override;
195 void ClearPlayoutError() override; 195 void ClearPlayoutError() override;
196 void ClearRecordingWarning() override; 196 void ClearRecordingWarning() override;
197 void ClearRecordingError() override; 197 void ClearRecordingError() override;
198 198
199 void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override; 199 void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) override;
200 200
201 private: 201 private:
202 void Lock() EXCLUSIVE_LOCK_FUNCTION(_critSect) { 202 void Lock() RTC_EXCLUSIVE_LOCK_FUNCTION(_critSect) { _critSect.Enter(); }
203 _critSect.Enter(); 203 void UnLock() RTC_UNLOCK_FUNCTION(_critSect) { _critSect.Leave(); }
204 } 204 void WaitForOperationCompletion(pa_operation* paOperation) const;
205 void UnLock() UNLOCK_FUNCTION(_critSect) { 205 void WaitForSuccess(pa_operation* paOperation) const;
206 _critSect.Leave();
207 }
208 void WaitForOperationCompletion(pa_operation* paOperation) const;
209 void WaitForSuccess(pa_operation* paOperation) const;
210 206
211 bool KeyPressed() const; 207 bool KeyPressed() const;
212 208
213 static void PaContextStateCallback(pa_context *c, void *pThis); 209 static void PaContextStateCallback(pa_context* c, void* pThis);
214 static void PaSinkInfoCallback(pa_context *c, const pa_sink_info *i, 210 static void PaSinkInfoCallback(pa_context* c,
215 int eol, void *pThis); 211 const pa_sink_info* i,
216 static void PaSourceInfoCallback(pa_context *c, const pa_source_info *i, 212 int eol,
217 int eol, void *pThis); 213 void* pThis);
218 static void PaServerInfoCallback(pa_context *c, const pa_server_info *i, 214 static void PaSourceInfoCallback(pa_context* c,
219 void *pThis); 215 const pa_source_info* i,
220 static void PaStreamStateCallback(pa_stream *p, void *pThis); 216 int eol,
221 void PaContextStateCallbackHandler(pa_context *c); 217 void* pThis);
222 void PaSinkInfoCallbackHandler(const pa_sink_info *i, int eol); 218 static void PaServerInfoCallback(pa_context* c,
223 void PaSourceInfoCallbackHandler(const pa_source_info *i, int eol); 219 const pa_server_info* i,
224 void PaServerInfoCallbackHandler(const pa_server_info *i); 220 void* pThis);
225 void PaStreamStateCallbackHandler(pa_stream *p); 221 static void PaStreamStateCallback(pa_stream* p, void* pThis);
222 void PaContextStateCallbackHandler(pa_context* c);
223 void PaSinkInfoCallbackHandler(const pa_sink_info* i, int eol);
224 void PaSourceInfoCallbackHandler(const pa_source_info* i, int eol);
225 void PaServerInfoCallbackHandler(const pa_server_info* i);
226 void PaStreamStateCallbackHandler(pa_stream* p);
226 227
227 void EnableWriteCallback(); 228 void EnableWriteCallback();
228 void DisableWriteCallback(); 229 void DisableWriteCallback();
229 static void PaStreamWriteCallback(pa_stream *unused, size_t buffer_space, 230 static void PaStreamWriteCallback(pa_stream* unused,
230 void *pThis); 231 size_t buffer_space,
231 void PaStreamWriteCallbackHandler(size_t buffer_space); 232 void* pThis);
232 static void PaStreamUnderflowCallback(pa_stream *unused, void *pThis); 233 void PaStreamWriteCallbackHandler(size_t buffer_space);
233 void PaStreamUnderflowCallbackHandler(); 234 static void PaStreamUnderflowCallback(pa_stream* unused, void* pThis);
234 void EnableReadCallback(); 235 void PaStreamUnderflowCallbackHandler();
235 void DisableReadCallback(); 236 void EnableReadCallback();
236 static void PaStreamReadCallback(pa_stream *unused1, size_t unused2, 237 void DisableReadCallback();
237 void *pThis); 238 static void PaStreamReadCallback(pa_stream* unused1,
238 void PaStreamReadCallbackHandler(); 239 size_t unused2,
239 static void PaStreamOverflowCallback(pa_stream *unused, void *pThis); 240 void* pThis);
240 void PaStreamOverflowCallbackHandler(); 241 void PaStreamReadCallbackHandler();
241 int32_t LatencyUsecs(pa_stream *stream); 242 static void PaStreamOverflowCallback(pa_stream* unused, void* pThis);
242 int32_t ReadRecordedData(const void* bufferData, size_t bufferSize); 243 void PaStreamOverflowCallbackHandler();
243 int32_t ProcessRecordedData(int8_t *bufferData, 244 int32_t LatencyUsecs(pa_stream* stream);
244 uint32_t bufferSizeInSamples, 245 int32_t ReadRecordedData(const void* bufferData, size_t bufferSize);
245 uint32_t recDelay); 246 int32_t ProcessRecordedData(int8_t* bufferData,
247 uint32_t bufferSizeInSamples,
248 uint32_t recDelay);
246 249
247 int32_t CheckPulseAudioVersion(); 250 int32_t CheckPulseAudioVersion();
248 int32_t InitSamplingFrequency(); 251 int32_t InitSamplingFrequency();
249 int32_t GetDefaultDeviceInfo(bool recDevice, char* name, uint16_t& index); 252 int32_t GetDefaultDeviceInfo(bool recDevice, char* name, uint16_t& index);
250 int32_t InitPulseAudio(); 253 int32_t InitPulseAudio();
251 int32_t TerminatePulseAudio(); 254 int32_t TerminatePulseAudio();
252 255
253 void PaLock(); 256 void PaLock();
254 void PaUnLock(); 257 void PaUnLock();
255 258
256 static bool RecThreadFunc(void*); 259 static bool RecThreadFunc(void*);
257 static bool PlayThreadFunc(void*); 260 static bool PlayThreadFunc(void*);
258 bool RecThreadProcess(); 261 bool RecThreadProcess();
259 bool PlayThreadProcess(); 262 bool PlayThreadProcess();
260 263
261 AudioDeviceBuffer* _ptrAudioBuffer; 264 AudioDeviceBuffer* _ptrAudioBuffer;
262 265
263 rtc::CriticalSection _critSect; 266 rtc::CriticalSection _critSect;
264 EventWrapper& _timeEventRec; 267 EventWrapper& _timeEventRec;
265 EventWrapper& _timeEventPlay; 268 EventWrapper& _timeEventPlay;
266 EventWrapper& _recStartEvent; 269 EventWrapper& _recStartEvent;
267 EventWrapper& _playStartEvent; 270 EventWrapper& _playStartEvent;
268 271
269 // TODO(pbos): Remove unique_ptr and use directly without resetting. 272 // TODO(pbos): Remove unique_ptr and use directly without resetting.
270 std::unique_ptr<rtc::PlatformThread> _ptrThreadPlay; 273 std::unique_ptr<rtc::PlatformThread> _ptrThreadPlay;
271 std::unique_ptr<rtc::PlatformThread> _ptrThreadRec; 274 std::unique_ptr<rtc::PlatformThread> _ptrThreadRec;
272 275
273 AudioMixerManagerLinuxPulse _mixerManager; 276 AudioMixerManagerLinuxPulse _mixerManager;
274 277
275 uint16_t _inputDeviceIndex; 278 uint16_t _inputDeviceIndex;
276 uint16_t _outputDeviceIndex; 279 uint16_t _outputDeviceIndex;
277 bool _inputDeviceIsSpecified; 280 bool _inputDeviceIsSpecified;
278 bool _outputDeviceIsSpecified; 281 bool _outputDeviceIsSpecified;
279 282
280 int sample_rate_hz_; 283 int sample_rate_hz_;
281 uint8_t _recChannels; 284 uint8_t _recChannels;
282 uint8_t _playChannels; 285 uint8_t _playChannels;
283 286
284 // Stores thread ID in constructor. 287 // Stores thread ID in constructor.
285 // We can then use ThreadChecker::CalledOnValidThread() to ensure that 288 // We can then use ThreadChecker::CalledOnValidThread() to ensure that
286 // other methods are called from the same thread. 289 // other methods are called from the same thread.
287 // Currently only does RTC_DCHECK(thread_checker_.CalledOnValidThread()). 290 // Currently only does RTC_DCHECK(thread_checker_.CalledOnValidThread()).
288 rtc::ThreadChecker thread_checker_; 291 rtc::ThreadChecker thread_checker_;
289 292
290 bool _initialized; 293 bool _initialized;
291 bool _recording; 294 bool _recording;
292 bool _playing; 295 bool _playing;
293 bool _recIsInitialized; 296 bool _recIsInitialized;
294 bool _playIsInitialized; 297 bool _playIsInitialized;
295 bool _startRec; 298 bool _startRec;
296 bool _stopRec; 299 bool _stopRec;
297 bool _startPlay; 300 bool _startPlay;
298 bool _stopPlay; 301 bool _stopPlay;
299 bool _AGC; 302 bool _AGC;
300 bool update_speaker_volume_at_startup_; 303 bool update_speaker_volume_at_startup_;
301 304
302 uint32_t _sndCardPlayDelay; 305 uint32_t _sndCardPlayDelay;
303 uint32_t _sndCardRecDelay; 306 uint32_t _sndCardRecDelay;
304 307
305 int32_t _writeErrors; 308 int32_t _writeErrors;
306 uint16_t _playWarning; 309 uint16_t _playWarning;
307 uint16_t _playError; 310 uint16_t _playError;
308 uint16_t _recWarning; 311 uint16_t _recWarning;
309 uint16_t _recError; 312 uint16_t _recError;
310 313
311 uint16_t _deviceIndex; 314 uint16_t _deviceIndex;
312 int16_t _numPlayDevices; 315 int16_t _numPlayDevices;
313 int16_t _numRecDevices; 316 int16_t _numRecDevices;
314 char* _playDeviceName; 317 char* _playDeviceName;
315 char* _recDeviceName; 318 char* _recDeviceName;
316 char* _playDisplayDeviceName; 319 char* _playDisplayDeviceName;
317 char* _recDisplayDeviceName; 320 char* _recDisplayDeviceName;
318 char _paServerVersion[32]; 321 char _paServerVersion[32];
319 322
320 int8_t* _playBuffer; 323 int8_t* _playBuffer;
321 size_t _playbackBufferSize; 324 size_t _playbackBufferSize;
322 size_t _playbackBufferUnused; 325 size_t _playbackBufferUnused;
323 size_t _tempBufferSpace; 326 size_t _tempBufferSpace;
324 int8_t* _recBuffer; 327 int8_t* _recBuffer;
325 size_t _recordBufferSize; 328 size_t _recordBufferSize;
326 size_t _recordBufferUsed; 329 size_t _recordBufferUsed;
327 const void* _tempSampleData; 330 const void* _tempSampleData;
328 size_t _tempSampleDataSize; 331 size_t _tempSampleDataSize;
329 int32_t _configuredLatencyPlay; 332 int32_t _configuredLatencyPlay;
330 int32_t _configuredLatencyRec; 333 int32_t _configuredLatencyRec;
331 334
332 // PulseAudio 335 // PulseAudio
333 uint16_t _paDeviceIndex; 336 uint16_t _paDeviceIndex;
334 bool _paStateChanged; 337 bool _paStateChanged;
335 338
336 pa_threaded_mainloop* _paMainloop; 339 pa_threaded_mainloop* _paMainloop;
337 pa_mainloop_api* _paMainloopApi; 340 pa_mainloop_api* _paMainloopApi;
338 pa_context* _paContext; 341 pa_context* _paContext;
339 342
340 pa_stream* _recStream; 343 pa_stream* _recStream;
341 pa_stream* _playStream; 344 pa_stream* _playStream;
342 uint32_t _recStreamFlags; 345 uint32_t _recStreamFlags;
343 uint32_t _playStreamFlags; 346 uint32_t _playStreamFlags;
344 pa_buffer_attr _playBufferAttr; 347 pa_buffer_attr _playBufferAttr;
345 pa_buffer_attr _recBufferAttr; 348 pa_buffer_attr _recBufferAttr;
346 349
347 char _oldKeyState[32]; 350 char _oldKeyState[32];
348 Display* _XDisplay; 351 Display* _XDisplay;
349 }; 352 };
350 353
351 } 354 }
352 355
353 #endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_LINUX_AUDIO_DEVICE_PULSE_LINUX_H_ 356 #endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_LINUX_AUDIO_DEVICE_PULSE_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698