diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-05-27 14:31:55 +0200 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-08-02 17:00:03 +0530 |
commit | 5a1b37b1f3977e516e9f5fffd7299def3162b3f7 (patch) | |
tree | 2648a44076f97acb526ec0a37ef772f56e02840f /sys/wasapi | |
parent | f460448198e44676b41c95ff5f32401f1b54fd4e (diff) | |
download | gstreamer-plugins-bad-5a1b37b1f3977e516e9f5fffd7299def3162b3f7.tar.gz |
wasapisink: fix regression in shared mode segment size
In commit fd806628a8 (839cc3926 in the stable branch) I changed the
segment size to match exactly the buffer size. I missed that this is
only valid in exclusive mode and in shared mode the buffer size is
a multiple of the device period.
Revert the logic for the shared mode.
https://bugzilla.gnome.org/show_bug.cgi?id=796354
https://bugzilla.gnome.org/show_bug.cgi?id=796858
Diffstat (limited to 'sys/wasapi')
-rw-r--r-- | sys/wasapi/gstwasapiutil.c | 12 |
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; } |