Andrew Eikum : winepulse.drv: Print a winediag error when PA buffer size is too small.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Dec 12 10:41:43 CST 2015


Module: wine
Branch: master
Commit: a599ea83c8148685c2b3e69102aaf4cf3c2d48f3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a599ea83c8148685c2b3e69102aaf4cf3c2d48f3

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu Dec 10 10:35:55 2015 -0600

winepulse.drv: Print a winediag error when PA buffer size is too small.

winepulse depends on PulseAudio to allocate the entire requested
buffer size. If it allocates less than that size, then mmdevapi
clients may not be able to write as much data as they expect. So, we
should warn the user that the PA buffer is too small.

This is a common symptom of users setting the PULSE_LATENCY_MSEC
environment variable, which would help in some situations with
winealsa, but is no longer required with winepulse.

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winepulse.drv/mmdevdrv.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 0e6cf9f..ef171d3 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -57,6 +57,7 @@
 #include "audiopolicy.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(pulse);
+WINE_DECLARE_DEBUG_CHANNEL(winediag);
 
 #define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
 
@@ -1336,9 +1337,16 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
         const pa_buffer_attr *attr = pa_stream_get_buffer_attr(This->stream);
         /* Update frames according to new size */
         dump_attr(attr);
-        if (This->dataflow == eRender)
+        if (This->dataflow == eRender) {
+            if (attr->tlength < This->bufsize_bytes) {
+                const char *latenv = getenv("PULSE_LATENCY_MSEC");
+                if (latenv && *latenv)
+                    ERR_(winediag)("PulseAudio buffer too small (%u < %u) - PULSE_LATENCY_MSEC is %s\n", attr->tlength, This->bufsize_bytes, latenv);
+                else
+                    ERR_(winediag)("PulseAudio buffer too small (%u < %u)\n", attr->tlength, This->bufsize_bytes);
+            }
             This->bufsize_bytes = attr->tlength;
-        else {
+        } else {
             This->capture_period = period_bytes = attr->fragsize;
             if ((unalign = This->bufsize_bytes % period_bytes))
                 This->bufsize_bytes += period_bytes - unalign;




More information about the wine-cvs mailing list