winegstreamer: Don't hold the filter lock from the pad-added or pad-removed callbacks.

These may be called from the streaming thread, so it's not safe to do so.

Nor does it seem necessary. We expect that no streaming thread should ever
call methods on our pad or pin, and as long as we hold the filter lock and
wait for the no-more-pads signal when connecting or starting the stream, we
cannot race with application threads.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-12-03 10:14:50 -06:00 committed by Alexandre Julliard
parent 4008aba453
commit 7a0d963df3
1 changed files with 6 additions and 8 deletions

View File

@ -814,13 +814,17 @@ static void removed_decoded_pad(GstElement *bin, GstPad *pad, gpointer user)
TRACE("%p %p %p\n", This, bin, pad);
EnterCriticalSection(&This->filter.csFilter);
for (x = 0; x < This->cStreams; ++x) {
if (This->ppPins[x]->their_src == pad)
break;
}
if (x == This->cStreams)
goto out;
{
char *name = gst_pad_get_name(pad);
WARN("No pin matching pad %s found.\n", debugstr_a(name));
g_free(name);
return;
}
pin = This->ppPins[x];
@ -831,9 +835,6 @@ static void removed_decoded_pad(GstElement *bin, GstPad *pad, gpointer user)
gst_object_unref(pin->their_src);
pin->their_src = NULL;
out:
TRACE("Removed %i/%i\n", x, This->cStreams);
LeaveCriticalSection(&This->filter.csFilter);
}
static void init_new_decoded_pad(GstElement *bin, GstPad *pad, struct gstdemux *This)
@ -971,7 +972,6 @@ static void existing_new_pad(GstElement *bin, GstPad *pad, gpointer user)
return;
}
EnterCriticalSection(&This->filter.csFilter);
for (x = 0; x < This->cStreams; ++x) {
struct gstdemux_source *pin = This->ppPins[x];
if (!pin->their_src) {
@ -986,13 +986,11 @@ static void existing_new_pad(GstElement *bin, GstPad *pad, gpointer user)
pin->their_src = pad;
gst_object_ref(pin->their_src);
TRACE("Relinked\n");
LeaveCriticalSection(&This->filter.csFilter);
return;
}
}
}
init_new_decoded_pad(bin, pad, This);
LeaveCriticalSection(&This->filter.csFilter);
}
static gboolean query_function(GstPad *pad, GstObject *parent, GstQuery *query)