gstreamer_0.10.36.1: worked on mkv memory leak (not finaly fixed!.. but a little...
[vuplus_openvuplus] / meta-openvuplus / recipes-multimedia / gstreamer / gstreamer-0.10.36.1+git / multiqueue-sparsestreams.patch
diff --git a/meta-openvuplus/recipes-multimedia/gstreamer/gstreamer-0.10.36.1+git/multiqueue-sparsestreams.patch b/meta-openvuplus/recipes-multimedia/gstreamer/gstreamer-0.10.36.1+git/multiqueue-sparsestreams.patch
new file mode 100644 (file)
index 0000000..64968ff
--- /dev/null
@@ -0,0 +1,97 @@
+--- ./plugins/elements/gstmultiqueue.c-original        2013-01-08 14:40:09.002563354 +0100
++++ ./plugins/elements/gstmultiqueue.c 2013-01-08 14:39:45.578850244 +0100
+@@ -161,6 +161,7 @@
+   GstDataQueueSize max_size, extra_size;
+   GstClockTime cur_time;
+   gboolean is_eos;
++  gboolean is_sparse;
+   gboolean flushing;
+   /* Protected by global lock */
+@@ -801,6 +802,12 @@
+   return result;
+ }
++static gboolean
++is_sparse (GstSingleQueue * sq)
++{
++  return sq->is_sparse;
++}
++
+ static void
+ update_buffering (GstMultiQueue * mq, GstSingleQueue * sq)
+ {
+@@ -822,6 +829,8 @@
+   /* get bytes and time percentages and take the max */
+   if (sq->is_eos) {
+     percent = 100;
++  } else if (is_sparse (sq)) {
++    percent = 100;
+   } else {
+     percent = 0;
+     if (sq->max_size.time > 0) {
+@@ -1606,15 +1615,26 @@
+   GstSingleQueue *sq = gst_pad_get_element_private (pad);
+   GstPad *otherpad;
+   GstCaps *result;
+-
++  GstStructure* str;
++  const gchar *g_type;
++
+   otherpad = (pad == sq->srcpad) ? sq->sinkpad : sq->srcpad;
+-  GST_LOG_OBJECT (otherpad, "Getting caps from the peer of this pad");
+-
+   result = gst_pad_peer_get_caps (otherpad);
+   if (result == NULL)
+     result = gst_caps_new_any ();
++  str = gst_caps_get_structure(result, 0);
++  g_type = str ? gst_structure_get_name(str) : (const gchar*)"unknown";
++
++  GST_LOG_OBJECT (otherpad, "Got caps from the peer of this pad: %s", g_type);
++
++  if ( !g_strcmp0(g_type, "video/x-dvd-subpicture") || !g_strcmp0(g_type, "text/x-pango-markup") || !g_strcmp0(g_type, "text/plain") || !g_strcmp0(g_type, "subpicture/x-pgs") )
++  {
++    GST_INFO_OBJECT (otherpad, "subtitle stream discovered --> set is_sparse to true");
++    sq->is_sparse = TRUE;
++  }
++
+   return result;
+ }
+@@ -1841,7 +1861,7 @@
+     GST_LOG_OBJECT (mq, "Checking Queue %d", oq->id);
+-    if (gst_data_queue_is_empty (oq->queue)) {
++    if (gst_data_queue_is_empty (oq->queue) && !is_sparse (oq)) {
+       GST_LOG_OBJECT (mq, "Queue %d is empty", oq->id);
+       if (IS_FILLED (sq, visible, size.visible)) {
+         sq->max_size.visible = size.visible + 1;
+@@ -1868,7 +1888,7 @@
+      *    we are checking here.
+      */
+     if (sq->is_eos || IS_FILLED (sq, bytes, ssize.bytes) ||
+-        IS_FILLED (sq, time, sq->cur_time)) {
++        IS_FILLED (sq, time, sq->cur_time) || is_sparse (oq)) {
+       GST_LOG_OBJECT (mq, "Queue %d is filled", oq->id);
+       filled = TRUE;
+     }
+@@ -1911,7 +1931,7 @@
+         gst_data_queue_limits_changed (oq->queue);
+       }
+     }
+-    if (!gst_data_queue_is_empty (oq->queue))
++    if (!gst_data_queue_is_empty (oq->queue) || is_sparse (oq))
+       empty = FALSE;
+   }
+   GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
+@@ -2011,6 +2031,7 @@
+       (GstDataQueueFullCallback) single_queue_overrun_cb,
+       (GstDataQueueEmptyCallback) single_queue_underrun_cb, sq);
+   sq->is_eos = FALSE;
++  sq->is_sparse = FALSE;
+   sq->flushing = FALSE;
+   gst_segment_init (&sq->sink_segment, GST_FORMAT_TIME);
+   gst_segment_init (&sq->src_segment, GST_FORMAT_TIME);