Skip to contentSkip to conversation

gstreamer1.0-plugins-base: Add patches for Gstreamer 1.4.5 base

PATCH Superseded Yuqing Zhu 1 participant 4 messages Jul 30, 2015

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Yuqing Zhu

author
#0 lore raw

v5 cover gstreamer1.0-plugins-base: Add patches for Gstreamer 1.4.5 base

Fix issue about gstreamer1.0-plugins-base

-gststreamsynchronizer: Sending EOS event instead of GAP event as GAP event has issue when A/V have
different duration.
Stop sending second track EOS event if sending the first track EOS return fail.

-basetextoverlay: Make memory copy when video buffer's memory is read only.

-gstplaysink: Don't set async of custom text-sink to false.

Yuqing Zhu (3):
gstreamer1.0-plugins-base: Add gststreamsynchronizer related patch gstreamer1.0-plugins-base: Add basetextoverlay related patch gstreamer1.0-plugins-base: Add gstplaysink related patch

 ...rlay-make-memory-copy-when-video-buffer-s.patch | 129 +++++++++++++++++++++
 ...-don-t-set-async-of-custom-text-sink-to-f.patch |  31 +++++
 .../do-not-change-eos-event-to-gap-event2.patch    |  49 ++++++++
 .../do-not-change-eos-event-to-gap-event3.patch    |  31 +++++
 .../gstreamer/gstreamer1.0-plugins-base_1.4.5.bb   |   4 +
 5 files changed, 244 insertions(+)
 create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch
 create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch
 create mode 100755 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/do-not-change-eos-event-to-gap-event2.patch
 create mode 100755 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/do-not-change-eos-event-to-gap-event3.patch
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v5 1/3 gstreamer1.0-plugins-base: Add gststreamsynchronizer related patch

-Sending EOS event instead of GAP event as GAP event has error if A/V have the different duration.

-Stop sending second track EOS event when returing failure after sending the first track EOS.
Fixed by ignoring the return error.

