Rebase against 8f3bd63b52f03ff05e9d2a00a2e129a0b0092969.

This commit is contained in:
Zebediah Figura 2020-08-18 19:40:50 -05:00
parent 28fad42582
commit 7d08bb86e1
14 changed files with 30 additions and 1390 deletions

View File

@ -1,4 +1,4 @@
From f058e0e1425aab869a1a7d0db0446944af9bc8d6 Mon Sep 17 00:00:00 2001
From 51cde3dff5de27d1aebc964a4802758534d56773 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 5 Aug 2017 03:39:55 +0200
Subject: [PATCH] ntdll: Implement process token elevation through manifests.
@ -74,7 +74,7 @@ index 6290cbcb4e6..9a8f13901b2 100644
RemoveEntryList( &wm->ldr.InLoadOrderLinks );
InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderLinks );
diff --git a/server/process.c b/server/process.c
index 7875db09801..d7334ffc959 100644
index fa8495511e0..df72efdecc8 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1086,6 +1086,14 @@ int set_process_debug_flag( struct process *process, int flag )
@ -93,7 +93,7 @@ index 7875db09801..d7334ffc959 100644
DECL_HANDLER(new_process)
{
diff --git a/server/process.h b/server/process.h
index 3944a67d571..3cbf70fda21 100644
index 0fdf070b78e..43e8cc1ad7e 100644
--- a/server/process.h
+++ b/server/process.h
@@ -129,6 +129,7 @@ extern void kill_console_processes( struct thread *renderer, int exit_code );
@ -103,12 +103,12 @@ index 3944a67d571..3cbf70fda21 100644
+extern void replace_process_token( struct process *process, struct token *token );
/* console functions */
extern obj_handle_t inherit_console( struct thread *parent_thread, struct process *parent,
extern obj_handle_t inherit_console( struct thread *parent_thread, obj_handle_t handle,
diff --git a/server/protocol.def b/server/protocol.def
index b84d1d10004..65bcb99d486 100644
index a9308904afc..8c40fba8d0a 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3526,6 +3526,13 @@ struct handle_info
@@ -3489,6 +3489,13 @@ struct handle_info
@END
@ -145,5 +145,5 @@ index 970ed1838da..1c1d49989b3 100644
+ }
+}
--
2.27.0
2.28.0

View File

@ -1,48 +0,0 @@
From bb72b7bf3df86b284c169125e52d6e385ff46cbc Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 2 Feb 2016 12:53:47 +0800
Subject: [PATCH] ole32: Add a check for hglobal pointer to
GetHGlobalFromStream.
---
dlls/ole32/hglobalstream.c | 4 ++--
dlls/ole32/tests/hglobalstream.c | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/ole32/hglobalstream.c b/dlls/ole32/hglobalstream.c
index 4590bb9c431..4cfedd66a1b 100644
--- a/dlls/ole32/hglobalstream.c
+++ b/dlls/ole32/hglobalstream.c
@@ -664,10 +664,10 @@ HRESULT WINAPI GetHGlobalFromStream(IStream* pstm, HGLOBAL* phglobal)
{
HGLOBALStreamImpl* pStream;
- if (pstm == NULL)
+ if (!pstm || !phglobal)
return E_INVALIDARG;
- pStream = (HGLOBALStreamImpl*) pstm;
+ pStream = impl_from_IStream(pstm);
/*
* Verify that the stream object was created with CreateStreamOnHGlobal.
diff --git a/dlls/ole32/tests/hglobalstream.c b/dlls/ole32/tests/hglobalstream.c
index 2f386914afc..5bcf9abfbda 100644
--- a/dlls/ole32/tests/hglobalstream.c
+++ b/dlls/ole32/tests/hglobalstream.c
@@ -561,6 +561,12 @@ static void test_IStream_Clone(void)
hr = CreateStreamOnHGlobal(orig_hmem, TRUE, &stream);
ok(hr == S_OK, "unexpected %#x\n", hr);
+ hr = GetHGlobalFromStream(stream, NULL);
+ ok(hr == E_INVALIDARG, "unexpected %#x\n", hr);
+
+ hr = GetHGlobalFromStream(NULL, &hmem);
+ ok(hr == E_INVALIDARG, "unexpected %#x\n", hr);
+
stream_info(stream, &hmem, &size, &pos);
ok(hmem == orig_hmem, "handles should match\n");
ok(size == 0, "unexpected %d\n", size);
--
2.27.0

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "019fcaa36410f5b52e9c3fb90a621b56a4f10f35"
echo "8f3bd63b52f03ff05e9d2a00a2e129a0b0092969"
}
# Show version information
@ -205,7 +205,6 @@ patch_enable_all ()
enable_nvcuda_CUDA_Support="$1"
enable_nvcuvid_CUDA_Video_Support="$1"
enable_nvencodeapi_Video_Encoder="$1"
enable_ole32_HGLOBALStream="$1"
enable_oleaut32_CreateTypeLib="$1"
enable_oleaut32_Load_Save_EMF="$1"
enable_oleaut32_OLEPictureImpl_SaveAsFile="$1"
@ -706,9 +705,6 @@ patch_enable ()
nvencodeapi-Video_Encoder)
enable_nvencodeapi_Video_Encoder="$2"
;;
ole32-HGLOBALStream)
enable_ole32_HGLOBALStream="$2"
;;
oleaut32-CreateTypeLib)
enable_oleaut32_CreateTypeLib="$2"
;;
@ -4196,18 +4192,6 @@ if test "$enable_nvencodeapi_Video_Encoder" -eq 1; then
) >> "$patchlist"
fi
# Patchset ole32-HGLOBALStream
# |
# | Modified files:
# | * dlls/ole32/hglobalstream.c, dlls/ole32/tests/hglobalstream.c
# |
if test "$enable_ole32_HGLOBALStream" -eq 1; then
patch_apply ole32-HGLOBALStream/0002-ole32-Add-a-check-for-hglobal-pointer-to-GetHGlobalF.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "ole32: Add a check for hglobal pointer to GetHGlobalFromStream.", 1 },';
) >> "$patchlist"
fi
# Patchset oleaut32-CreateTypeLib
# |
# | This patchset fixes the following Wine bugs:
@ -5966,39 +5950,22 @@ fi
# |
# | This patchset fixes the following Wine bugs:
# | * [#37042] Implement exclusive mode in PulseAudio backend
# | * [#28282] Sound constantly crackling in a lot of games
# |
# | Modified files:
# | * dlls/winepulse.drv/Makefile.in, dlls/winepulse.drv/mmdevdrv.c
# |
if test "$enable_winepulse_PulseAudio_Support" -eq 1; then
patch_apply winepulse-PulseAudio_Support/0001-winepulse.drv-Use-a-separate-mainloop-and-ctx-for-pu.patch
patch_apply winepulse-PulseAudio_Support/0002-winepulse-Don-t-rely-on-pulseaudio-callbacks-for-tim.patch
patch_apply winepulse-PulseAudio_Support/0003-winepulse-expose-audio-devices-directly-to-programs.patch
patch_apply winepulse-PulseAudio_Support/0004-winepulse-fix-segfault-in-pulse_rd_loop.patch
patch_apply winepulse-PulseAudio_Support/0005-winepulse-implement-GetPropValue.patch
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
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 },';
printf '%s\n' '+ { "Mark Harmstone", "winepulse: Expose audio devices directly to programs.", 1 },';
printf '%s\n' '+ { "Mark Harmstone", "winepulse: Fix segfault in pulse_rd_loop.", 1 },';
printf '%s\n' '+ { "Mark Harmstone", "winepulse: Implement GetPropValue.", 1 },';
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 },';
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

View File

@ -1,7 +1,7 @@
From 0f1a7d67f08eb916407ed4e8f2eb51e829b8c876 Mon Sep 17 00:00:00 2001
From 5e002013b359e3278e9c1ef30514e4be274ea032 Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Mon, 3 Nov 2014 02:06:40 +0000
Subject: [PATCH 3/7] winepulse: expose audio devices directly to programs
Subject: [PATCH] winepulse: expose audio devices directly to programs
At present, winepulse only exposes one input device and one output device. This
patch adds support for individual audio devices, allowing (among other things)
@ -16,11 +16,11 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Some style fixes and better error handling
* Move initialization code to pulse_test_connect()
---
dlls/winepulse.drv/mmdevdrv.c | 252 +++++++++++++++++++++++++++++++++++++-----
dlls/winepulse.drv/mmdevdrv.c | 252 ++++++++++++++++++++++++++++++----
1 file changed, 224 insertions(+), 28 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 0039c34..e521794 100644
index 7fc7dccb367..59cfa3db4f2 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -79,12 +79,25 @@ static pthread_mutex_t pulse_lock;
@ -49,7 +49,7 @@ index 0039c34..e521794 100644
static GUID pulse_render_guid =
{ 0xfd47d9cc, 0x4218, 0x4135, { 0x9c, 0xe2, 0x0c, 0x19, 0x5c, 0x87, 0x40, 0x5b } };
static GUID pulse_capture_guid =
@@ -103,6 +116,13 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
@@ -106,6 +119,13 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
if (pthread_mutex_init(&pulse_lock, &attr) != 0)
pthread_mutex_init(&pulse_lock, NULL);
} else if (reason == DLL_PROCESS_DETACH) {
@ -63,7 +63,7 @@ index 0039c34..e521794 100644
if (pulse_thread)
SetThreadPriority(pulse_thread, 0);
if (pulse_ctx) {
@@ -164,6 +184,7 @@ struct ACImpl {
@@ -167,6 +187,7 @@ struct ACImpl {
IMMDevice *parent;
struct list entry;
float vol[PA_CHANNELS_MAX];
@ -71,7 +71,7 @@ index 0039c34..e521794 100644
LONG ref;
EDataFlow dataflow;
@@ -193,8 +214,6 @@ struct ACImpl {
@@ -196,8 +217,6 @@ struct ACImpl {
struct list packet_filled_head;
};
@ -80,7 +80,7 @@ index 0039c34..e521794 100644
static const IAudioClientVtbl AudioClient_Vtbl;
static const IAudioRenderClientVtbl AudioRenderClient_Vtbl;
static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl;
@@ -517,12 +536,92 @@ fail:
@@ -605,12 +624,92 @@ fail:
return E_FAIL;
}
@ -176,7 +176,7 @@ index 0039c34..e521794 100644
}
/* some poorly-behaved applications call audio functions during DllMain, so we
@@ -538,6 +637,10 @@ static HRESULT pulse_test_connect(void)
@@ -626,6 +725,10 @@ static HRESULT pulse_test_connect(void)
pa_mainloop *ml;
pa_context *ctx;
@ -187,7 +187,7 @@ index 0039c34..e521794 100644
ml = pa_mainloop_new();
pa_mainloop_set_poll_func(ml, pulse_poll_func, NULL);
@@ -588,6 +691,9 @@ static HRESULT pulse_test_connect(void)
@@ -676,6 +779,9 @@ static HRESULT pulse_test_connect(void)
pulse_probe_settings(ml, ctx, 0, &pulse_fmt[1]);
g_phys_speakers_mask = 0;
@ -197,7 +197,7 @@ index 0039c34..e521794 100644
o = pa_context_get_sink_info_list(ctx, &pulse_phys_speakers_cb, NULL);
if (o) {
while (pa_mainloop_iterate(ml, 1, &ret) >= 0 &&
@@ -596,6 +702,14 @@ static HRESULT pulse_test_connect(void)
@@ -684,6 +790,14 @@ static HRESULT pulse_test_connect(void)
pa_operation_unref(o);
}
@ -212,7 +212,7 @@ index 0039c34..e521794 100644
pa_context_unref(ctx);
pa_mainloop_free(ml);
return S_OK;
@@ -883,6 +997,8 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
@@ -1111,6 +1225,8 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
char buffer[64];
static LONG number;
pa_buffer_attr attr;
@ -221,7 +221,7 @@ index 0039c34..e521794 100644
if (This->stream) {
pa_stream_disconnect(This->stream);
while (pa_stream_get_state(This->stream) == PA_STREAM_READY)
@@ -908,12 +1024,18 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
@@ -1136,12 +1252,18 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
attr.maxlength = This->bufsize_frames * pa_frame_size(&This->ss);
attr.prebuf = pa_frame_size(&This->ss);
dump_attr(&attr);
@ -233,16 +233,16 @@ index 0039c34..e521794 100644
+
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, NULL, NULL);
+ 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, 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);
+ 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);
+ 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;
@@ -930,39 +1052,53 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
@@ -1158,39 +1280,53 @@ static HRESULT pulse_stream_connect(ACImpl *This, UINT32 period_bytes) {
return S_OK;
}
@ -315,7 +315,7 @@ index 0039c34..e521794 100644
}
int WINAPI AUDDRV_GetPriority(void)
@@ -974,20 +1110,79 @@ int WINAPI AUDDRV_GetPriority(void)
@@ -1202,20 +1338,79 @@ int WINAPI AUDDRV_GetPriority(void)
return SUCCEEDED(hr) ? Priority_Preferred : Priority_Unavailable;
}
@ -397,7 +397,7 @@ index 0039c34..e521794 100644
*out = NULL;
@@ -1005,6 +1200,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
@@ -1233,6 +1428,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
This->parent = dev;
for (i = 0; i < PA_CHANNELS_MAX; ++i)
This->vol[i] = 1.f;
@ -406,5 +406,5 @@ index 0039c34..e521794 100644
hr = CoCreateFreeThreadedMarshaler((IUnknown*)&This->IAudioClient_iface, &This->marshal);
if (hr) {
--
1.9.1
2.28.0

View File

@ -1,24 +0,0 @@
From 8c4a9cd1290fe9240a8de0d3ce5771f528153b06 Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Tue, 18 Nov 2014 18:39:58 +0000
Subject: [PATCH 4/7] winepulse: fix segfault in pulse_rd_loop
---
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 e521794..583690b 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -818,6 +818,7 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
size_t src_len, copy, rem = This->period_bytes;
if (!(p = (ACPacket*)list_head(&This->packet_free_head))) {
p = (ACPacket*)list_head(&This->packet_filled_head);
+ if (!p) return;
if (!p->discont) {
next = (ACPacket*)p->entry.next;
next->discont = 1;
--
1.9.1

View File

@ -1,163 +0,0 @@
From 80d921c3a7e93df6dcf34daa01829a13fac23179 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Tue, 7 Aug 2018 11:26:16 -0500
Subject: [PATCH] winepulse: Fix up recording
---
dlls/winepulse.drv/mmdevdrv.c | 115 +++++++++++++++++-------------------------
1 file changed, 46 insertions(+), 69 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 9c3ff0f..56f6c2b 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -986,53 +986,70 @@ static void pulse_started_callback(pa_stream *s, void *userdata)
TRACE("%p: (Re)started playing\n", userdata);
}
-static void pulse_rd_loop(ACImpl *This, size_t bytes)
+static void pulse_read(ACImpl *This)
{
+ size_t bytes = pa_stream_readable_size(This->stream);
+
+ TRACE("Readable total: %zu, fragsize: %u\n", bytes, pa_stream_get_buffer_attr(This->stream)->fragsize);
+
+ bytes += This->peek_len - This->peek_ofs;
+
while (bytes >= This->period_bytes) {
- ACPacket *p, *next;
- LARGE_INTEGER stamp, freq;
- BYTE *dst, *src;
+ BYTE *dst = NULL, *src;
size_t src_len, copy, rem = This->period_bytes;
- if (!(p = (ACPacket*)list_head(&This->packet_free_head))) {
- p = (ACPacket*)list_head(&This->packet_filled_head);
- if (!p) return;
- if (!p->discont) {
- next = (ACPacket*)p->entry.next;
- next->discont = 1;
- } else
- p = (ACPacket*)list_tail(&This->packet_filled_head);
- } else {
- This->held_bytes += This->period_bytes;
+
+ if (This->started) {
+ LARGE_INTEGER stamp, freq;
+ ACPacket *p, *next;
+
+ if (!(p = (ACPacket*)list_head(&This->packet_free_head))) {
+ p = (ACPacket*)list_head(&This->packet_filled_head);
+ if (!p) return;
+ if (!p->discont) {
+ next = (ACPacket*)p->entry.next;
+ next->discont = 1;
+ } else
+ p = (ACPacket*)list_tail(&This->packet_filled_head);
+ } else {
+ This->held_bytes += This->period_bytes;
+ }
+ QueryPerformanceCounter(&stamp);
+ QueryPerformanceFrequency(&freq);
+ p->qpcpos = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart;
+ p->discont = 0;
+ list_remove(&p->entry);
+ list_add_tail(&This->packet_filled_head, &p->entry);
+
+ dst = p->data;
}
- QueryPerformanceCounter(&stamp);
- QueryPerformanceFrequency(&freq);
- p->qpcpos = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart;
- p->discont = 0;
- list_remove(&p->entry);
- list_add_tail(&This->packet_filled_head, &p->entry);
- dst = p->data;
while (rem) {
if (This->peek_len) {
copy = min(rem, This->peek_len - This->peek_ofs);
- memcpy(dst, This->peek_buffer + This->peek_ofs, copy);
+ if (dst) {
+ memcpy(dst, This->peek_buffer + This->peek_ofs, copy);
+ dst += copy;
+ }
rem -= copy;
- dst += copy;
This->peek_ofs += copy;
if(This->peek_len == This->peek_ofs)
- This->peek_len = 0;
+ This->peek_len = This->peek_ofs = 0;
+
} else if (pa_stream_peek(This->stream, (const void**)&src, &src_len) == 0 && src_len) {
copy = min(rem, src_len);
- if(src)
- memcpy(dst, src, copy);
- else
- silence_buffer(This->ss.format, dst, copy);
+ if (dst) {
+ if(src)
+ memcpy(dst, src, copy);
+ else
+ silence_buffer(This->ss.format, dst, copy);
+
+ dst += copy;
+ }
- dst += copy;
rem -= copy;
if (copy < src_len) {
@@ -1059,46 +1076,6 @@ static void pulse_rd_loop(ACImpl *This, size_t bytes)
}
}
-static void pulse_rd_drop(ACImpl *This, size_t bytes)
-{
- while (bytes >= This->period_bytes) {
- size_t src_len, copy, rem = This->period_bytes;
- while (rem) {
- const void *src;
- pa_stream_peek(This->stream, &src, &src_len);
- src_len -= This->peek_ofs;
-
- copy = rem;
- if (copy > src_len)
- copy = src_len;
-
- src_len -= copy;
- rem -= copy;
-
- if (!src_len) {
- This->peek_ofs = 0;
- pa_stream_drop(This->stream);
- } else
- This->peek_ofs += copy;
- bytes -= copy;
- }
- }
-}
-
-static void pulse_read(ACImpl *This)
-{
- size_t bytes = pa_stream_readable_size(This->stream);
- TRACE("Readable total: %zu, fragsize: %u\n", bytes, pa_stream_get_buffer_attr(This->stream)->fragsize);
- bytes -= This->peek_ofs;
- if (bytes < This->period_bytes)
- return;
-
- if (This->started)
- pulse_rd_loop(This, bytes);
- else
- pulse_rd_drop(This, bytes);
-}
-
static DWORD WINAPI pulse_timer_cb(void *user)
{
DWORD delay;
--
2.7.4

View File

@ -1,73 +0,0 @@
From d2238287ffb1db3ebde4339548019920c694abbc Mon Sep 17 00:00:00 2001
From: Zhiyi Zhang <zzhang@codeweavers.com>
Date: Mon, 27 Aug 2018 08:20:17 -0500
Subject: winepulse.drv: Fix getting the same timing info.
To: wine-devel <wine-devel@winehq.org>
Reply-To: wine-devel <wine-devel@winehq.org>,Andrew Eikum <aeikum@codeweavers.com>
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--

View File

@ -1,44 +0,0 @@
From 5b10bce652ede36e8f6861b9086933ce97889696 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Mon, 27 Aug 2018 08:33:32 -0500
Subject: winepulse: Update last time on underrun
To: wine-devel <wine-devel@winehq.org>
Reply-To: wine-devel <wine-devel@winehq.org>,Andrew Eikum <aeikum@codeweavers.com>
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--

View File

@ -1,40 +0,0 @@
From 262abc1d8daf243cf295c060ff4c47f93dcdbe2f Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
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 <wine-devel@winehq.org>
Reply-To: wine-devel <wine-devel@winehq.org>,Andrew Eikum <aeikum@codeweavers.com>
---
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

View File

@ -1,26 +0,0 @@
From 6f0f6b7e3d3a28df29577f7da93f8e3837386ab1 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Fri, 19 Oct 2018 14:22:35 -0500
Subject: [PATCH 2/3] winepulse: Fix local buffer offset wrapping
To: wine-devel <wine-devel@winehq.org>
Reply-To: wine-devel <wine-devel@winehq.org>,Andrew Eikum <aeikum@codeweavers.com>
---
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

View File

@ -1,33 +0,0 @@
From cf1e1aa8a37ea52f70874931b80611eee7a27f83 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
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 <wine-devel@winehq.org>
Reply-To: wine-devel <wine-devel@winehq.org>,Andrew Eikum <aeikum@codeweavers.com>
---
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

View File

@ -1,8 +1,5 @@
Fixes: Allow selection of audio device for PulseAudio backend
Fixes: [37042] Implement exclusive mode in PulseAudio backend
Fixes: Fix possible segfault in pulse_rd_loop of PulseAudio backend
Fixes: Add support for GetPropValue to PulseAudio backend
Fixes: Use actual program name if available to describe PulseAudio streams
Fixes: Expose PKEY_AudioEndpoint_PhysicalSpeakers device property in PulseAudio driver
# Patches 0002, 0008-0010 fix the following bug:
Fixes: [28282] Sound constantly crackling in a lot of games

View File

@ -1 +1 @@
447bce4117a58910690a0d2610ebcbdd49ae9127
8f3bd63b52f03ff05e9d2a00a2e129a0b0092969