Module: wine
Branch: stable
Commit: 967b3294fa25202823af16758a148844cbcab967
URL: https://gitlab.winehq.org/wine/wine/-/commit/967b3294fa25202823af16758a1488…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Date: Tue May 3 15:06:43 2022 +0200
mfplat: Avoid a race condition when releasing a tracked sample.
Right now, if the same tracked sample is released at the same time
from two different threads it might happen that neither of them calls
the callback, because they might go through the critical section at
the same time (while neither has decremented the reference count yet).
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
(cherry picked from commit b1807751219e256867eaac5cc4d8b97a5482978f)
Conflicts:
dlls/mfplat/sample.c
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/mfplat/sample.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/mfplat/sample.c b/dlls/mfplat/sample.c
index 04c68c87199..600e3bd929e 100644
--- a/dlls/mfplat/sample.c
+++ b/dlls/mfplat/sample.c
@@ -183,11 +183,11 @@ static ULONG WINAPI sample_Release(IMFSample *iface)
static ULONG WINAPI sample_tracked_Release(IMFSample *iface)
{
struct sample *sample = impl_from_IMFSample(iface);
- ULONG refcount;
+ ULONG refcount = InterlockedDecrement(&sample->attributes.ref);
HRESULT hr;
EnterCriticalSection(&sample->attributes.cs);
- if (sample->tracked_result && sample->tracked_refcount == (sample->attributes.ref - 1))
+ if (sample->tracked_result && sample->tracked_refcount == refcount)
{
IRtwqAsyncResult *tracked_result = sample->tracked_result;
sample->tracked_result = NULL;
@@ -200,8 +200,6 @@ static ULONG WINAPI sample_tracked_Release(IMFSample *iface)
}
LeaveCriticalSection(&sample->attributes.cs);
- refcount = InterlockedDecrement(&sample->attributes.ref);
-
TRACE("%p, refcount %u.\n", iface, refcount);
if (!refcount)
Module: wine
Branch: stable
Commit: 25ad84b2c9b0c6f87b7cb4906241017ec6a9fe33
URL: https://gitlab.winehq.org/wine/wine/-/commit/25ad84b2c9b0c6f87b7cb490624101…
Author: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Date: Wed Feb 9 09:40:52 2022 +0100
winegstreamer: Do not block forever if EOS races with command queue.
Currently, the winegstreamer media source checks for EOS when
RequestSample() is called, but doesn't handle the cases when EOS
is detected between the RequestSample() call and the moment when
the request is popped from the command queue and serviced. This
can result in the media source waiting forever for a sample and
get stuck.
This commit fixes the bug by adding a check for EOS in
wait_for_event().
This commit fixes Medieval Dynasty hanging on developer logos on
the Steam Deck.
Signed-off-by: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
(cherry picked from commit 4853f65c844de8277b8b0420df1a2cdb1c5b17c8)
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/winegstreamer/media_source.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 6ecd345cb73..5e36ef391da 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -534,6 +534,12 @@ static void wait_on_sample(struct media_stream *stream, IUnknown *token)
TRACE("%p, %p\n", stream, token);
+ if (stream->eos)
+ {
+ IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, MEError, &GUID_NULL, MF_E_END_OF_STREAM, &empty_var);
+ return;
+ }
+
for (;;)
{
if (!wg_parser_stream_get_event(stream->wg_stream, &event))