Skip to contentSkip to conversation

gstreamer1.0: Add patches for Gstreamer 1.4.5

PATCH Superseded Yuqing Zhu 3 participants 8 messages Aug 21, 2015 – Sep 8, 2015

v4 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Yuqing Zhu

author
#0 lore raw

v4 cover gstreamer1.0: Add patches for Gstreamer 1.4.5

Fix sticky events haven't been sent out when active track reach EOS

Fix QoS/lateness checking if subclass implements prepare/prepare_list vfuncs

Yuqing Zhu (2):
gstreamer1.0: Fix ticky events haven't been sent out when active track
reach EOS
gstreamer1.0: Fix QoS/lateness checking if subclass implements
prepare/prepare_list vfuncs

 ...x-QoS-lateness-checking-if-subclass-imple.patch |  70 +++++++++
 ...cky-events-haven-t-send-out-when-ac-1-4-1.patch | 167 +++++++++++++++++++++
 .../gstreamer/gstreamer1.0_1.4.5.bb                |   2 +
 3 files changed, 239 insertions(+)
 create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0/0002-basesink-Fix-QoS-lateness-checking-if-subclass-imple.patch
 create mode 100755 meta/recipes-multimedia/gstreamer/gstreamer1.0/inputselector-sticky-events-haven-t-send-out-when-ac-1-4-1.patch
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v4 1/2 gstreamer1.0: Fix ticky events haven't been sent out when active track reach EOS

EOS event hasn't been sent to down-element. The resolution is block EOS event of inactive pad, sending the event after the pad actived.

---
 ...cky-events-haven-t-send-out-when-ac-1-4-1.patch | 167 +++++++++++++++++++++
 .../gstreamer/gstreamer1.0_1.4.5.bb                |   1 +
 2 files changed, 168 insertions(+)
 create mode 100755 meta/recipes-multimedia/gstreamer/gstreamer1.0/inputselector-sticky-events-haven-t-send-out-when-ac-1-4-1.patch
