Hello community,

here is the log from the commit of package gstreamer-plugins-libav for 
openSUSE:Factory checked in at 2019-12-02 11:31:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/gstreamer-plugins-libav (Old)
 and      /work/SRC/openSUSE:Factory/.gstreamer-plugins-libav.new.4691 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "gstreamer-plugins-libav"

Mon Dec  2 11:31:22 2019 rev:18 rq:752553 version:1.16.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/gstreamer-plugins-libav/gstreamer-plugins-libav.changes
  2019-10-11 15:13:35.944716855 +0200
+++ 
/work/SRC/openSUSE:Factory/.gstreamer-plugins-libav.new.4691/gstreamer-plugins-libav.changes
        2019-12-02 11:35:53.338429718 +0100
@@ -1,0 +2,6 @@
+Thu Nov 28 22:15:36 UTC 2019 - Bjørn Lie <bjorn....@gmail.com>
+
+- Add gst-libav-fix-mem-leak.patch: Fix memory leak.
+- Add gst-libav-fix-segfault.patch: Fix segmentation fault.
+
+-------------------------------------------------------------------

New:
----
  gst-libav-fix-mem-leak.patch
  gst-libav-fix-segfault.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ gstreamer-plugins-libav.spec ++++++
--- /var/tmp/diff_new_pack.TtpIjl/_old  2019-12-02 11:35:55.842430244 +0100
+++ /var/tmp/diff_new_pack.TtpIjl/_new  2019-12-02 11:35:55.874430252 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package gstreamer-plugins-libav
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -26,6 +26,10 @@
 URL:            http://gstreamer.freedesktop.org/
 Source:         
https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-%{version}.tar.xz
 Source1000:     baselibs.conf
+# PATCH-FIX-UPSTREAM gst-libav-fix-mem-leak.patch -- Fix mem leak
+Patch0:         gst-libav-fix-mem-leak.patch
+# PATCH-FIX-UPSTREAM gst-libav-fix-segfault.patch -- Fix segfault
+Patch1:         gst-libav-fix-segfault.patch
 
 BuildRequires:  pkgconfig
 BuildRequires:  yasm
@@ -81,6 +85,8 @@
 %setup -q -n gst-libav-%{version}
 # Ensure we cannot use the embedded libav
 rm -rf gst-libs/ext/libav
+%patch0 -p1
+%patch1 -p1
 
 %build
 # TODO: switch to meson, but need to allow a GPL build first

++++++ gst-libav-fix-mem-leak.patch ++++++
>From 2e8296620bc22f97c34f876ab62902e7c3d89601 Mon Sep 17 00:00:00 2001
From: Seungha Yang <seungha.y...@navercorp.com>
Date: Thu, 24 Oct 2019 00:25:28 +0900
Subject: [PATCH] avviddec: Enforce allocate new AVFrame per input frame

... if ffmpeg would reuse the allocated AVBuffer. Reused AVFrame by
the ffmpeg seems to break our decoding flow since the reused AVFrame
holds the initial opaque data (GstVideoCodecFrame in this case), so
we couldn't trace the our in/out frames.
To enforce get_buffer() call per output frame, hold another reference
to the AVBuffer in order to mark the AVBuffer as not writable.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/62
---
 ext/libav/gstavviddec.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index 374bd9e..58979d8 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -730,6 +730,12 @@ gst_ffmpegviddec_can_direct_render (GstFFMpegVidDec * 
ffmpegdec)
       AV_CODEC_CAP_DR1);
 }
 
+static void
+gst_ffmpegviddec_avbuffer_unref (AVBufferRef * avbuffer)
+{
+  av_buffer_unref (&avbuffer);
+}
+
 /* called when ffmpeg wants us to allocate a buffer to write the decoded frame
  * into. We try to give it memory from our pool */
 static int
@@ -823,6 +829,16 @@ gst_ffmpegviddec_get_buffer2 (AVCodecContext * context, 
AVFrame * picture,
   }
 
   picture->buf[0] = av_buffer_create (NULL, 0, dummy_free_buffer, dframe, 0);
+  if ((flags & AV_GET_BUFFER_FLAG_REF) == AV_GET_BUFFER_FLAG_REF) {
+    /* decoder might reuse this AVFrame and it would result to no more
+     * get_buffer() call if the AVFrame's AVBuffer is writable
+     * (meaning that the refcount of AVBuffer == 1).
+     * To enforce get_buffer() for the every output frame, hold another ref 
here
+     */
+    gst_video_codec_frame_set_user_data (frame,
+        av_buffer_ref (picture->buf[0]),
+        (GDestroyNotify) gst_ffmpegviddec_avbuffer_unref);
+  }
 
   GST_LOG_OBJECT (ffmpegdec, "returned frame %p", dframe->buffer);
 
