diff options
Diffstat (limited to 'recipes-multimedia/gstreamer/gstreamer1.0-plugins-base')
13 files changed, 977 insertions, 0 deletions
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch new file mode 100644 index 0000000..28347c6 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-basetextoverlay-make-memory-copy-when-video-buffer-s.patch @@ -0,0 +1,78 @@ +From f54f1c28272913a216e91868ce0270e6c0d99b2e Mon Sep 17 00:00:00 2001 +From: Mingke Wang <mingke.wang@freescale.com> +Date: Fri, 16 Oct 2015 19:31:32 +0800 +Subject: [PATCH 01/16] 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. + +Signed-off-by: Mingke Wang <mingke.wang@freescale.com> +--- + ext/pango/gstbasetextoverlay.c | 32 ++++++++++++++++++++++++++++++-- + 1 file changed, 30 insertions(+), 2 deletions(-) + mode change 100644 => 100755 ext/pango/gstbasetextoverlay.c + +diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c +old mode 100644 +new mode 100755 +index 44f5f52..c08e3b0 +--- a/ext/pango/gstbasetextoverlay.c ++++ b/ext/pango/gstbasetextoverlay.c +@@ -2227,16 +2227,44 @@ gst_base_text_overlay_push_frame (GstBaseTextOverlay * overlay, + } + } + +- 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 idx = 0; ++ gboolean mem_rdonly = FALSE; ++ GstMemory *mem; ++ ++ while (mem = gst_buffer_get_memory(video_frame, idx++)) { ++ if (GST_MEMORY_IS_READONLY(mem)) { ++ gst_memory_unref (mem); ++ mem_rdonly = TRUE; ++ break; ++ } ++ gst_memory_unref (mem); ++ } ++ ++ if (mem_rdonly) { ++ GstBuffer *new_buf = gst_buffer_copy_region (video_frame, ++ GST_BUFFER_COPY_ALL | GST_BUFFER_COPY_DEEP, 0, -1); ++ ++ if (!new_buf) { ++ GST_WARNING_OBJECT(overlay, ++ "buffer memory read only, but copy memory failed"); ++ goto done; ++ } else { ++ gst_buffer_unref (video_frame); ++ video_frame = new_buf; ++ } ++ } 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; +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch new file mode 100644 index 0000000..e628bf9 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch @@ -0,0 +1,35 @@ +From 9444e647142d69b5381bb1225700e335312b1144 Mon Sep 17 00:00:00 2001 +From: Mingke Wang <mingke.wang@freescale.com> +Date: Thu, 19 Mar 2015 14:15:25 +0800 +Subject: [PATCH 02/16] 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: Inappropriate [i.MX specific] + +Signed-off-by: Mingke Wang <mingke.wang@freescale.com> +--- + gst/playback/gstplaysink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + mode change 100644 => 100755 gst/playback/gstplaysink.c + +diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c +old mode 100644 +new mode 100755 +index ead2e68..3f62769 +--- a/gst/playback/gstplaysink.c ++++ b/gst/playback/gstplaysink.c +@@ -2456,7 +2456,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.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0005-gstplaybin-remove-default-deinterlace-flag.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0005-gstplaybin-remove-default-deinterlace-flag.patch new file mode 100644 index 0000000..64b45fd --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0005-gstplaybin-remove-default-deinterlace-flag.patch @@ -0,0 +1,31 @@ +From 14dc47b7e6e118d06ad4e7ed29284984b3fae248 Mon Sep 17 00:00:00 2001 +From: Jian Li <jian.li@freescale.com> +Date: Mon, 23 Jun 2014 14:14:07 +0800 +Subject: [PATCH 06/16] gstplaybin remove default deinterlace flag + +- remove default deinterlace flag in playbin for i.MX SoCs + +Upstream-Status: Inappropriate [i.MX specific] + +Signed-off-by: Jian Li <jian.li@freescale.com> +--- + gst/playback/gstplaybin2.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c +index 04eeb2b..09b7ad2 100644 +--- a/gst/playback/gstplaybin2.c ++++ b/gst/playback/gstplaybin2.c +@@ -500,8 +500,7 @@ struct _GstPlayBinClass + #define DEFAULT_SUBURI NULL + #define DEFAULT_SOURCE NULL + #define DEFAULT_FLAGS GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_TEXT | \ +- GST_PLAY_FLAG_SOFT_VOLUME | GST_PLAY_FLAG_DEINTERLACE | \ +- GST_PLAY_FLAG_SOFT_COLORBALANCE ++ GST_PLAY_FLAG_SOFT_VOLUME + #define DEFAULT_N_VIDEO 0 + #define DEFAULT_CURRENT_VIDEO -1 + #define DEFAULT_N_AUDIO 0 +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0006-taglist-not-send-to-down-stream-if-all-the-frame-cor.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0006-taglist-not-send-to-down-stream-if-all-the-frame-cor.patch new file mode 100644 index 0000000..c8fd2eb --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0006-taglist-not-send-to-down-stream-if-all-the-frame-cor.patch @@ -0,0 +1,58 @@ +From 1dfe4f567771217bb33c57e8480b99969f119ded Mon Sep 17 00:00:00 2001 +From: Lyon Wang <lyon.wang@freescale.com> +Date: Wed, 21 Oct 2015 16:35:43 +0800 +Subject: [PATCH 07/16] taglist not send to down stream if all the frame + corrupted + +https://bugzilla.gnome.org/show_bug.cgi?id=737246 + +Upstream-Status: Pending + +Signed-off-by: Jian Li <lj.qfy.sh@gmail.com> +--- + gst-libs/gst/audio/gstaudiodecoder.c | 9 +++++++++ + gst-libs/gst/video/gstvideodecoder.c | 8 ++++++++ + 2 files changed, 17 insertions(+) + +diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c +index 333dbf9..d082380 100644 +--- a/gst-libs/gst/audio/gstaudiodecoder.c ++++ b/gst-libs/gst/audio/gstaudiodecoder.c +@@ -2261,6 +2261,15 @@ gst_audio_decoder_sink_eventfunc (GstAudioDecoder * dec, GstEvent * event) + ("no valid frames found")); + } + ++ /* send taglist if no valid frame is decoded util EOS */ ++ if (dec->priv->taglist && dec->priv->taglist_changed) { ++ GST_DEBUG_OBJECT (dec, "codec tag %" GST_PTR_FORMAT, dec->priv->taglist); ++ if (!gst_tag_list_is_empty (dec->priv->taglist)) ++ gst_audio_decoder_push_event (dec, ++ gst_event_new_tag (gst_tag_list_ref (dec->priv->taglist))); ++ dec->priv->taglist_changed = FALSE; ++ } ++ + /* Forward EOS because no buffer or serialized event will come after + * EOS and nothing could trigger another _finish_frame() call. */ + if (dec->priv->pending_events) +diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c +index b91a32e..1f89e10 100644 +--- a/gst-libs/gst/video/gstvideodecoder.c ++++ b/gst-libs/gst/video/gstvideodecoder.c +@@ -1165,6 +1165,14 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder, + * parent class' ::sink_event() until a later time. + */ + forward_immediate = TRUE; ++ ++ /* send taglist if no valid frame is decoded util EOS */ ++ if (decoder->priv->tags && decoder->priv->tags_changed) { ++ gst_video_decoder_push_event (decoder, ++ gst_event_new_tag (gst_tag_list_ref (decoder->priv->tags))); ++ decoder->priv->tags_changed = FALSE; ++ } ++ + break; + } + case GST_EVENT_GAP: +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0007-handle-audio-video-decoder-error.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0007-handle-audio-video-decoder-error.patch new file mode 100644 index 0000000..ed39e85 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0007-handle-audio-video-decoder-error.patch @@ -0,0 +1,66 @@ +From 40ef196e9291e71b852b32979daa0256cb805d14 Mon Sep 17 00:00:00 2001 +From: Lyon Wang <lyon.wang@freescale.com> +Date: Mon, 15 Dec 2014 16:52:07 +0800 +Subject: [PATCH 08/16] handle audio/video decoder error + +When there is input data and no output data to the end of the stream, it will +send GST_ELEMENT_ERROR, So the clips playing will quit. +However, if only one of the tracks is corrupt, there is no need to quit other +tracks playing. + +The patch comments the GST_ELEMENT_ERROR() and just add GST_ERROR_OBJECT() +information instead. + +https://bugzilla.gnome.org/show_bug.cgi?id=741542 + +Upstream-Status: Pending + +Signed-off-by: Lyon Wang <lyon.wang@freescale.com> +--- + gst-libs/gst/audio/gstaudiodecoder.c | 5 +++-- + gst-libs/gst/video/gstvideodecoder.c | 5 +++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + mode change 100644 => 100755 gst-libs/gst/audio/gstaudiodecoder.c + mode change 100644 => 100755 gst-libs/gst/video/gstvideodecoder.c + +diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c +old mode 100644 +new mode 100755 +index d082380..669b02a +--- a/gst-libs/gst/audio/gstaudiodecoder.c ++++ b/gst-libs/gst/audio/gstaudiodecoder.c +@@ -2256,9 +2256,10 @@ gst_audio_decoder_sink_eventfunc (GstAudioDecoder * dec, GstEvent * event) + GST_AUDIO_DECODER_STREAM_UNLOCK (dec); + + if (dec->priv->ctx.had_input_data && !dec->priv->ctx.had_output_data) { +- GST_ELEMENT_ERROR (dec, STREAM, DECODE, ++ /* GST_ELEMENT_ERROR (dec, STREAM, DECODE, + ("No valid frames decoded before end of stream"), +- ("no valid frames found")); ++ ("no valid frames found")); */ ++ GST_ERROR_OBJECT(dec, "No valid frames decoded before end of stream"); + } + + /* send taglist if no valid frame is decoded util EOS */ +diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c +old mode 100644 +new mode 100755 +index 1f89e10..802d94a +--- a/gst-libs/gst/video/gstvideodecoder.c ++++ b/gst-libs/gst/video/gstvideodecoder.c +@@ -1151,9 +1151,10 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder, + + /* Error out even if EOS was ok when we had input, but no output */ + if (ret && priv->had_input_data && !priv->had_output_data) { +- GST_ELEMENT_ERROR (decoder, STREAM, DECODE, ++ /* GST_ELEMENT_ERROR (decoder, STREAM, DECODE, + ("No valid frames decoded before end of stream"), +- ("no valid frames found")); ++ ("no valid frames found")); */ ++ GST_ERROR_OBJECT(decoder, "No valid frames decoded before end of stream"); + } + + /* Forward EOS immediately. This is required because no +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0008-gstaudiobasesink-print-warning-istead-of-return-ERRO.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0008-gstaudiobasesink-print-warning-istead-of-return-ERRO.patch new file mode 100644 index 0000000..acfb748 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0008-gstaudiobasesink-print-warning-istead-of-return-ERRO.patch @@ -0,0 +1,47 @@ +From 0b04eab955d557b84cfecea4bbe8cec6f04da0d8 Mon Sep 17 00:00:00 2001 +From: Lyon Wang <lyon.wang@freescale.com> +Date: Tue, 17 Nov 2015 14:56:47 +0800 +Subject: [PATCH 09/16] gstaudiobasesink print warning istead of return ERROR. + +For those clips with corrupt audio track, +there might be no output from audio decoder +and thus the audio track have no chance to negotiate. +We can just print error warning instead of return ERROR, +so that other track can be played normally + +https://bugzilla.gnome.org/show_bug.cgi?id=758215 + +Upstream-Status: Pending + +Signed-off-by: Lyon Wang <lyon.wang@freescale.com> +--- + gst-libs/gst/audio/gstaudiobasesink.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + mode change 100644 => 100755 gst-libs/gst/audio/gstaudiobasesink.c + +diff --git a/gst-libs/gst/audio/gstaudiobasesink.c b/gst-libs/gst/audio/gstaudiobasesink.c +old mode 100644 +new mode 100755 +index 6c0e7c9..91f0a48 +--- a/gst-libs/gst/audio/gstaudiobasesink.c ++++ b/gst-libs/gst/audio/gstaudiobasesink.c +@@ -1114,10 +1114,15 @@ gst_audio_base_sink_wait_event (GstBaseSink * bsink, GstEvent * event) + case GST_EVENT_GAP: + /* We must have a negotiated format before starting the ringbuffer */ + if (G_UNLIKELY (!gst_audio_ring_buffer_is_acquired (sink->ringbuffer))) { +- GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), ++ /* GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), + ("Sink not negotiated before %s event.", + GST_EVENT_TYPE_NAME (event))); ++ + return GST_FLOW_ERROR; ++ */ ++ /* consider there might be chance that corrupt audio track without output buffer and not negotiated. ++ We'd better not return error and quit play, video track can keep playing.*/ ++ GST_ERROR_OBJECT(sink, "Sink not negotiated before %s event.",GST_EVENT_TYPE_NAME (event)); + } + + gst_audio_base_sink_force_start (sink); +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0009-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0009-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch new file mode 100644 index 0000000..8055e84 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0009-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch @@ -0,0 +1,58 @@ +From c2790999940b0d96a663114c7f7a5af3b6069fef Mon Sep 17 00:00:00 2001 +From: Song Bing <b06498@freescale.com> +Date: Mon, 11 Jan 2016 14:51:17 +0800 +Subject: [PATCH 10/16] MMFMWK-7030 [Linux_MX6QP_ARD]IMXCameraApp:When Enabled + "save time to image" item, preview, find the time can not display completely. + 100% + +As IPU need 8 pixels alignment, add one workaround in base text overlay +to generate 8 pixels alignment text video buffer. The side effect should +cause all text a little smaller. + +Upstream-Status: Inappropriate [i.MX specific] + +Signed-off-by: Song Bing b06498@freescale.com +--- + ext/pango/gstbasetextoverlay.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c +index c08e3b0..421340a 100755 +--- a/ext/pango/gstbasetextoverlay.c ++++ b/ext/pango/gstbasetextoverlay.c +@@ -1677,7 +1677,7 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay, + gint unscaled_width, unscaled_height; + gint width, height; + gboolean full_width = FALSE; +- double scalef = 1.0; ++ double scalef = 1.0, scalefx, scalefy; + double a, r, g, b; + gdouble shadow_offset = 0.0; + gdouble outline_offset = 0.0; +@@ -1805,6 +1805,14 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay, + height = ceil (height * overlay->render_scale); + scalef *= overlay->render_scale; + ++ /* i.MX special, will cause text a little small */ ++ scalefx = scalef * ((gdouble)GST_ROUND_DOWN_8 (width)) / width; ++ scalefy = scalef * ((gdouble)GST_ROUND_DOWN_8 (height)) / height; ++ width = GST_ROUND_DOWN_8 (width); ++ height = GST_ROUND_DOWN_8 (height); ++ GST_DEBUG_OBJECT (overlay, "Rendering with width %d and height %d " ++ , width, height); ++ + if (width <= 0 || height <= 0) { + g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock); + GST_DEBUG_OBJECT (overlay, +@@ -1821,7 +1829,7 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay, + /* Prepare the transformation matrix. Note that the transformation happens + * in reverse order. So for horizontal text, we will translate and then + * scale. This is important to understand which scale shall be used. */ +- cairo_matrix_init_scale (&cairo_matrix, scalef, scalef); ++ cairo_matrix_init_scale (&cairo_matrix, scalefx, scalefy); + + if (overlay->use_vertical_render) { + gint tmp; +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0010-MMFMWK-7259-Remove-dependence-on-imx-plugin-git.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0010-MMFMWK-7259-Remove-dependence-on-imx-plugin-git.patch new file mode 100644 index 0000000..bd6b1df --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0010-MMFMWK-7259-Remove-dependence-on-imx-plugin-git.patch @@ -0,0 +1,433 @@ +From d58bab2ab3df3b40d6f65d88d0c827a303e0a651 Mon Sep 17 00:00:00 2001 +From: Haihua Hu <jared.hu@nxp.com> +Date: Fri, 5 Aug 2016 17:08:40 +0800 +Subject: [PATCH 11/16] [MMFMWK-7259] Remove dependence on imx plugin git. + +Add physical memory allocator + +Upstream-Status: Inappropriate [i.MX specific] + +Signed-off-by: Haihua Hu <jared.hu@nxp.com> +--- + gst-libs/gst/allocators/Makefile.am | 6 +- + gst-libs/gst/allocators/gstallocatorphymem.c | 314 +++++++++++++++++++++++++++ + gst-libs/gst/allocators/gstallocatorphymem.h | 64 ++++++ + 3 files changed, 382 insertions(+), 2 deletions(-) + create mode 100755 gst-libs/gst/allocators/gstallocatorphymem.c + create mode 100755 gst-libs/gst/allocators/gstallocatorphymem.h + +diff --git a/gst-libs/gst/allocators/Makefile.am b/gst-libs/gst/allocators/Makefile.am +index bccfdb3..a19c249 100644 +--- a/gst-libs/gst/allocators/Makefile.am ++++ b/gst-libs/gst/allocators/Makefile.am +@@ -5,13 +5,15 @@ libgstallocators_@GST_API_VERSION@_includedir = $(includedir)/gstreamer-@GST_API + libgstallocators_@GST_API_VERSION@_include_HEADERS = \ + allocators.h \ + gstfdmemory.h \ +- gstdmabuf.h ++ gstdmabuf.h \ ++ gstallocatorphymem.h + + noinst_HEADERS = + + libgstallocators_@GST_API_VERSION@_la_SOURCES = \ + gstfdmemory.c \ +- gstdmabuf.c ++ gstdmabuf.c \ ++ gstallocatorphymem.c + + libgstallocators_@GST_API_VERSION@_la_LIBADD = $(GST_LIBS) $(LIBM) + libgstallocators_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) +diff --git a/gst-libs/gst/allocators/gstallocatorphymem.c b/gst-libs/gst/allocators/gstallocatorphymem.c +new file mode 100755 +index 0000000..cf5995e +--- /dev/null ++++ b/gst-libs/gst/allocators/gstallocatorphymem.c +@@ -0,0 +1,314 @@ ++/* ++ * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++#include <stdio.h> ++#include <string.h> ++#include "gstallocatorphymem.h" ++ ++typedef struct { ++ GstMemory mem; ++ guint8 *vaddr; ++ guint8 *paddr; ++ PhyMemBlock block; ++} GstMemoryPhy; ++ ++static int ++default_copy (GstAllocatorPhyMem *allocator, PhyMemBlock *dst_mem, ++ PhyMemBlock *src_mem, guint offset, guint size) ++{ ++ GST_WARNING ("No default copy implementation for physical memory allocator.\n"); ++ return -1; ++} ++ ++static gpointer ++gst_phymem_map (GstMemory * mem, gsize maxsize, GstMapFlags flags) ++{ ++ GstMemoryPhy *phymem = (GstMemoryPhy*) mem; ++ ++ if (GST_MEMORY_IS_READONLY(mem) && (flags & GST_MAP_WRITE)) { ++ GST_ERROR("memory is read only"); ++ return NULL; ++ } ++ ++ return phymem->vaddr; ++} ++ ++static void ++gst_phymem_unmap (GstMemory * mem) ++{ ++ return; ++} ++ ++static GstMemory * ++gst_phymem_copy (GstMemory * mem, gssize offset, gssize size) ++{ ++ GstAllocatorPhyMemClass *klass; ++ GstMemoryPhy *src_mem = (GstMemoryPhy *)mem; ++ ++ GstMemoryPhy *dst_mem = g_slice_alloc(sizeof(GstMemoryPhy)); ++ if(dst_mem == NULL) { ++ GST_ERROR("Can't allocate for GstMemoryPhy structure.\n"); ++ return NULL; ++ } ++ ++ klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(mem->allocator)); ++ if(klass == NULL) { ++ GST_ERROR("Can't get class from allocator object.\n"); ++ return NULL; ++ } ++ ++ if(klass->copy_phymem((GstAllocatorPhyMem*)mem->allocator, ++ &dst_mem->block, &src_mem->block, offset, size) < 0) { ++ GST_WARNING ("Copy phymem %d failed.\n", size); ++ return NULL; ++ } ++ ++ GST_DEBUG ("copied phymem, vaddr(%p), paddr(%p), size(%d).\n", ++ dst_mem->block.vaddr, dst_mem->block.paddr, dst_mem->block.size); ++ ++ dst_mem->vaddr = dst_mem->block.vaddr; ++ dst_mem->paddr = dst_mem->block.paddr; ++ ++ gst_memory_init (GST_MEMORY_CAST (dst_mem), ++ mem->mini_object.flags&(~GST_MEMORY_FLAG_READONLY), ++ mem->allocator, NULL, mem->maxsize, mem->align, ++ mem->offset, mem->size); ++ ++ return (GstMemory*)dst_mem; ++} ++ ++static GstMemory * ++gst_phymem_share (GstMemory * mem, gssize offset, gssize size) ++{ ++ GST_ERROR("Not implemented mem_share in gstallocatorphymem.\n"); ++ return NULL; ++} ++ ++static gboolean ++gst_phymem_is_span (GstMemory * mem1, GstMemory * mem2, gsize * offset) ++{ ++ return FALSE; ++} ++ ++static gpointer ++gst_phymem_get_phy (GstMemory * mem) ++{ ++ GstMemoryPhy *phymem = (GstMemoryPhy*) mem; ++ ++ return phymem->paddr; ++} ++ ++static GstMemory * ++base_alloc (GstAllocator * allocator, gsize size, ++ GstAllocationParams * params) ++{ ++ GstAllocatorPhyMemClass *klass; ++ GstMemoryPhy *mem; ++ gsize maxsize, aoffset, offset, align, padding; ++ guint8 *data; ++ ++ mem = g_slice_alloc(sizeof(GstMemoryPhy)); ++ if(mem == NULL) { ++ GST_ERROR("Can allocate for GstMemoryPhy structure.\n"); ++ return NULL; ++ } ++ ++ klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(allocator)); ++ if(klass == NULL) { ++ GST_ERROR("Can't get class from allocator object.\n"); ++ return NULL; ++ } ++ ++ GST_DEBUG ("allocate params, prefix (%d), padding (%d), align (%d), flags (%x).\n", ++ params->prefix, params->padding, params->align, params->flags); ++ ++ maxsize = size + params->prefix + params->padding; ++ mem->block.size = maxsize; ++ if(klass->alloc_phymem((GstAllocatorPhyMem*)allocator, &mem->block) < 0) { ++ GST_ERROR("Allocate phymem %d failed.\n", maxsize); ++ return NULL; ++ } ++ ++ GST_DEBUG ("allocated phymem, vaddr(%p), paddr(%p), size(%d).\n", ++ mem->block.vaddr, mem->block.paddr, mem->block.size); ++ ++ data = mem->block.vaddr; ++ offset = params->prefix; ++ align = params->align; ++ /* do alignment */ ++ if ((aoffset = ((guintptr)data & align))) { ++ aoffset = (align + 1) - aoffset; ++ data += aoffset; ++ maxsize -= aoffset; ++ } ++ mem->vaddr = mem->block.vaddr + aoffset; ++ mem->paddr = mem->block.paddr + aoffset; ++ ++ GST_DEBUG ("aligned vaddr(%p), paddr(%p), size(%d).\n", ++ mem->block.vaddr, mem->block.paddr, mem->block.size); ++ ++ if (offset && (params->flags & GST_MEMORY_FLAG_ZERO_PREFIXED)) ++ memset (data, 0, offset); ++ ++ padding = maxsize - (offset + size); ++ if (padding && (params->flags & GST_MEMORY_FLAG_ZERO_PADDED)) ++ memset (data + offset + size, 0, padding); ++ ++ gst_memory_init (GST_MEMORY_CAST (mem), params->flags, allocator, NULL, maxsize, align, offset, size); ++ ++ return (GstMemory*)mem; ++} ++ ++static void ++base_free (GstAllocator * allocator, GstMemory * mem) ++{ ++ GstAllocatorPhyMemClass *klass; ++ GstMemoryPhy *phymem; ++ ++ klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(allocator)); ++ if(klass == NULL) { ++ GST_ERROR("Can't get class from allocator object, can't free %p\n", mem); ++ return; ++ } ++ ++ phymem = (GstMemoryPhy*)mem; ++ ++ GST_DEBUG ("free phymem, vaddr(%p), paddr(%p), size(%d).\n", ++ phymem->block.vaddr, phymem->block.paddr, phymem->block.size); ++ ++ klass->free_phymem((GstAllocatorPhyMem*)allocator, &phymem->block); ++ g_slice_free1(sizeof(GstMemoryPhy), mem); ++ ++ return; ++} ++ ++static int ++default_alloc (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem) ++{ ++ GST_ERROR ("No default allocating implementation for physical memory allocation.\n"); ++ return -1; ++} ++ ++static int ++default_free (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem) ++{ ++ GST_ERROR ("No default free implementation for physical memory allocation.\n"); ++ return -1; ++} ++ ++G_DEFINE_TYPE (GstAllocatorPhyMem, gst_allocator_phymem, GST_TYPE_ALLOCATOR); ++ ++static void ++gst_allocator_phymem_class_init (GstAllocatorPhyMemClass * klass) ++{ ++ GstAllocatorClass *allocator_class; ++ ++ allocator_class = (GstAllocatorClass *) klass; ++ ++ allocator_class->alloc = base_alloc; ++ allocator_class->free = base_free; ++ klass->alloc_phymem = default_alloc; ++ klass->free_phymem = default_free; ++ klass->copy_phymem = default_copy; ++} ++ ++static void ++gst_allocator_phymem_init (GstAllocatorPhyMem * allocator) ++{ ++ GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator); ++ ++ alloc->mem_map = gst_phymem_map; ++ alloc->mem_unmap = gst_phymem_unmap; ++ alloc->mem_copy = gst_phymem_copy; ++ alloc->mem_share = gst_phymem_share; ++ alloc->mem_is_span = gst_phymem_is_span; ++} ++ ++ ++//global functions ++ ++gboolean ++gst_buffer_is_phymem (GstBuffer *buffer) ++{ ++ gboolean ret = FALSE; ++ PhyMemBlock * memblk; ++ GstMemory *mem = gst_buffer_get_memory (buffer, 0); ++ if(mem == NULL) { ++ GST_ERROR ("Not get memory from buffer.\n"); ++ return FALSE; ++ } ++ ++ if(GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) { ++ if (NULL == ((GstMemoryPhy*)mem)->block.paddr) { ++ GST_WARNING("physical address in memory block is invalid"); ++ ret = FALSE; ++ } else { ++ ret = TRUE; ++ } ++ } ++ ++ gst_memory_unref (mem); ++ ++ return ret; ++} ++ ++PhyMemBlock * ++gst_buffer_query_phymem_block (GstBuffer *buffer) ++{ ++ GstMemory *mem; ++ GstMemoryPhy *memphy; ++ PhyMemBlock *memblk; ++ ++ mem = gst_buffer_get_memory (buffer, 0); ++ if(mem == NULL) { ++ GST_ERROR ("Not get memory from buffer.\n"); ++ return NULL; ++ } ++ ++ if(!GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) { ++ gst_memory_unref (mem); ++ return NULL; ++ } ++ ++ memphy = (GstMemoryPhy*) mem; ++ memblk = &memphy->block; ++ ++ gst_memory_unref (mem); ++ ++ return memblk; ++} ++ ++PhyMemBlock * ++gst_memory_query_phymem_block (GstMemory *mem) ++{ ++ GstMemoryPhy *memphy; ++ PhyMemBlock *memblk; ++ ++ if (!mem) ++ return NULL; ++ ++ if (!GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) ++ return NULL; ++ ++ memphy = (GstMemoryPhy*) mem; ++ memblk = &memphy->block; ++ ++ return memblk; ++} ++ +diff --git a/gst-libs/gst/allocators/gstallocatorphymem.h b/gst-libs/gst/allocators/gstallocatorphymem.h +new file mode 100755 +index 0000000..f0833ae +--- /dev/null ++++ b/gst-libs/gst/allocators/gstallocatorphymem.h +@@ -0,0 +1,64 @@ ++/* ++ * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++#ifndef __ALLOCATOR_PHYMEM_H__ ++#define __ALLOCATOR_PHYMEM_H__ ++ ++#include <gst/gst.h> ++#include <gst/gstallocator.h> ++ ++#define PAGE_ALIGN(x) (((x) + 4095) & ~4095) ++ ++#define GST_TYPE_ALLOCATOR_PHYMEM (gst_allocator_phymem_get_type()) ++#define GST_ALLOCATOR_PHYMEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ALLOCATOR_PHYMEM, GstAllocatorPhyMem)) ++#define GST_ALLOCATOR_PHYMEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ALLOCATOR_PHYMEM, GstAllocatorPhyMemClass)) ++#define GST_IS_ALLOCATOR_PHYMEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ALLOCATOR_PHYMEM)) ++#define GST_IS_ALLOCATOR_PHYMEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ALLOCATOR_PHYMEM)) ++ ++typedef struct _GstAllocatorPhyMem GstAllocatorPhyMem; ++typedef struct _GstAllocatorPhyMemClass GstAllocatorPhyMemClass; ++ ++/* also change gst-libs/gst/gl/gstglvivdirecttexture.c in gst-plugins-bad git ++ * if changed below structure */ ++typedef struct { ++ guint8 *vaddr; ++ guint8 *paddr; ++ guint8 *caddr; ++ gsize size; ++ gpointer *user_data; ++} PhyMemBlock; ++ ++struct _GstAllocatorPhyMem { ++ GstAllocator parent; ++}; ++ ++struct _GstAllocatorPhyMemClass { ++ GstAllocatorClass parent_class; ++ int (*alloc_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem); ++ int (*free_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem); ++ int (*copy_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *det_mem, ++ PhyMemBlock *src_mem, guint offset, guint size); ++}; ++ ++GType gst_allocator_phymem_get_type (void); ++gboolean gst_buffer_is_phymem (GstBuffer *buffer); ++PhyMemBlock *gst_buffer_query_phymem_block (GstBuffer *buffer); ++PhyMemBlock *gst_memory_query_phymem_block (GstMemory *mem); ++ ++#endif +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0011-Disable-orc-optimization-for-lib-video-in-plugins-ba.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0011-Disable-orc-optimization-for-lib-video-in-plugins-ba.patch new file mode 100644 index 0000000..69e1c9a --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0011-Disable-orc-optimization-for-lib-video-in-plugins-ba.patch @@ -0,0 +1,34 @@ +From 0100444aa707053fb65bea26feffb5de90909b60 Mon Sep 17 00:00:00 2001 +From: Lyon Wang <lyon.wang@freescale.com> +Date: Thu, 10 Dec 2015 14:32:43 +0800 +Subject: [PATCH 12/16] Disable orc optimization for lib video in plugins-base + +- the orc optimization for lib video in plugins base may +cause segmentation fault +- disalbe orc optimization for lib video and just use the c source + +package: gstreamer1.0-plugins-base + +Upstream-Status: Pending [https://bugzilla.gnome.org/show_bug.cgi?id=759286] + +Signed-off-by: Lyon Wang <lyon.wang@freescale.com> +--- + gst-libs/gst/video/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gst-libs/gst/video/Makefile.am b/gst-libs/gst/video/Makefile.am +index 64f4978..a197a2f 100644 +--- a/gst-libs/gst/video/Makefile.am ++++ b/gst-libs/gst/video/Makefile.am +@@ -90,7 +90,7 @@ nodist_libgstvideo_@GST_API_VERSION@include_HEADERS = $(built_headers) + noinst_HEADERS = gstvideoutilsprivate.h + + libgstvideo_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) \ +- $(ORC_CFLAGS) ++ $(ORC_CFLAGS) -DDISABLE_ORC + libgstvideo_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM) + libgstvideo_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) + +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0012-Remove-phymem-allocator-from-base-to-bad.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0012-Remove-phymem-allocator-from-base-to-bad.patch new file mode 100644 index 0000000..5d3aaf9 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0012-Remove-phymem-allocator-from-base-to-bad.patch @@ -0,0 +1,37 @@ +From 2ad9aa1c62ff7b7772862ace35dd03bfae3f0fce Mon Sep 17 00:00:00 2001 +From: Haihua Hu <jared.hu@nxp.com> +Date: Thu, 25 May 2017 11:31:46 +0800 +Subject: [PATCH 16/16] Remove phymem allocator from base to bad + +Upstream-Status: Inappropriate [i.MX specific] +--- + gst-libs/gst/allocators/Makefile.am | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/gst-libs/gst/allocators/Makefile.am b/gst-libs/gst/allocators/Makefile.am +index 1955436..1c5680b 100644 +--- a/gst-libs/gst/allocators/Makefile.am ++++ b/gst-libs/gst/allocators/Makefile.am +@@ -5,8 +5,7 @@ libgstallocators_@GST_API_VERSION@_includedir = $(includedir)/gstreamer-@GST_API + libgstallocators_@GST_API_VERSION@_include_HEADERS = \ + allocators.h \ + gstfdmemory.h \ +- gstdmabuf.h \ +- gstallocatorphymem.h ++ gstdmabuf.h + + if USE_ION + libgstallocators_@GST_API_VERSION@_include_HEADERS += \ +@@ -17,8 +16,7 @@ noinst_HEADERS = + + libgstallocators_@GST_API_VERSION@_la_SOURCES = \ + gstfdmemory.c \ +- gstdmabuf.c \ +- gstallocatorphymem.c ++ gstdmabuf.c + + if USE_ION + libgstallocators_@GST_API_VERSION@_la_SOURCES += \ +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0013-dmabuf-set-fd-memory-to-keep-mapped.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0013-dmabuf-set-fd-memory-to-keep-mapped.patch new file mode 100644 index 0000000..da3df63 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0013-dmabuf-set-fd-memory-to-keep-mapped.patch @@ -0,0 +1,30 @@ +From 59a4c4584f732eea055267971013909816287311 Mon Sep 17 00:00:00 2001 +From: Song Bing <bing.song@nxp.com> +Date: Wed, 13 Sep 2017 13:37:17 -0800 +Subject: [PATCH 4/4] dmabuf: set fd memory to keep mapped + +set fd memory to keep mapped. + +Upstream-Status: Pending + +https://bugzilla.gnome.org/show_bug.cgi?id=768794 +--- + gst-libs/gst/allocators/gstdmabuf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gst-libs/gst/allocators/gstdmabuf.c b/gst-libs/gst/allocators/gstdmabuf.c +index 7d6bcab..89bb447 100644 +--- a/gst-libs/gst/allocators/gstdmabuf.c ++++ b/gst-libs/gst/allocators/gstdmabuf.c +@@ -95,7 +95,7 @@ gst_dmabuf_allocator_alloc (GstAllocator * allocator, gint fd, gsize size) + { + g_return_val_if_fail (GST_IS_DMABUF_ALLOCATOR (allocator), NULL); + +- return gst_fd_allocator_alloc (allocator, fd, size, GST_FD_MEMORY_FLAG_NONE); ++ return gst_fd_allocator_alloc (allocator, fd, size, GST_FD_MEMORY_FLAG_KEEP_MAPPED); + } + + /** +-- +2.7.4 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0014-fdmemory-need-unmap-if-mapping-flags-are-not-subset-.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0014-fdmemory-need-unmap-if-mapping-flags-are-not-subset-.patch new file mode 100644 index 0000000..a986d22 --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0014-fdmemory-need-unmap-if-mapping-flags-are-not-subset-.patch @@ -0,0 +1,36 @@ +From bbce23ade0d17c7ef4dbd6042009e0f2419f9668 Mon Sep 17 00:00:00 2001 +From: Haihua Hu <jared.hu@nxp.com> +Date: Mon, 6 Nov 2017 15:05:47 +0800 +Subject: [PATCH] fdmemory: need unmap if mapping flags are not subset of + previous + +Upstream-Status: Pending +https://bugzilla.gnome.org/show_bug.cgi?id=789952 + +--- + gst-libs/gst/allocators/gstfdmemory.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/gst-libs/gst/allocators/gstfdmemory.c b/gst-libs/gst/allocators/gstfdmemory.c +index ad428a7..1e6125a 100644 +--- a/gst-libs/gst/allocators/gstfdmemory.c ++++ b/gst-libs/gst/allocators/gstfdmemory.c +@@ -97,9 +97,13 @@ gst_fd_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags) + if ((mem->mmapping_flags & prot) == prot) { + ret = mem->data; + mem->mmap_count++; ++ goto out; ++ } else { ++ /* if mapping flags is not a subset, need unmap first */ ++ munmap ((void *) mem->data, gmem->maxsize); ++ mem->data = NULL; ++ mem->mmap_count = 0;; + } +- +- goto out; + } + + if (mem->fd != -1) { +-- +1.9.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0015-basetextoverlay-need-avoid-idx-exceed-me.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0015-basetextoverlay-need-avoid-idx-exceed-me.patch new file mode 100644 index 0000000..5fdc93c --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0015-basetextoverlay-need-avoid-idx-exceed-me.patch @@ -0,0 +1,34 @@ +From f11ab0f14638d21b6e48bff3fd63aaaa0689f21d Mon Sep 17 00:00:00 2001 +From: Haihua Hu <jared.hu@nxp.com> +Date: Thu, 30 Nov 2017 17:43:20 +0800 +Subject: [PATCH] [MMFMWK-7786] basetextoverlay: need avoid idx exceed memory + block number + +when check whether video buffer is read only, the gst_buffer_get_memory call +should make sure idx don't exceed the total memory block number + +Upstream-Status: Inappropriate [i.MX specific] + +Signed-off-by: Haihua Hu <jared.hu@nxp.com> +--- + ext/pango/gstbasetextoverlay.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c +index 7e32904..d2bbbee 100755 +--- a/ext/pango/gstbasetextoverlay.c ++++ b/ext/pango/gstbasetextoverlay.c +@@ -2248,7 +2248,9 @@ gst_base_text_overlay_push_frame (GstBaseTextOverlay * overlay, + gboolean mem_rdonly = FALSE; + GstMemory *mem; + +- while (mem = gst_buffer_get_memory(video_frame, idx++)) { ++ gint n_mem = gst_buffer_n_memory (video_frame); ++ ++ while (idx < n_mem && (mem = gst_buffer_get_memory(video_frame, idx++))) { + if (GST_MEMORY_IS_READONLY(mem)) { + gst_memory_unref (mem); + mem_rdonly = TRUE; +-- +1.9.1 + |