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

Side by Side Diff: webrtc/modules/audio_device/win/audio_device_core_win.h

Issue 2785673002: Remove more CriticalSectionWrappers. (Closed)
Patch Set: Created 3 years, 8 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
11 #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_CORE_WIN_H_ 11 #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_CORE_WIN_H_
12 #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_CORE_WIN_H_ 12 #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_CORE_WIN_H_
13 13
14 #if (_MSC_VER >= 1400) // only include for VS 2005 and higher 14 #if (_MSC_VER >= 1400) // only include for VS 2005 and higher
15 15
16 #include "webrtc/modules/audio_device/audio_device_generic.h" 16 #include "webrtc/modules/audio_device/audio_device_generic.h"
17 17
18 #include <wmcodecdsp.h> // CLSID_CWMAudioAEC 18 #include <wmcodecdsp.h> // CLSID_CWMAudioAEC
19 // (must be before audioclient.h) 19 // (must be before audioclient.h)
20 #include <Audioclient.h> // WASAPI 20 #include <Audioclient.h> // WASAPI
21 #include <Audiopolicy.h> 21 #include <Audiopolicy.h>
22 #include <Mmdeviceapi.h> // MMDevice 22 #include <Mmdeviceapi.h> // MMDevice
23 #include <avrt.h> // Avrt 23 #include <avrt.h> // Avrt
24 #include <endpointvolume.h> 24 #include <endpointvolume.h>
25 #include <mediaobj.h> // IMediaObject 25 #include <mediaobj.h> // IMediaObject
26 26
27 #include "webrtc/base/criticalsection.h"
27 #include "webrtc/base/scoped_ref_ptr.h" 28 #include "webrtc/base/scoped_ref_ptr.h"
28 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
29 29
30 // Use Multimedia Class Scheduler Service (MMCSS) to boost the thread priority 30 // Use Multimedia Class Scheduler Service (MMCSS) to boost the thread priority
31 #pragma comment( lib, "avrt.lib" ) 31 #pragma comment( lib, "avrt.lib" )
32 // AVRT function pointers 32 // AVRT function pointers
33 typedef BOOL (WINAPI *PAvRevertMmThreadCharacteristics)(HANDLE); 33 typedef BOOL (WINAPI *PAvRevertMmThreadCharacteristics)(HANDLE);
34 typedef HANDLE (WINAPI *PAvSetMmThreadCharacteristicsA)(LPCSTR, LPDWORD); 34 typedef HANDLE (WINAPI *PAvSetMmThreadCharacteristicsA)(LPCSTR, LPDWORD);
35 typedef BOOL (WINAPI *PAvSetMmThreadPriority)(HANDLE, AVRT_PRIORITY); 35 typedef BOOL (WINAPI *PAvSetMmThreadPriority)(HANDLE, AVRT_PRIORITY);
36 36
37 namespace webrtc { 37 namespace webrtc {
38 38
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 static DWORD WINAPI GetCaptureVolumeThread(LPVOID context); 231 static DWORD WINAPI GetCaptureVolumeThread(LPVOID context);
232 DWORD DoGetCaptureVolumeThread(); 232 DWORD DoGetCaptureVolumeThread();
233 233
234 static DWORD WINAPI SetCaptureVolumeThread(LPVOID context); 234 static DWORD WINAPI SetCaptureVolumeThread(LPVOID context);
235 DWORD DoSetCaptureVolumeThread(); 235 DWORD DoSetCaptureVolumeThread();
236 236
237 void _Lock() { _critSect.Enter(); }; 237 void _Lock() { _critSect.Enter(); };
238 void _UnLock() { _critSect.Leave(); }; 238 void _UnLock() { _critSect.Leave(); };
239 239
240 private:
241 int32_t Id() {return _id;} 240 int32_t Id() {return _id;}
242 241
243 private:
244 int SetDMOProperties(); 242 int SetDMOProperties();
245 243
246 int SetBoolProperty(IPropertyStore* ptrPS, 244 int SetBoolProperty(IPropertyStore* ptrPS,
247 REFPROPERTYKEY key, 245 REFPROPERTYKEY key,
248 VARIANT_BOOL value); 246 VARIANT_BOOL value);
249 247
250 int SetVtI4Property(IPropertyStore* ptrPS, 248 int SetVtI4Property(IPropertyStore* ptrPS,
251 REFPROPERTYKEY key, 249 REFPROPERTYKEY key,
252 LONG value); 250 LONG value);
253 251
(...skipping 11 matching lines...) Expand all
265 int32_t _GetDeviceID(IMMDevice* pDevice, LPWSTR pszBuffer, int bufferLen); 263 int32_t _GetDeviceID(IMMDevice* pDevice, LPWSTR pszBuffer, int bufferLen);
266 int32_t _GetDefaultDevice(EDataFlow dir, ERole role, IMMDevice** ppDevice); 264 int32_t _GetDefaultDevice(EDataFlow dir, ERole role, IMMDevice** ppDevice);
267 int32_t _GetListDevice(EDataFlow dir, int index, IMMDevice** ppDevice); 265 int32_t _GetListDevice(EDataFlow dir, int index, IMMDevice** ppDevice);
268 266
269 // Converts from wide-char to UTF-8 if UNICODE is defined. 267 // Converts from wide-char to UTF-8 if UNICODE is defined.
270 // Does nothing if UNICODE is undefined. 268 // Does nothing if UNICODE is undefined.
271 char* WideToUTF8(const TCHAR* src) const; 269 char* WideToUTF8(const TCHAR* src) const;
272 270
273 int32_t InitRecordingDMO(); 271 int32_t InitRecordingDMO();
274 272
275 private:
276 ScopedCOMInitializer _comInit; 273 ScopedCOMInitializer _comInit;
277 AudioDeviceBuffer* _ptrAudioBuffer; 274 AudioDeviceBuffer* _ptrAudioBuffer;
278 CriticalSectionWrapper& _critSect; 275 rtc::CriticalSection _critSect;
279 CriticalSectionWrapper& _volumeMutex; 276 rtc::CriticalSection _volumeMutex;
280 int32_t _id; 277 int32_t _id;
281 278
282 private: // MMDevice
283 IMMDeviceEnumerator* _ptrEnumerator; 279 IMMDeviceEnumerator* _ptrEnumerator;
284 IMMDeviceCollection* _ptrRenderCollection; 280 IMMDeviceCollection* _ptrRenderCollection;
285 IMMDeviceCollection* _ptrCaptureCollection; 281 IMMDeviceCollection* _ptrCaptureCollection;
286 IMMDevice* _ptrDeviceOut; 282 IMMDevice* _ptrDeviceOut;
287 IMMDevice* _ptrDeviceIn; 283 IMMDevice* _ptrDeviceIn;
288 284
289 private: // WASAPI
290 IAudioClient* _ptrClientOut; 285 IAudioClient* _ptrClientOut;
291 IAudioClient* _ptrClientIn; 286 IAudioClient* _ptrClientIn;
292 IAudioRenderClient* _ptrRenderClient; 287 IAudioRenderClient* _ptrRenderClient;
293 IAudioCaptureClient* _ptrCaptureClient; 288 IAudioCaptureClient* _ptrCaptureClient;
294 IAudioEndpointVolume* _ptrCaptureVolume; 289 IAudioEndpointVolume* _ptrCaptureVolume;
295 ISimpleAudioVolume* _ptrRenderSimpleVolume; 290 ISimpleAudioVolume* _ptrRenderSimpleVolume;
296 291
297 // DirectX Media Object (DMO) for the built-in AEC. 292 // DirectX Media Object (DMO) for the built-in AEC.
298 rtc::scoped_refptr<IMediaObject> _dmo; 293 rtc::scoped_refptr<IMediaObject> _dmo;
299 rtc::scoped_refptr<IMediaBuffer> _mediaBuffer; 294 rtc::scoped_refptr<IMediaBuffer> _mediaBuffer;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 uint16_t _newMicLevel; 364 uint16_t _newMicLevel;
370 365
371 mutable char _str[512]; 366 mutable char _str[512];
372 }; 367 };
373 368
374 #endif // #if (_MSC_VER >= 1400) 369 #endif // #if (_MSC_VER >= 1400)
375 370
376 } // namespace webrtc 371 } // namespace webrtc
377 372
378 #endif // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_CORE_WIN_H_ 373 #endif // WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_CORE_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698