-- 
2.22.0


>From 20d73cbfeb51d9d9349a35156a15018fb7770d8e Mon Sep 17 00:00:00 2001
From: Seungha Yang <seungha.y...@navercorp.com>
Date: Tue, 29 Oct 2019 11:43:05 +0900
Subject: [PATCH] avviddec: Fix huge leak caused by circular reference

AVBufferRef -> GstFFMpegVideoDecVideoFrame -> GstVideoCodecFrame -> AVBufferRef

Instead of holding additional ref there, set read-only which would not be
reused by ff_reget_buffer()

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/63
---
 ext/libav/gstavviddec.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index 58979d8..b0f55f2 100644
--- a/ext/libav/gstavviddec.c
+++ b/ext/libav/gstavviddec.c
@@ -730,12 +730,6 @@ gst_ffmpegviddec_can_direct_render (GstFFMpegVidDec * 
ffmpegdec)
       AV_CODEC_CAP_DR1);
 }
 
-static void
-gst_ffmpegviddec_avbuffer_unref (AVBufferRef * avbuffer)
-{
-  av_buffer_unref (&avbuffer);
-}
-
 /* called when ffmpeg wants us to allocate a buffer to write the decoded frame
  * into. We try to give it memory from our pool */
 static int
@@ -747,6 +741,7 @@ gst_ffmpegviddec_get_buffer2 (AVCodecContext * context, 
AVFrame * picture,
   GstFFMpegVidDec *ffmpegdec;
   guint c;
   GstFlowReturn ret;
+  int create_buffer_flags = 0;
 
   ffmpegdec = (GstFFMpegVidDec *) context->opaque;
 
@@ -828,17 +823,16 @@ gst_ffmpegviddec_get_buffer2 (AVCodecContext * context, 
AVFrame * picture,
         picture->data[c]);
   }
 
-  picture->buf[0] = av_buffer_create (NULL, 0, dummy_free_buffer, dframe, 0);
   if ((flags & AV_GET_BUFFER_FLAG_REF) == AV_GET_BUFFER_FLAG_REF) {
     /* decoder might reuse this AVFrame and it would result to no more
      * get_buffer() call if the AVFrame's AVBuffer is writable
      * (meaning that the refcount of AVBuffer == 1).
-     * To enforce get_buffer() for the every output frame, hold another ref 
here
+     * To enforce get_buffer() for the every output frame, set read-only flag 
here
      */
-    gst_video_codec_frame_set_user_data (frame,
-        av_buffer_ref (picture->buf[0]),
-        (GDestroyNotify) gst_ffmpegviddec_avbuffer_unref);
+    create_buffer_flags = AV_BUFFER_FLAG_READONLY;
   }
+  picture->buf[0] = av_buffer_create (NULL,
+      0, dummy_free_buffer, dframe, create_buffer_flags);
 
   GST_LOG_OBJECT (ffmpegdec, "returned frame %p", dframe->buffer);
 
-- 
2.22.0

++++++ gst-libav-fix-segfault.patch ++++++
>From 36c4ae01143ffe8836bffd46237e884be95c88cd Mon Sep 17 00:00:00 2001
From: Kevin JOLY <kevin.j...@heig-vd.ch>
Date: Mon, 4 Nov 2019 15:39:59 +0100
Subject: [PATCH] avdemux: Fix segmentation fault if long_name is NULL

Some plugins (like libcdio) registers empty long_name field. Calling strncmp on 
this field leads to a segmentation fault.

Signed-off-by: Kevin Joly <joly.kevi...@gmail.com>
---
 ext/libav/gstavdemux.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/ext/libav/gstavdemux.c b/ext/libav/gstavdemux.c
index 3b74f92..fa5fd4e 100644
--- a/ext/libav/gstavdemux.c
+++ b/ext/libav/gstavdemux.c
@@ -1994,9 +1994,14 @@ gst_ffmpegdemux_register (GstPlugin * plugin)
         in_plugin->name, in_plugin->long_name);
 
     /* no emulators */
-    if (!strncmp (in_plugin->long_name, "raw ", 4) ||
-        !strncmp (in_plugin->long_name, "pcm ", 4) ||
-        !strcmp (in_plugin->name, "audio_device") ||
+    if (in_plugin->long_name != NULL) {
+      if (!strncmp (in_plugin->long_name, "raw ", 4) ||
+          !strncmp (in_plugin->long_name, "pcm ", 4)
+          )
+        continue;
+    }
+
+    if (!strcmp (in_plugin->name, "audio_device") ||
         !strncmp (in_plugin->name, "image", 5) ||
         !strcmp (in_plugin->name, "mpegvideo") ||
         !strcmp (in_plugin->name, "mjpeg") ||
-- 
2.22.0


Reply via email to