winegstreamer: Unblock waits in sink_chain_cb() when disabling a stream.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-04-04 11:50:56 -05:00 committed by Alexandre Julliard
parent 5861379d6d
commit bcd39c5061
1 changed files with 7 additions and 5 deletions

View File

@ -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);