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

Unified Diff: media/audio/win/audio_low_latency_input_win.h

Issue 1097553003: Switch to STA mode for audio thread and WASAPI I/O streams. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/win/audio_low_latency_input_win.h
diff --git a/media/audio/win/audio_low_latency_input_win.h b/media/audio/win/audio_low_latency_input_win.h
index e933a4471303817b75ae38127cf7dd7db51eab39..9dbc70dca5f1d934c5043d62e9fca6bc43905bb8 100644
--- a/media/audio/win/audio_low_latency_input_win.h
+++ b/media/audio/win/audio_low_latency_input_win.h
@@ -131,6 +131,10 @@ class MEDIA_EXPORT WASAPIAudioInputStream
WAVEFORMATEX** device_format,
int* effects);
+ // Handles sharing of COM pointers between the audio and capture threads.
+ bool MarshalComPointers();
+ bool UnmarshalComPointers(IAudioCaptureClient** audio_capture_client);
+
// Our creator, the audio manager needs to be notified when we close.
AudioManagerWin* manager_;
@@ -179,8 +183,17 @@ class MEDIA_EXPORT WASAPIAudioInputStream
// Pointer to the object that will receive the recorded audio samples.
AudioInputCallback* sink_;
- // Windows Multimedia Device (MMDevice) API interfaces.
+ // ------------------------------------------------------
+ // Warning: COM pointers must be marshaled from the audio thread to be used
+ // on any other thread. Do not use any of these interfaces on a thread other
+ // than the audio thread. See MarshalComPointers() and UnmarshalComPointers()
+ // for marshaling pointers to the capture thread.
+
+ // Stream into which the COM pointers below are marshaled so that they can
+ // be used on another thread.
+ IStream* com_stream_;
+ // Windows Multimedia Device (MMDevice) API interfaces.
// An IMMDevice interface which represents an audio endpoint device.
base::win::ScopedComPtr<IMMDevice> endpoint_device_;
@@ -198,16 +211,17 @@ class MEDIA_EXPORT WASAPIAudioInputStream
// details.
base::win::ScopedComPtr<IAudioClient> audio_render_client_for_loopback_;
- // The IAudioCaptureClient interface enables a client to read input data
- // from a capture endpoint buffer.
- base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_;
-
// The ISimpleAudioVolume interface enables a client to control the
// master volume level of an audio session.
// The volume-level is a value in the range 0.0 to 1.0.
// This interface does only work with shared-mode streams.
base::win::ScopedComPtr<ISimpleAudioVolume> simple_audio_volume_;
+ // The IAudioCaptureClient interface enables a client to read input data
+ // from a capture endpoint buffer.
+ base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_;
+ // ------------------------------------------------------
+
// The audio engine will signal this event each time a buffer has been
// recorded.
base::win::ScopedHandle audio_samples_ready_event_;

Powered by Google App Engine
This is Rietveld 408576698