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