[PATCH 3/4] winegstreamer: Unblock waits in sink_chain_cb() when disabling a stream.

Zebediah Figura zfigura at codeweavers.com
Mon Apr 4 11:50:56 CDT 2022


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/winegstreamer/wg_parser.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index a2ce92ccdc7..e7a60ec158a 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -255,6 +255,7 @@ static NTSTATUS wg_parser_stream_disable(void *args)
     pthread_mutex_lock(&parser->mutex);
     stream->enabled = false;
     pthread_mutex_unlock(&parser->mutex);
+    pthread_cond_signal(&stream->event_empty_cond);
     return S_OK;
 }
 
@@ -541,6 +542,12 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu
 
     pthread_mutex_lock(&parser->mutex);
 
+    /* Allow this buffer to be flushed by GStreamer. We are effectively
+     * implementing a queue object here. */
+
+    while (stream->enabled && !stream->flushing && stream->buffer)
+        pthread_cond_wait(&stream->event_empty_cond, &parser->mutex);
+
     if (!stream->enabled)
     {
         pthread_mutex_unlock(&parser->mutex);
@@ -548,11 +555,6 @@ static GstFlowReturn sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *bu
         return GST_FLOW_OK;
     }
 
-    /* Allow this buffer to be flushed by GStreamer. We are effectively
-     * implementing a queue object here. */
-
-    while (!stream->flushing && stream->buffer)
-        pthread_cond_wait(&stream->event_empty_cond, &parser->mutex);
     if (stream->flushing)
     {
         pthread_mutex_unlock(&parser->mutex);
-- 
2.35.1




More information about the wine-devel mailing list