summaryrefslogtreecommitdiff
path: root/sys/wasapi2
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2021-06-06 17:32:59 +0900
committerSeungha Yang <seungha@centricular.com>2021-06-08 19:39:26 +0900
commit4b42671c9924674e77b8b35f3b22abab651e8bb3 (patch)
tree2af422ebc7640a7edbcd016f4b37989f1bebcbfb /sys/wasapi2
parentd5384ffbd0f101173d200e214e9ad488886c1db7 (diff)
downloadgstreamer-plugins-bad-4b42671c9924674e77b8b35f3b22abab651e8bb3.tar.gz
wasapi2: Use AUDCLNT_STREAMFLAGS_NOPERSIST flag
... so that we can disable persistence of our mute/volume status Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2306>
Diffstat (limited to 'sys/wasapi2')
-rw-r--r--sys/wasapi2/gstwasapi2client.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/wasapi2/gstwasapi2client.cpp b/sys/wasapi2/gstwasapi2client.cpp
index 286fc93a8..b7555e4d5 100644
--- a/sys/wasapi2/gstwasapi2client.cpp
+++ b/sys/wasapi2/gstwasapi2client.cpp
@@ -1210,6 +1210,8 @@ gst_wasapi2_client_initialize_audio_client3 (GstWasapi2Client * self)
{
HRESULT hr = S_OK;
UINT32 default_period, fundamental_period, min_period, max_period;
+ /* AUDCLNT_STREAMFLAGS_NOPERSIST is not allowed for
+ * InitializeSharedAudioStream */
DWORD stream_flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
WAVEFORMATEX *format = NULL;
UINT32 period;
@@ -1282,7 +1284,8 @@ gst_wasapi2_client_initialize_audio_client (GstWasapi2Client * self,
REFERENCE_TIME default_period, min_period;
REFERENCE_TIME device_period, device_buffer_duration;
guint rate;
- DWORD stream_flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
+ DWORD stream_flags =
+ AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST;
HRESULT hr;
IAudioClient3 *audio_client = self->audio_client;
@@ -1440,14 +1443,6 @@ gst_wasapi2_client_open (GstWasapi2Client * client,
return hr;
client->audio_volume = audio_volume.Detach ();
-
- /* this mute state seems to be global setting for this device
- * but below documentation looks unclear why mute state is preserved
- * even after process is terminated
- * https://docs.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-isimpleaudiovolume-setmute
- * Explicitly disable mute so that ensure we can produce or play audio
- * regardless of previous status
- */
client->audio_volume->SetMute (FALSE, nullptr);
gst_audio_ring_buffer_set_channel_positions (buf, client->positions);