diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index cc295273..d6ecc131 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -7817,6 +7817,8 @@ if test "$enable_winepulse_PulseAudio_Support" -eq 1; then patch_apply winepulse-PulseAudio_Support/0006-winepulse-fetch-actual-program-name-if-possible.patch patch_apply winepulse-PulseAudio_Support/0007-winepulse-return-PKEY_AudioEndpoint_PhysicalSpeakers.patch patch_apply winepulse-PulseAudio_Support/0008-winepulse-Fix-up-recording.patch + patch_apply winepulse-PulseAudio_Support/0009-winepulse.drv-Fix-getting-the-same-timing-info.patch + patch_apply winepulse-PulseAudio_Support/0010-winepulse-Update-last-time-on-underrun.patch ( printf '%s\n' '+ { "Sebastian Lackner", "winepulse.drv: Use a separate mainloop and ctx for pulse_test_connect.", 1 },'; printf '%s\n' '+ { "Andrew Eikum", "winepulse: Don'\''t rely on pulseaudio callbacks for timing.", 1 },'; @@ -7826,6 +7828,8 @@ if test "$enable_winepulse_PulseAudio_Support" -eq 1; then printf '%s\n' '+ { "Mark Harmstone", "winepulse: Fetch actual program name if possible.", 1 },'; printf '%s\n' '+ { "Mark Harmstone", "winepulse: Return PKEY_AudioEndpoint_PhysicalSpeakers device prop.", 1 },'; printf '%s\n' '+ { "Andrew Eikum", "winepulse: Fix up recording.", 1 },'; + printf '%s\n' '+ { "Zhiyi Zhang", "winepulse.drv: Fix getting the same timing info.", 1 },'; + printf '%s\n' '+ { "Andrew Eikum", "winepulse: Update last time on underrun.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/winepulse-PulseAudio_Support/0009-winepulse.drv-Fix-getting-the-same-timing-info.patch b/patches/winepulse-PulseAudio_Support/0009-winepulse.drv-Fix-getting-the-same-timing-info.patch new file mode 100644 index 00000000..0c1bbe81 --- /dev/null +++ b/patches/winepulse-PulseAudio_Support/0009-winepulse.drv-Fix-getting-the-same-timing-info.patch @@ -0,0 +1,73 @@ +From d2238287ffb1db3ebde4339548019920c694abbc Mon Sep 17 00:00:00 2001 +From: Zhiyi Zhang +Date: Mon, 27 Aug 2018 08:20:17 -0500 +Subject: winepulse.drv: Fix getting the same timing info. +To: wine-devel +Reply-To: wine-devel ,Andrew Eikum +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="------------2.18.0" + +This is a multi-part message in MIME format. +--------------2.18.0 +Content-Type: text/plain; charset=UTF-8; format=fixed +Content-Transfer-Encoding: 8bit + + +pa_stream_get_time would return the same time if pa_stream_update_timing_info +is not called before, causing wrong delay. Since we're updating the timing +info by ourselves, no need to use PA_STREAM_AUTO_TIMING_UPDATE. Also +PA_STREAM_INTERPOLATE_TIMING is removed because we want the real time. +--- + dlls/winepulse.drv/mmdevdrv.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + + +--------------2.18.0 +Content-Type: text/x-patch; name="0009-winepulse.drv-Fix-getting-the-same-timing-info.patch" +Content-Transfer-Encoding: 8bit +Content-Disposition: inline; filename="0009-winepulse.drv-Fix-getting-the-same-timing-info.patch" + +diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c +index 5d74ce093d..48ed585cc1 100644 +--- a/dlls/winepulse.drv/mmdevdrv.c ++++ b/dlls/winepulse.drv/mmdevdrv.c +@@ -1082,6 +1082,8 @@ static DWORD WINAPI pulse_timer_cb(void *user) + DWORD delay; + UINT32 adv_bytes; + ACImpl *This = user; ++ int success; ++ pa_operation *o; + + pthread_mutex_lock(&pulse_lock); + delay = This->mmdev_period_usec / 1000; +@@ -1098,6 +1100,13 @@ static DWORD WINAPI pulse_timer_cb(void *user) + + delay = This->mmdev_period_usec / 1000; + ++ o = pa_stream_update_timing_info(This->stream, pulse_op_cb, &success); ++ if (o) ++ { ++ while (pa_operation_get_state(o) == PA_OPERATION_RUNNING) ++ pthread_cond_wait(&pulse_cond, &pulse_lock); ++ pa_operation_unref(o); ++ } + err = pa_stream_get_time(This->stream, &now); + if(err == 0){ + TRACE("got now: %s, last time: %s\n", wine_dbgstr_longlong(now), wine_dbgstr_longlong(This->last_time)); +@@ -1194,10 +1203,10 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) { + + if (This->dataflow == eRender) + ret = pa_stream_connect_playback(This->stream, NULL, &attr, +- PA_STREAM_START_CORKED|PA_STREAM_START_UNMUTED|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_ADJUST_LATENCY|moving, NULL, NULL); ++ PA_STREAM_START_CORKED|PA_STREAM_START_UNMUTED|PA_STREAM_ADJUST_LATENCY|moving, NULL, NULL); + else + ret = pa_stream_connect_record(This->stream, NULL, &attr, +- PA_STREAM_START_CORKED|PA_STREAM_START_UNMUTED|PA_STREAM_AUTO_TIMING_UPDATE|PA_STREAM_INTERPOLATE_TIMING|PA_STREAM_ADJUST_LATENCY|moving); ++ PA_STREAM_START_CORKED|PA_STREAM_START_UNMUTED|PA_STREAM_ADJUST_LATENCY|moving); + if (ret < 0) { + WARN("Returns %i\n", ret); + return AUDCLNT_E_ENDPOINT_CREATE_FAILED; + +--------------2.18.0-- + + diff --git a/patches/winepulse-PulseAudio_Support/0010-winepulse-Update-last-time-on-underrun.patch b/patches/winepulse-PulseAudio_Support/0010-winepulse-Update-last-time-on-underrun.patch new file mode 100644 index 00000000..1a212d3f --- /dev/null +++ b/patches/winepulse-PulseAudio_Support/0010-winepulse-Update-last-time-on-underrun.patch @@ -0,0 +1,44 @@ +From 5b10bce652ede36e8f6861b9086933ce97889696 Mon Sep 17 00:00:00 2001 +From: Andrew Eikum +Date: Mon, 27 Aug 2018 08:33:32 -0500 +Subject: winepulse: Update last time on underrun +To: wine-devel +Reply-To: wine-devel ,Andrew Eikum +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="------------2.18.0" + +This is a multi-part message in MIME format. +--------------2.18.0 +Content-Type: text/plain; charset=UTF-8; format=fixed +Content-Transfer-Encoding: 8bit + +--- + dlls/winepulse.drv/mmdevdrv.c | 5 +++++ + 1 file changed, 5 insertions(+) + + +--------------2.18.0 +Content-Type: text/x-patch; name="0010-winepulse-Update-last-time-on-underrun.patch" +Content-Transfer-Encoding: 8bit +Content-Disposition: inline; filename="0010-winepulse-Update-last-time-on-underrun.patch" + +diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c +index 48ed585cc1..1ce6cea9d6 100644 +--- a/dlls/winepulse.drv/mmdevdrv.c ++++ b/dlls/winepulse.drv/mmdevdrv.c +@@ -1111,6 +1111,11 @@ static DWORD WINAPI pulse_timer_cb(void *user) + if(err == 0){ + TRACE("got now: %s, last time: %s\n", wine_dbgstr_longlong(now), wine_dbgstr_longlong(This->last_time)); + if(This->started && (This->dataflow == eCapture || This->held_bytes)){ ++ if(This->just_underran){ ++ This->last_time = now; ++ This->just_started = TRUE; ++ } ++ + if(This->just_started){ + /* let it play out a period to absorb some latency and get accurate timing */ + pa_usec_t diff = now - This->last_time; + +--------------2.18.0-- + +