summaryrefslogtreecommitdiff
path: root/sys/wasapi/gstwasapiutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/wasapi/gstwasapiutil.c')
-rw-r--r--sys/wasapi/gstwasapiutil.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/wasapi/gstwasapiutil.c b/sys/wasapi/gstwasapiutil.c
index e1ac7e568..1ca535722 100644
--- a/sys/wasapi/gstwasapiutil.c
+++ b/sys/wasapi/gstwasapiutil.c
@@ -899,10 +899,16 @@ gst_wasapi_util_initialize_audioclient (GstElement * self,
}
HR_FAILED_RET (hr, IAudioClient::Initialize, FALSE);
- hr = IAudioClient_GetBufferSize (client, &n_frames);
- HR_FAILED_RET (hr, IAudioClient::GetBufferSize, FALSE);
+ if (sharemode == AUDCLNT_SHAREMODE_EXCLUSIVE) {
+ /* We use the device period for the segment size and that needs to match
+ * the buffer size exactly when we write into it */
+ hr = IAudioClient_GetBufferSize (client, &n_frames);
+ HR_FAILED_RET (hr, IAudioClient::GetBufferSize, FALSE);
- *ret_devicep_frames = n_frames;
+ *ret_devicep_frames = n_frames;
+ } else {
+ *ret_devicep_frames = (rate * device_period * 100) / GST_SECOND;
+ }
return TRUE;
}