1 From ad8d21103f48f265f206abaabd3075fd33d619be Mon Sep 17 00:00:00 2001
2 From: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
3 Date: Thu, 14 Jan 2010 12:04:20 +0100
4 Subject: [PATCH] tagreadbin: avoid deadlock on state change PAUSED_TO_READY
7 gst/tagreading/gsttagsink.c | 24 ++++++++++++++++++++++++
8 1 files changed, 24 insertions(+), 0 deletions(-)
10 diff --git a/gst/tagreading/gsttagsink.c b/gst/tagreading/gsttagsink.c
11 index 6de9626..d6c4ba4 100644
12 --- a/gst/tagreading/gsttagsink.c
13 +++ b/gst/tagreading/gsttagsink.c
14 @@ -386,6 +386,28 @@ shutdown:
19 +gst_tag_sink_activate_push (GstPad * pad, gboolean active)
21 + gboolean result = TRUE;
22 + GstTagSink *tagsink;
24 + tagsink = (GstTagSink *) (GST_PAD_PARENT (pad));
26 + /* a request pad's thread may be held locked in basesink sink pad
27 + * in wait_preroll (if things went really quick PAUSED -> PLAYING -> PAUSED).
28 + * State change to READY may (likely) select request pad for deactivation
29 + * first, so we need to unlock the streaming thread */
30 + if (tagsink && !active) {
31 + GST_DEBUG_OBJECT (tagsink, "flushing basesink sinkpad");
32 + gst_pad_send_event (GST_BASE_SINK_PAD (tagsink),
33 + gst_event_new_flush_start ());
41 gst_tag_sink_request_pad (GstElement * element, GstPadTemplate * templ,
43 @@ -412,6 +434,8 @@ gst_tag_sink_request_pad (GstElement * element, GstPadTemplate * templ,
44 gst_pad_set_setcaps_function (pad, GST_DEBUG_FUNCPTR (gst_tag_sink_setcaps));
45 gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_tag_sink_sink_event));
46 gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_tag_sink_chain));
47 + gst_pad_set_activatepush_function (pad,
48 + GST_DEBUG_FUNCPTR (gst_tag_sink_activate_push));
50 gst_pad_set_active (pad, TRUE);