meta/recipes-multimedia/gstreamer/gstreamer1.0/inputselector-sticky-events-haven-t-send-out-when-ac-1-4-1.patch new file +167 -0
new file mode 100755
index 0000000..f50ce6f
@@ -0,0 +1,167 @@
+From 83bed90c306ed3185d48febf6441177d638f7341 Mon Sep 17 00:00:00 2001
+From: Song Bing <[email protected]>
+Date: Wed, 24 Dec 2014 10:13:51 +0800
+Subject: [PATCH] inputselector: sticky events haven't send out when active
+ track reach EOS
+
+EOS event hasn't been send to down-element. The resolution is block EOS event
+of inactive pad, send the event after the pad actived.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=740949
+
+Upstream-Status: Backport [1.5.1]
+
+Signed-off-by: Song Bing <[email protected]>
+---
+ plugins/elements/gstinputselector.c |   58 ++++++++++++++++++++++++++---------
+ plugins/elements/gstinputselector.h |    1 +
+ 2 files changed, 45 insertions(+), 14 deletions(-)
+
+diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
+index fb50802..4461f7c 100644
+--- a/plugins/elements/gstinputselector.c
++++ b/plugins/elements/gstinputselector.c
+@@ -440,6 +440,17 @@ gst_selector_pad_iterate_linked_pads (GstPad * pad, GstObject * parent)
+ }
+ 
+ static gboolean
++gst_input_selector_eos_wait (GstInputSelector * self, GstSelectorPad * pad)
++{
++  while (!self->eos && !self->flushing && !pad->flushing) {
++    /* we can be unlocked here when we are shutting down (flushing) or when we
++     * get unblocked */
++    GST_INPUT_SELECTOR_WAIT (self);
++  }
++  return self->flushing;
++}
++
++static gboolean
+ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
+ {
+   gboolean res = TRUE;
+@@ -486,6 +497,7 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
+     case GST_EVENT_FLUSH_START:
+       /* Unblock the pad if it's waiting */
+       selpad->flushing = TRUE;
++      sel->eos = FALSE;
+       GST_INPUT_SELECTOR_BROADCAST (sel);
+       break;
+     case GST_EVENT_FLUSH_STOP:
+@@ -523,21 +535,12 @@ gst_selector_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
+     case GST_EVENT_EOS:
+       selpad->eos = TRUE;
+ 
+-      if (forward) {
+-        selpad->eos_sent = TRUE;
+-      } else {
+-        GstSelectorPad *active_selpad;
+-
+-        /* If the active sinkpad is in EOS state but EOS
+-         * was not sent downstream this means that the pad
+-         * got EOS before it was set as active pad and that
+-         * the previously active pad got EOS after it was
+-         * active
+-         */
+-        active_selpad = GST_SELECTOR_PAD (active_sinkpad);
+-        forward = (active_selpad->eos && !active_selpad->eos_sent);
+-        active_selpad->eos_sent = TRUE;
++      if (!forward) {
++        /* blocked until active the sind pad or flush */
++        gst_input_selector_eos_wait (sel, selpad);
++        forward = TRUE;
+       }
++      selpad->eos_sent = TRUE;
+       GST_DEBUG_OBJECT (pad, "received EOS");
+       break;
+     case GST_EVENT_GAP:{
+@@ -676,6 +679,12 @@ gst_input_selector_wait_running_time (GstInputSelector * sel,
+         gst_input_selector_activate_sinkpad (sel, GST_PAD_CAST (selpad));
+     active_selpad = GST_SELECTOR_PAD_CAST (active_sinkpad);
+ 
++    if (sel->eos) {
++      GST_DEBUG_OBJECT (sel, "Not waiting because inputselector reach EOS.");
++      GST_INPUT_SELECTOR_UNLOCK (sel);
++      return FALSE;
++    }
++
+     if (seg->format != GST_FORMAT_TIME) {
+       GST_DEBUG_OBJECT (selpad,
+           "Not waiting because we don't have a TIME segment");
+@@ -971,6 +980,12 @@ gst_selector_pad_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
+       GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
+ 
+   GST_INPUT_SELECTOR_LOCK (sel);
++  if (sel->eos) {
++    GST_DEBUG_OBJECT (pad, "inputselector eos.");
++    GST_INPUT_SELECTOR_UNLOCK (sel);
++    goto eos;
++  }
++
+   /* wait or check for flushing */
+   if (gst_input_selector_wait (sel, selpad)) {
+     GST_INPUT_SELECTOR_UNLOCK (sel);
+@@ -1151,6 +1166,13 @@ flushing:
+     res = GST_FLOW_FLUSHING;
+     goto done;
+   }
++eos:
++  {
++    GST_DEBUG_OBJECT (pad, "We are eos, discard buffer %p", buf);
++    gst_buffer_unref (buf);
++    res = GST_FLOW_EOS;
++    goto done;
++  }
+ }
+ 
+ static void gst_input_selector_dispose (GObject * object);
+@@ -1309,6 +1331,7 @@ gst_input_selector_init (GstInputSelector * sel)
+   g_mutex_init (&sel->lock);
+   g_cond_init (&sel->cond);
+   sel->blocked = FALSE;
++  sel->eos = FALSE;
+ 
+   /* lets give a change for downstream to do something on
+    * active-pad change before we start pushing new buffers */
+@@ -1377,6 +1400,11 @@ gst_input_selector_set_active_pad (GstInputSelector * self, GstPad * pad)
+   GST_DEBUG_OBJECT (self, "New active pad is %" GST_PTR_FORMAT,
+       self->active_sinkpad);
+ 
++  if (old != new && new->eos && !new->eos_sent) {
++    self->eos = TRUE;
++    GST_INPUT_SELECTOR_BROADCAST (self);
++  }
++
+   return TRUE;
+ }
+ 
+@@ -1771,6 +1799,7 @@ gst_input_selector_change_state (GstElement * element,
+   switch (transition) {
+     case GST_STATE_CHANGE_READY_TO_PAUSED:
+       GST_INPUT_SELECTOR_LOCK (self);
++      self->eos = FALSE;
+       self->blocked = FALSE;
+       self->flushing = FALSE;
+       GST_INPUT_SELECTOR_UNLOCK (self);
+@@ -1779,6 +1808,7 @@ gst_input_selector_change_state (GstElement * element,
+       /* first unlock before we call the parent state change function, which
+        * tries to acquire the stream lock when going to ready. */
+       GST_INPUT_SELECTOR_LOCK (self);
++      self->eos = TRUE;
+       self->blocked = FALSE;
+       self->flushing = TRUE;
+       GST_INPUT_SELECTOR_BROADCAST (self);
+diff --git a/plugins/elements/gstinputselector.h b/plugins/elements/gstinputselector.h
+index 96c680f..9bf924f 100644
+--- a/plugins/elements/gstinputselector.h
++++ b/plugins/elements/gstinputselector.h
+@@ -77,6 +77,7 @@ struct _GstInputSelector {
+   GMutex lock;
+   GCond cond;
+   gboolean blocked;
++  gboolean eos;
+   gboolean flushing;
+ };
+ 
+-- 
+1.7.9.5
+
meta/recipes-multimedia/gstreamer/gstreamer1.0_1.4.5.bb +1 -0
index 0a2ce86..902f79d 100644
@@ -7,6 +7,7 @@ SRC_URI = " \
     http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.xz \
     file://0001-Fix-crash-with-gst-inspect.patch \
     file://0001-gstinfo-Shorten-__FILE__-on-all-platforms.patch \
+    file://inputselector-sticky-events-haven-t-send-out-when-ac-1-4-1.patch \
 "
 SRC_URI[md5sum] = "88a9289c64a4950ebb4f544980234289"
 SRC_URI[sha256sum] = "40801aa7f979024526258a0e94707ba42b8ab6f7d2206e56adbc4433155cb0ae"
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v4 2/2 gstreamer1.0: Fix QoS/lateness checking if subclass implements prepare/prepare_list vfuncs

In reply to Yuqing Zhu

In function gst_base_sink_chain_unlocked(), it should calculate jitter based on current media clock, rather than just passing 0.
Or it will drop all the frames when rewind in slow speed, such as -2X.

---
 ...x-QoS-lateness-checking-if-subclass-imple.patch | 70 ++++++++++++++++++++++
 .../gstreamer/gstreamer1.0_1.4.5.bb                |  1 +
 2 files changed, 71 insertions(+)
 create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0/0002-basesink-Fix-QoS-lateness-checking-if-subclass-imple.patch
meta/recipes-multimedia/gstreamer/gstreamer1.0/0002-basesink-Fix-QoS-lateness-checking-if-subclass-imple.patch new file +70 -0
new file mode 100644
index 0000000..b6edda1
@@ -0,0 +1,70 @@
+From 6914566ed6a89c96973a578aa5ecd01ee68cdcfd Mon Sep 17 00:00:00 2001
+From: Jian <[email protected]>
+Date: Thu, 14 May 2015 15:49:43 +0800
+Subject: [PATCH] basesink: Fix QoS/lateness checking if subclass implements
+ prepare/prepare_list vfuncs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In basesink functions gst_base_sink_chain_unlocked(), below code is used to
+checking if buffer is late before doing prepare call to save some effort:
+    if (syncable && do_sync)
+      late =
+          gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
+          GST_CLOCK_EARLY, 0, FALSE);
+
+    if (G_UNLIKELY (late))
+      goto dropped;
+
+But this code has problem, it should calculate jitter based on current media
+clock, rather than just passing 0. I found it will drop all the frames when
+rewind in slow speed, such as -2X.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=749258
+
+Upstream-Status: Backport [1.5.1]
+---
+ libs/gst/base/gstbasesink.c |   26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c
+index a505695..5fb2d6a 100644
+--- a/libs/gst/base/gstbasesink.c
++++ b/libs/gst/base/gstbasesink.c
+@@ -3369,10 +3369,28 @@ gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad,
+     if (G_UNLIKELY (stepped))
+       goto dropped;
+ 
+-    if (syncable && do_sync)
+-      late =
+-          gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
+-          GST_CLOCK_EARLY, 0, FALSE);
++    if (syncable && do_sync) {
++      GstClock *clock;
++
++      GST_OBJECT_LOCK (basesink);
++      clock = GST_ELEMENT_CLOCK (basesink);
++      if (clock && GST_STATE (basesink) == GST_STATE_PLAYING) {
++        GstClockTime base_time;
++        GstClockTime stime;
++        GstClockTime now;
++
++        base_time = GST_ELEMENT_CAST (basesink)->base_time;
++        stime = base_time + gst_base_sink_adjust_time (basesink, rstart);
++        now = gst_clock_get_time (clock);
++        GST_OBJECT_UNLOCK (basesink);
++
++        late =
++            gst_base_sink_is_too_late (basesink, obj, rstart, rstop,
++            GST_CLOCK_EARLY, GST_CLOCK_DIFF (stime, now), FALSE);
++      } else {
++        GST_OBJECT_UNLOCK (basesink);
++      }
++    }
+ 
+     if (G_UNLIKELY (late))
+       goto dropped;
+-- 
+1.7.9.5
+
meta/recipes-multimedia/gstreamer/gstreamer1.0_1.4.5.bb +1 -0
index 902f79d..db58754 100644
@@ -8,6 +8,7 @@ SRC_URI = " \
     file://0001-Fix-crash-with-gst-inspect.patch \
     file://0001-gstinfo-Shorten-__FILE__-on-all-platforms.patch \
     file://inputselector-sticky-events-haven-t-send-out-when-ac-1-4-1.patch \
+    file://0002-basesink-Fix-QoS-lateness-checking-if-subclass-imple.patch \
 "
 SRC_URI[md5sum] = "88a9289c64a4950ebb4f544980234289"
 SRC_URI[sha256sum] = "40801aa7f979024526258a0e94707ba42b8ab6f7d2206e56adbc4433155cb0ae"
Signature · 1 line
1.9.1
Acked-by on v4 2/2
#3 lore raw

Re: [poky][PATCH v4 2/2] gstreamer1.0: Fix QoS/lateness checking if subclass implements prepare/prepare_list vfuncs

Quoted 5 lines · Yuqing Zhu

In function gst_base_sink_chain_unlocked(), it should calculate jitter based on current media clock, rather than just passing 0.
Or it will drop all the frames when rewind in slow speed, such as -2X.

+Carlos for his feedback on this one as well.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#4 lore raw
In reply to Yuqing Zhu

These are backports, so I do not see a problem with them. However, keep in mind that GStreamer 1.6 will be out in a few days, so I recommend hold off any patches that are not backports. I have recipes prepared for 1.5.90 (= 1.6 release candidate) that I will then send to the mailing list. New patches should be applied on top of that, not 1.4.5.

Am 2015-08-21 um 16:29 schrieb Yuqing Zhu:

Quoted 18 lines

Fix sticky events haven't been sent out when active track reach EOS

Fix QoS/lateness checking if subclass implements prepare/prepare_list vfuncs

Yuqing Zhu (2):
gstreamer1.0: Fix ticky events haven't been sent out when active track
reach EOS
gstreamer1.0: Fix QoS/lateness checking if subclass implements
prepare/prepare_list vfuncs

  ...x-QoS-lateness-checking-if-subclass-imple.patch |  70 +++++++++
  ...cky-events-haven-t-send-out-when-ac-1-4-1.patch | 167 +++++++++++++++++++++
  .../gstreamer/gstreamer1.0_1.4.5.bb                |   2 +
  3 files changed, 239 insertions(+)

create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0/0002-basesink-Fix-QoS-lateness-checking-if-subclass-imple.patch create mode 100755 meta/recipes-multimedia/gstreamer/gstreamer1.0/inputselector-sticky-events-haven-t-send-out-when-ac-1-4-1.patch

#5 lore raw
Quoted 5 lines · Carlos Rafael Giani

These are backports, so I do not see a problem with them. However, keep in mind that GStreamer 1.6 will be out in a few days, so I recommend hold off any patches that are not backports. I have recipes prepared for 1.5.90 (= 1.6 release candidate) that I will then send to the mailing list. New patches should be applied on top of that, not 1.4.5.

In this case it is better to not merge those and wait for 1.5.90 to be send. This allow for testing and also FSL checking for any other pending fixes.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#6 lore raw

Am 2015-08-22 um 00:01 schrieb Otavio Salvador:

Quoted 12 lines
Quoted 5 lines · Carlos Rafael Giani

These are backports, so I do not see a problem with them. However, keep in mind that GStreamer 1.6 will be out in a few days, so I recommend hold off any patches that are not backports. I have recipes prepared for 1.5.90 (= 1.6 release candidate) that I will then send to the mailing list. New patches should be applied on top of that, not 1.4.5.

In this case it is better to not merge those and wait for 1.5.90 to be send. This allow for testing and also FSL checking for any other pending fixes.

Yes. In fact, several of the present non-backport patches no longer apply. I had to delete them because fixing them was a nontrivial task, and should better be done by the original authors. I already sent a heads up about this to them.

author
#7 lore raw
In reply to Carlos Rafael Giani

Hi Carlos,
If I didn't misunderstand, you meant it's ok for you because they are backports. So community will accept these two patches if no other problem. Am I right? The patches are still not being applied to master branch, I am waiting for your feedback.

B.R.
Yuqing Zhu

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Carlos Rafael Giani
Sent: Saturday, August 22, 2015 5:58 AM
To: [email protected]
Subject: Re: [OE-core] [poky][PATCH v4 0/2] gstreamer1.0: Add patches for Gstreamer 1.4.5

These are backports, so I do not see a problem with them. However, keep in mind that GStreamer 1.6 will be out in a few days, so I recommend hold off any patches that are not backports. I have recipes prepared for 1.5.90 (= 1.6 release candidate) that I will then send to the mailing list. New patches should be applied on top of that, not 1.4.5.

Am 2015-08-21 um 16:29 schrieb Yuqing Zhu:

Quoted 12 lines

Fix sticky events haven't been sent out when active track reach EOS

Fix QoS/lateness checking if subclass implements prepare/prepare_list vfuncs

Yuqing Zhu (2):
gstreamer1.0: Fix ticky events haven't been sent out when active track
reach EOS
gstreamer1.0: Fix QoS/lateness checking if subclass implements
prepare/prepare_list vfuncs

Quoted 9 lines
  ...x-QoS-lateness-checking-if-subclass-imple.patch |  70 +++++++++
  ...cky-events-haven-t-send-out-when-ac-1-4-1.patch | 167 +++++++++++++++++++++
  .../gstreamer/gstreamer1.0_1.4.5.bb                |   2 +
  3 files changed, 239 insertions(+)

create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0/0002-basesink-Fix-QoS-lateness-checking-if-subclass-imple.patch create mode 100755
meta/recipes-multimedia/gstreamer/gstreamer1.0/inputselector-sticky-ev ents-haven-t-send-out-when-ac-1-4-1.patch

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core