Zebediah Figura : winegstreamer: Duplicate the "sink_connected" field in struct wg_parser.

Alexandre Julliard julliard at winehq.org
Tue Feb 2 15:52:09 CST 2021


Module: wine
Branch: master
Commit: cd27f3ca00f63c8e07d5a06058feb3ee93509317
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=cd27f3ca00f63c8e07d5a06058feb3ee93509317

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Feb  1 18:37:00 2021 -0600

winegstreamer: Duplicate the "sink_connected" field in struct wg_parser.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/gstdemux.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index ab7efc24018..1ddbc954fb4 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -69,7 +69,7 @@ struct wg_parser
         GstFlowReturn ret;
     } read_request;
 
-    bool flushing;
+    bool flushing, sink_connected;
 };
 
 struct parser
@@ -1188,12 +1188,12 @@ static DWORD CALLBACK read_thread(void *arg)
 
     pthread_mutex_lock(&filter->mutex);
 
-    for (;;)
+    while (filter->sink_connected)
     {
-        while (filter->sink_connected && !parser->read_request.buffer)
+        while (parser->sink_connected && !parser->read_request.buffer)
             pthread_cond_wait(&parser->read_cond, &filter->mutex);
 
-        if (!filter->sink_connected)
+        if (!parser->sink_connected)
             break;
 
         parser->read_request.done = true;
@@ -1593,6 +1593,7 @@ static HRESULT GST_Connect(struct parser *This, IPin *pConnectPin)
     parser->file_size = This->file_size;
 
     This->sink_connected = true;
+    parser->sink_connected = true;
 
     This->read_thread = CreateThread(NULL, 0, read_thread, This, 0, NULL);
 
@@ -2541,8 +2542,9 @@ static HRESULT GST_RemoveOutputPins(struct parser *This)
 
     /* read_thread() needs to stay alive to service any read requests GStreamer
      * sends, so we can only shut it down after GStreamer stops. */
-    pthread_mutex_lock(&This->mutex);
     This->sink_connected = false;
+    pthread_mutex_lock(&This->mutex);
+    parser->sink_connected = false;
     pthread_mutex_unlock(&This->mutex);
     pthread_cond_signal(&parser->read_cond);
     WaitForSingleObject(This->read_thread, INFINITE);




More information about the wine-cvs mailing list