---
 .../do-not-change-eos-event-to-gap-event2.patch    | 49 ++++++++++++++++++++++
 .../do-not-change-eos-event-to-gap-event3.patch    | 31 ++++++++++++++
 .../gstreamer/gstreamer1.0-plugins-base_1.4.5.bb   |  2 +
 3 files changed, 82 insertions(+)
 create mode 100755 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/do-not-change-eos-event-to-gap-event2.patch
 create mode 100755 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/do-not-change-eos-event-to-gap-event3.patch
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/do-not-change-eos-event-to-gap-event2.patch new file +49 -0
new file mode 100755
index 0000000..f24bc7c
@@ -0,0 +1,49 @@
+commit f9536544f5ad182b4f78d0143d1daa45dd64e624
+Author: Song Bing <[email protected]>
+Date:   Thu Oct 9 17:37:43 2014 +0800
+
+[gststreamsynchronizer] send EOS event insterd of GAP event as GAP
+event has issue when A/V have different duration.
+    
+send EOS event insterd of GAP event as GAP event has issue when A/V have different duration.
+
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=736655]
+
+Signed-off-by: Song Bing <[email protected]>
+
+diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c
+index 3e17c55..ff42d72 100644
+--- a/gst/playback/gststreamsynchronizer.c
++++ b/gst/playback/gststreamsynchronizer.c
+@@ -488,19 +488,24 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstObject * parent,
+         }
+         g_slist_free (pads);
+       } else {
+-        /* if EOS, but no data has passed, then send EOS event */
++        /* if EOS, but no data has passed, then send something to replace EOS
++         * for preroll purposes */
+         if (!seen_data) {
+-          GstEvent *gap_event;
++          GstEvent *eos_event;
+ 
+-          gap_event = gst_event_new_eos ();
+-          ret = gst_pad_push_event (srcpad, gap_event);
++          /* FIXME: change to EOS event as GAP event has issue when A/V have
++           * different duration */
++          eos_event = gst_event_new_eos ();
++          ret = gst_pad_push_event (srcpad, eos_event);
+         } else {
+-          GstEvent *gap_event;
++          GstEvent *eos_event;
+ 
+           /* FIXME: Also send a GAP event to let audio sinks start their
+            * clock in case they did not have enough data yet */
+-          gap_event = gst_event_new_gap (timestamp, GST_CLOCK_TIME_NONE);
+-          ret = gst_pad_push_event (srcpad, gap_event);
++          /* FIXME: change to EOS event as GAP event has issue when A/V have
++           * different duration */
++          eos_event = gst_event_new_eos ();
++          ret = gst_pad_push_event (srcpad, eos_event);
+         }
+       }
+       gst_object_unref (srcpad);
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/do-not-change-eos-event-to-gap-event3.patch new file +31 -0
new file mode 100755
index 0000000..731be68
@@ -0,0 +1,31 @@
+commit 3f7052aac5e0118a9a9e09fff2f65091be448972
+Author: Song Bing <[email protected]>
+Date:   Thu Oct 23 13:35:13 2014 +0800
+
+[streamsynchronizer] One stream can finish playback.
+  
+As changed GAP event EOS event, so EOS will send more times, which will
+cause send function return error.
+Streamsynchronizer will don’t send second track EOS event if send the
+first track EOS return fail. Fixed by ignore the return error.
+
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=736655]
+
+Signed-off-by: Song Bing [email protected]
+
+diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c
+index ff42d72..d1732c3 100644
+--- a/gst/playback/gststreamsynchronizer.c
++++ b/gst/playback/gststreamsynchronizer.c
+@@ -482,7 +482,10 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstObject * parent,
+         while (epad) {
+           pad = epad->data;
+           GST_DEBUG_OBJECT (pad, "Pushing EOS");
+-          ret = ret && gst_pad_push_event (pad, gst_event_new_eos ());
++          /* FIXME: remove error check as GAP changed to EOS will send EOS
++           * more times, which will cause return error and then don't send
++           * EOS event to following tracks. */
++          gst_pad_push_event (pad, gst_event_new_eos ());
+           gst_object_unref (pad);
+           epad = g_slist_next (epad);
+         }
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.4.5.bb +2 -0
index 8daf5af..37bef6d 100644
@@ -15,6 +15,8 @@ SRC_URI += "file://do-not-change-eos-event-to-gap-event-if.patch \
             file://0001-video-frame-Don-t-ref-buffers-twice-when-mapping.patch \
             file://0003-videofilter-Use-new-GST_VIDEO_FRAME_MAP_FLAG_NO_REF.patch \
             file://videoencoder-Keep-sticky-events-around-when-doing-a-soft-.patch \
+            file://do-not-change-eos-event-to-gap-event2.patch \
+            file://do-not-change-eos-event-to-gap-event3.patch \
 "
 
 SRC_URI[md5sum] = "357165af625c0ca353ab47c5d843920e"
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v5 2/3 gstreamer1.0-plugins-base: Add basetextoverlay related patch

In reply to Yuqing Zhu

Make memory copy when video buffer's memory is read only

---
 ...rlay-make-memory-copy-when-video-buffer-s.patch | 129 +++++++++++++++++++++
 .../gstreamer/gstreamer1.0-plugins-base_1.4.5.bb   |   1 +
 2 files changed, 130 insertions(+)
 create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch new file +129 -0
