[PATCH v9 5/9] winepulse.drv: store and use device period on stream creation

Claire Girka wine at gitlab.winehq.org
Mon Jul 4 14:46:54 CDT 2022


From: Claire Girka <claire at sitedethib.com>

---
 dlls/winepulse.drv/pulse.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c
index fe0bd2b0cec..860fe6730ed 100644
--- a/dlls/winepulse.drv/pulse.c
+++ b/dlls/winepulse.drv/pulse.c
@@ -57,6 +57,8 @@ struct pulse_stream
     HANDLE event;
     float vol[PA_CHANNELS_MAX];
 
+    REFERENCE_TIME def_period;
+
     INT32 locked;
     BOOL started;
     SIZE_T bufsize_frames, real_bufsize_bytes, period_bytes;
@@ -1125,6 +1127,8 @@ static NTSTATUS pulse_create_stream(void *args)
     REFERENCE_TIME period, duration = params->duration;
     struct pulse_stream *stream;
     unsigned int i, bufsize_bytes;
+    struct list *list = (params->dataflow == eRender) ? &g_phys_speakers : &g_phys_sources;
+    PhysDevice *dev;
     HRESULT hr;
 
     pulse_lock();
@@ -1152,10 +1156,23 @@ static NTSTATUS pulse_create_stream(void *args)
     if (FAILED(hr))
         goto exit;
 
-    period = pulse_def_period[stream->dataflow == eCapture];
+    period = 0;
+    LIST_FOR_EACH_ENTRY(dev, list, PhysDevice, entry) {
+        if (strcmp(params->pulse_name, dev->pulse_name)) {
+            period = dev->def_period;
+            break;
+        }
+    }
+    if (!period) {
+        params->result = E_FAIL;
+        return STATUS_SUCCESS;
+    }
+
     if (duration < 3 * period)
         duration = 3 * period;
 
+    stream->def_period = period;
+
     stream->period_bytes = pa_frame_size(&stream->ss) * muldiv(period, stream->ss.rate, 10000000);
 
     stream->bufsize_frames = ceil((duration / 10000000.) * params->fmt->nSamplesPerSec);
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/337



More information about the wine-devel mailing list