From d792ec8a459ffac3952672e7cfa17acf85428ad6 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 28 Nov 2018 09:20:45 +1100 Subject: [PATCH] Updated winepulse-PulseAudio_Support patchset --- patches/patchinstall.sh | 6 +++ ...t-for-PA-devices-that-fall-way-behin.patch | 40 +++++++++++++++++++ ...lse-Fix-local-buffer-offset-wrapping.patch | 26 ++++++++++++ ...fake-being-one-period-behind-in-GetP.patch | 33 +++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 patches/winepulse-PulseAudio_Support/0011-winepulse-account-for-PA-devices-that-fall-way-behin.patch create mode 100644 patches/winepulse-PulseAudio_Support/0012-winepulse-Fix-local-buffer-offset-wrapping.patch create mode 100644 patches/winepulse-PulseAudio_Support/0013-winepulse-Don-t-fake-being-one-period-behind-in-GetP.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index dc2b7a7c..bf933f15 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -7465,6 +7465,9 @@ if test "$enable_winepulse_PulseAudio_Support" -eq 1; then 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 + patch_apply winepulse-PulseAudio_Support/0011-winepulse-account-for-PA-devices-that-fall-way-behin.patch + patch_apply winepulse-PulseAudio_Support/0012-winepulse-Fix-local-buffer-offset-wrapping.patch + patch_apply winepulse-PulseAudio_Support/0013-winepulse-Don-t-fake-being-one-period-behind-in-GetP.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 },'; @@ -7476,6 +7479,9 @@ if test "$enable_winepulse_PulseAudio_Support" -eq 1; then 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 },'; + printf '%s\n' '+ { "Andrew Eikum", "winepulse: Account for PA devices that fall way behind.", 1 },'; + printf '%s\n' '+ { "Andrew Eikum", "winepulse: Fix local buffer offset wrapping.", 1 },'; + printf '%s\n' '+ { "Andrew Eikum", "winepulse: Don'\''t fake being one period behind in GetPosition.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/winepulse-PulseAudio_Support/0011-winepulse-account-for-PA-devices-that-fall-way-behin.patch b/patches/winepulse-PulseAudio_Support/0011-winepulse-account-for-PA-devices-that-fall-way-behin.patch new file mode 100644 index 00000000..303c7c73 --- /dev/null +++ b/patches/winepulse-PulseAudio_Support/0011-winepulse-account-for-PA-devices-that-fall-way-behin.patch @@ -0,0 +1,40 @@ +From 262abc1d8daf243cf295c060ff4c47f93dcdbe2f Mon Sep 17 00:00:00 2001 +From: Andrew Eikum +Date: Tue, 4 Sep 2018 13:40:58 -0500 +Subject: [PATCH 1/3] winepulse: account for PA devices that fall way behind +To: wine-devel +Reply-To: wine-devel ,Andrew Eikum + +--- + dlls/winepulse.drv/mmdevdrv.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c +index 1ce6cea9d6..6b994ada4e 100644 +--- a/dlls/winepulse.drv/mmdevdrv.c ++++ b/dlls/winepulse.drv/mmdevdrv.c +@@ -980,6 +980,9 @@ static void pulse_underflow_callback(pa_stream *s, void *userdata) + ACImpl *This = userdata; + WARN("%p: Underflow\n", userdata); + This->just_underran = TRUE; ++ /* re-sync */ ++ This->pa_offs_bytes = This->lcl_offs_bytes; ++ This->pa_held_bytes = This->held_bytes; + } + + static void pulse_started_callback(pa_stream *s, void *userdata) +@@ -2524,6 +2527,11 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer( + + This->held_bytes += written_bytes; + This->pa_held_bytes += written_bytes; ++ if(This->pa_held_bytes > This->real_bufsize_bytes){ ++ This->pa_offs_bytes += This->pa_held_bytes - This->real_bufsize_bytes; ++ This->pa_offs_bytes %= This->real_bufsize_bytes; ++ This->pa_held_bytes = This->real_bufsize_bytes; ++ } + This->clock_written += written_bytes; + This->locked = 0; + +-- +2.19.2 + diff --git a/patches/winepulse-PulseAudio_Support/0012-winepulse-Fix-local-buffer-offset-wrapping.patch b/patches/winepulse-PulseAudio_Support/0012-winepulse-Fix-local-buffer-offset-wrapping.patch new file mode 100644 index 00000000..49b5bb37 --- /dev/null +++ b/patches/winepulse-PulseAudio_Support/0012-winepulse-Fix-local-buffer-offset-wrapping.patch @@ -0,0 +1,26 @@ +From 6f0f6b7e3d3a28df29577f7da93f8e3837386ab1 Mon Sep 17 00:00:00 2001 +From: Andrew Eikum +Date: Fri, 19 Oct 2018 14:22:35 -0500 +Subject: [PATCH 2/3] winepulse: Fix local buffer offset wrapping +To: wine-devel +Reply-To: wine-devel ,Andrew Eikum + +--- + dlls/winepulse.drv/mmdevdrv.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c +index 6b994ada4e..fb2e3678f8 100644 +--- a/dlls/winepulse.drv/mmdevdrv.c ++++ b/dlls/winepulse.drv/mmdevdrv.c +@@ -1148,6 +1148,7 @@ static DWORD WINAPI pulse_timer_cb(void *user) + /* regardless of what PA does, advance one period */ + adv_bytes = min(This->period_bytes, This->held_bytes); + This->lcl_offs_bytes += adv_bytes; ++ This->lcl_offs_bytes %= This->real_bufsize_bytes; + This->held_bytes -= adv_bytes; + }else if(This->dataflow == eCapture){ + pulse_read(This); +-- +2.19.2 + diff --git a/patches/winepulse-PulseAudio_Support/0013-winepulse-Don-t-fake-being-one-period-behind-in-GetP.patch b/patches/winepulse-PulseAudio_Support/0013-winepulse-Don-t-fake-being-one-period-behind-in-GetP.patch new file mode 100644 index 00000000..784f5474 --- /dev/null +++ b/patches/winepulse-PulseAudio_Support/0013-winepulse-Don-t-fake-being-one-period-behind-in-GetP.patch @@ -0,0 +1,33 @@ +From cf1e1aa8a37ea52f70874931b80611eee7a27f83 Mon Sep 17 00:00:00 2001 +From: Andrew Eikum +Date: Mon, 26 Nov 2018 15:04:38 -0600 +Subject: [PATCH 3/3] winepulse: Don't fake being one period behind in + GetPosition +To: wine-devel +Reply-To: wine-devel ,Andrew Eikum + +--- + dlls/winepulse.drv/mmdevdrv.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c +index fb2e3678f8..39284e55ad 100644 +--- a/dlls/winepulse.drv/mmdevdrv.c ++++ b/dlls/winepulse.drv/mmdevdrv.c +@@ -2769,13 +2769,6 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos, + + *pos = This->clock_written - This->held_bytes; + +- if(This->started){ +- if(*pos < This->period_bytes) +- *pos = 0; +- else if(This->held_bytes > This->period_bytes) +- *pos -= This->period_bytes; +- } +- + if (This->share == AUDCLNT_SHAREMODE_EXCLUSIVE) + *pos /= pa_frame_size(&This->ss); + +-- +2.19.2 +