new file mode 100644
index 0000000..03dca95
@@ -0,0 +1,129 @@
+From 3781d40940d46d7e6a502092d24aac7997f6da5b Mon Sep 17 00:00:00 2001
+From: Mingke Wang <[email protected]>
+Date: Thu, 5 Mar 2015 12:06:23 +0800
+Subject: [PATCH 1/4] basetextoverlay: make memory copy when video buffer's
+ memory is ready only
+
+1. since gst_buffer_make_writable just lookup the refcount to determine if
+   a buffer is writable, and it will use _gst_buffer_copy() which don't
+   perform a deep memory copy even if the flag of a memory is set to
+   GST_MEMORY_FLAG_READONLY. So, we detect the memory flag and use
+   gst_buffer_copy_region with GST_BUFFER_COPY_DEEP parameter to perform
+   deep memory copy. if the allocator of a memory don't support mem_copy
+   interface, the it will return NULL, if this case, we can use
+   gst_buffer_make_writable() to get a shared memory buffer or the orignal
+   buffer if the buffer's refcount is 1.
+2.  new feature is no added if caps has no feature during caps negotiation
+
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=747495]
+
+Signed-off-by: Mingke Wang <[email protected]>
+
+diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c
+index c919861..3c0a1d7 100755
+--- a/ext/pango/gstbasetextoverlay.c
++++ b/ext/pango/gstbasetextoverlay.c
+@@ -747,6 +747,7 @@ gst_base_text_overlay_negotiate (GstBaseTextOverlay * overlay, GstCaps * caps)
+     if (f == NULL) {
+       f = gst_caps_features_new
+           (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, NULL);
++      gst_caps_set_features(overlay_caps, 0, f);
+     } else {
+       gst_caps_features_add (f,
+           GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
+@@ -1890,16 +1891,71 @@ gst_base_text_overlay_push_frame (GstBaseTextOverlay * overlay,
+   if (gst_pad_check_reconfigure (overlay->srcpad))
+     gst_base_text_overlay_negotiate (overlay, NULL);
+ 
+-  video_frame = gst_buffer_make_writable (video_frame);
+-
+   if (overlay->attach_compo_to_buffer) {
+     GST_DEBUG_OBJECT (overlay, "Attaching text overlay image to video buffer");
++    video_frame = gst_buffer_make_writable (video_frame);
+     gst_buffer_add_video_overlay_composition_meta (video_frame,
+         overlay->composition);
+     /* FIXME: emulate shaded background box if want_shading=true */
+     goto done;
+   }
+ 
++  gint m = gst_buffer_n_memory(video_frame);
++  gboolean mem_rdonly = FALSE;
++  GstMemory *mem;
++  GstBuffer *orig = video_frame;
++
++  while (--m>=0) {
++    mem = gst_buffer_get_memory(video_frame, m);
++    if (GST_MEMORY_IS_READONLY(mem)) {
++      mem_rdonly = TRUE;
++      gst_memory_unref (mem);
++      break;
++    }
++    gst_memory_unref (mem);
++  }
++
++  if (mem_rdonly) {
++    // since gst_buffer_make_writable just lookup the refcount to determine if
++    // a buffer is writable, and it will use _gst_buffer_copy() which don't
++    // perform a deep memory copy even if the flag of a memory is set to
++    // GST_MEMORY_FLAG_READONLY. So, we detect the memory flag and use
++    // gst_buffer_copy_region with GST_BUFFER_COPY_DEEP parameter to perform
++    // deep memory copy. if the allocator of a memory don't support mem_copy
++    // interface, the it will return NULL, if this case, we can use
++    // gst_buffer_make_writable() to get a shared memory buffer or the orignal
++    // buffer if the buffer's refcount is 1.
++    GstBuffer *new_buf = gst_buffer_copy_region (video_frame,
++        GST_BUFFER_COPY_ALL | GST_BUFFER_COPY_DEEP, 0, -1);
++
++    GST_DEBUG_OBJECT (overlay, "copy %s video frame buffer %p -> %p",
++        g_type_name (GST_MINI_OBJECT_TYPE (video_frame)), video_frame, new_buf);
++
++    if (!new_buf) {
++      //maybe the allocator don't support mem_copy interface, the we just use
++      //gst_buffer_make_writable() to get a writable buffer.
++      video_frame = gst_buffer_make_writable (video_frame);
++    } else {
++      gst_mini_object_unref (video_frame);
++      GST_BUFFER_FLAG_UNSET (new_buf, GST_BUFFER_FLAG_TAG_MEMORY);
++      video_frame = new_buf;
++    }
++
++    if (!video_frame) {
++      GST_WARNING_OBJECT (overlay, "make writable buffer failed");
++      return GST_FLOW_OK;
++    }
++
++    m = gst_buffer_n_memory(video_frame);
++    while (--m>=0) {
++      mem = gst_buffer_get_memory(video_frame, m);
++      GST_MEMORY_FLAG_UNSET (mem, GST_MEMORY_FLAG_READONLY);
++      gst_memory_unref (mem);
++    }
++  } else {
++    video_frame = gst_buffer_make_writable (video_frame);
++  }
++
+   if (!gst_video_frame_map (&frame, &overlay->info, video_frame,
+           GST_MAP_READWRITE))
+     goto invalid_frame;
+@@ -1918,6 +1974,18 @@ gst_base_text_overlay_push_frame (GstBaseTextOverlay * overlay,
+ 
+   gst_video_frame_unmap (&frame);
+ 
++  if (mem_rdonly && orig == video_frame) {
++    //if we used the original buffer and it's mem is set to read only,
++    //recover the memory ready only flag since we unset it before
++    // gst_video_frame_map ()
++    m = gst_buffer_n_memory(video_frame);
++    while (--m>=0) {
++      mem = gst_buffer_get_memory(video_frame, m);
++      GST_MEMORY_FLAGS(mem) |= (GST_MEMORY_FLAG_READONLY);
++      gst_memory_unref (mem);
++    }
++  }
++
+ done:
+ 
+   return gst_pad_push (overlay->srcpad, video_frame);
+-- 
+1.7.9.5
+
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.4.5.bb +1 -0
index 37bef6d..7aba40d 100644
@@ -17,6 +17,7 @@ SRC_URI += "file://do-not-change-eos-event-to-gap-event-if.patch \
             file://videoencoder-Keep-sticky-events-around-when-doing-a-soft-.patch \
             file://do-not-change-eos-event-to-gap-event2.patch \
             file://do-not-change-eos-event-to-gap-event3.patch \
+            file://0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch \
 "
 
 SRC_URI[md5sum] = "357165af625c0ca353ab47c5d843920e"
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v5 3/3 gstreamer1.0-plugins-base: Add gstplaysink related patch

In reply to Yuqing Zhu

Don't set async of custom text-sink to false.
Setting async to false will lead A/V sync problem when seeking. The preroll need to use GAP event instead of setting async to false.

---
 ...-don-t-set-async-of-custom-text-sink-to-f.patch | 31 ++++++++++++++++++++++
 .../gstreamer/gstreamer1.0-plugins-base_1.4.5.bb   |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch new file +31 -0
new file mode 100644
index 0000000..39c146a
@@ -0,0 +1,31 @@
+From 0a78555ea6c8c2f1ee27ee4707e8d7aa00ab7a66 Mon Sep 17 00:00:00 2001
+From: Mingke Wang <[email protected]>
+Date: Thu, 19 Mar 2015 14:15:25 +0800
+Subject: [PATCH 2/4] gstplaysink: don't set async of custom text-sink to
+ false
+
+set async to false lead to A/V sync problem when seeking.
+the preroll need use GAP event instead of set async to false.
+
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=747499]
+
+Signed-off-by: Mingke Wang <[email protected]>
+
+diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c
+old mode 100644
+new mode 100755
+index f5a2d42..fba0172
+--- a/gst/playback/gstplaysink.c
++++ b/gst/playback/gstplaysink.c
+@@ -2408,7 +2408,7 @@ gen_text_chain (GstPlaySink * playsink)
+           G_TYPE_BOOLEAN);
+       if (elem) {
+         /* make sure the sparse subtitles don't participate in the preroll */
+-        g_object_set (elem, "async", FALSE, NULL);
++        //g_object_set (elem, "async", FALSE, NULL);
+         GST_DEBUG_OBJECT (playsink, "adding custom text sink");
+         gst_bin_add (bin, chain->sink);
+         /* NOTE streamsynchronizer needs streams decoupled */
+-- 
+1.7.9.5
+
meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.4.5.bb +1 -0
index 7aba40d..8d926f3 100644
@@ -18,6 +18,7 @@ SRC_URI += "file://do-not-change-eos-event-to-gap-event-if.patch \
             file://do-not-change-eos-event-to-gap-event2.patch \
             file://do-not-change-eos-event-to-gap-event3.patch \
             file://0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch \
+            file://0002-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch \
 "
 
 SRC_URI[md5sum] = "357165af625c0ca353ab47c5d843920e"
Signature · 1 line
1.9.1