[gstreamer-plugins-good/f16: 1/2] backport several fixes from upstream to fix BGO #650785 (flac query problems)

Adam Williamson adamwill at fedoraproject.org
Fri Nov 4 22:36:44 UTC 2011


commit 4b0fa35f62c02d7aec69f1f889796bb6eb44542d
Author: Adam Williamson <awilliam at redhat.com>
Date:   Fri Nov 4 15:19:58 2011 -0700

    backport several fixes from upstream to fix BGO #650785 (flac query problems)

 ...ns-good-0.10.30-flacdec_also_try_upstream.patch |   26 +++++++
 ...lugins-good-0.10.30-flacparse_conversions.patch |   69 ++++++++++++++++++++
 ...ns-good-0.10.30-flacparse_fix_conversions.patch |   26 +++++++
 ...ins-good-0.10.30-flacparse_tell_baseparse.patch |   34 ++++++++++
 gstreamer-plugins-good-0.10.30-off_by_one.patch    |   29 ++++++++
 gstreamer-plugins-good.spec                        |   19 +++++-
 6 files changed, 202 insertions(+), 1 deletions(-)
---
diff --git a/gstreamer-plugins-good-0.10.30-flacdec_also_try_upstream.patch b/gstreamer-plugins-good-0.10.30-flacdec_also_try_upstream.patch
new file mode 100644
index 0000000..bcd7c0b
--- /dev/null
+++ b/gstreamer-plugins-good-0.10.30-flacdec_also_try_upstream.patch
@@ -0,0 +1,26 @@
+From 900b2fb63dac15fe1013d9e326a7a5c8d4da1cca Mon Sep 17 00:00:00 2001
+From: Tim-Philipp Müller <tim.muller at collabora.co.uk>
+Date: Mon, 23 May 2011 12:25:44 +0000
+Subject: flacdec: also try upstream first for duration query in DEFAULT format
+
+https://bugzilla.gnome.org/show_bug.cgi?id=650785
+---
+diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
+index 4957129..2e4085d 100644
+--- a/ext/flac/gstflacdec.c
++++ b/ext/flac/gstflacdec.c
+@@ -1724,8 +1724,9 @@ gst_flac_dec_src_query (GstPad * pad, GstQuery * query)
+ 
+       gst_query_parse_duration (query, &fmt, NULL);
+ 
+-      /* try any demuxers before us first */
+-      if (fmt == GST_FORMAT_TIME && peer && gst_pad_query (peer, query)) {
++      /* try any demuxers or parsers before us first */
++      if ((fmt == GST_FORMAT_TIME || fmt == GST_FORMAT_DEFAULT) &&
++          peer != NULL && gst_pad_query (peer, query)) {
+         gst_query_parse_duration (query, NULL, &len);
+         GST_DEBUG_OBJECT (flacdec, "peer returned duration %" GST_TIME_FORMAT,
+             GST_TIME_ARGS (len));
+--
+cgit v0.9.0.2-2-gbebe
+
diff --git a/gstreamer-plugins-good-0.10.30-flacparse_conversions.patch b/gstreamer-plugins-good-0.10.30-flacparse_conversions.patch
new file mode 100644
index 0000000..afc2b75
--- /dev/null
+++ b/gstreamer-plugins-good-0.10.30-flacparse_conversions.patch
@@ -0,0 +1,69 @@
+From 8823ae251a72bd18fc93322914c70390fc16c6b3 Mon Sep 17 00:00:00 2001
+From: Sebastian Dröge <sebastian.droege at collabora.co.uk>
+Date: Mon, 23 May 2011 09:36:36 +0000
+Subject: flacparse: Implement conversions between TIME and DEFAULT format
+
+Fixes bug #650785.
+---
+(limited to 'gst/audioparsers/gstflacparse.c')
+
+diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c
+index 0671187..0c76655 100644
+--- a/gst/audioparsers/gstflacparse.c
++++ b/gst/audioparsers/gstflacparse.c
+@@ -198,6 +198,9 @@ static GstFlowReturn gst_flac_parse_parse_frame (GstBaseParse * parse,
+     GstBaseParseFrame * frame);
+ static GstFlowReturn gst_flac_parse_pre_push_frame (GstBaseParse * parse,
+     GstBaseParseFrame * frame);
++static gboolean gst_flac_parse_convert (GstBaseParse * parse,
++    GstFormat src_format, gint64 src_value, GstFormat dest_format,
++    gint64 * dest_value);
+ 
+ GST_BOILERPLATE (GstFlacParse, gst_flac_parse, GstBaseParse,
+     GST_TYPE_BASE_PARSE);
+@@ -244,6 +247,7 @@ gst_flac_parse_class_init (GstFlacParseClass * klass)
+   baseparse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_flac_parse_parse_frame);
+   baseparse_class->pre_push_frame =
+       GST_DEBUG_FUNCPTR (gst_flac_parse_pre_push_frame);
++  baseparse_class->convert = GST_DEBUG_FUNCPTR (gst_flac_parse_convert);
+ }
+ 
+ static void
+@@ -1351,3 +1355,34 @@ gst_flac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
+ 
+   return GST_FLOW_OK;
+ }
++
++static gboolean
++gst_flac_parse_convert (GstBaseParse * parse,
++    GstFormat src_format, gint64 src_value, GstFormat dest_format,
++    gint64 * dest_value)
++{
++  GstFlacParse *flacparse = GST_FLAC_PARSE (parse);
++
++  if (flacparse->samplerate > 0) {
++    if (src_format == GST_FORMAT_DEFAULT && dest_format == GST_FORMAT_TIME) {
++      if (src_value != -1)
++        *dest_value =
++            gst_util_uint64_scale (src_value, GST_SECOND,
++            flacparse->samplerate);
++      else
++        *dest_value = -1;
++      return TRUE;
++    } else if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_TIME) {
++      if (src_value != -1)
++        *dest_value =
++            gst_util_uint64_scale (src_value, flacparse->samplerate,
++            GST_SECOND);
++      else
++        *dest_value = -1;
++      return TRUE;
++    }
++  }
++
++  return GST_BASE_PARSE_CLASS (parent_class)->convert (parse, src_format,
++      src_value, dest_format, dest_value);
++}
+--
+cgit v0.9.0.2-2-gbebe
+
diff --git a/gstreamer-plugins-good-0.10.30-flacparse_fix_conversions.patch b/gstreamer-plugins-good-0.10.30-flacparse_fix_conversions.patch
new file mode 100644
index 0000000..2676465
--- /dev/null
+++ b/gstreamer-plugins-good-0.10.30-flacparse_fix_conversions.patch
@@ -0,0 +1,26 @@
+From 1183d0c1ab9b567e085e30006b984a578f4a6a88 Mon Sep 17 00:00:00 2001
+From: Tim-Philipp Müller <tim.muller at collabora.co.uk>
+Date: Mon, 23 May 2011 12:23:21 +0000
+Subject: flacparse: make conversion from TIME to DEFAULT format (samples) work
+
+Fix copy'n'paste error in the previous commit.
+---
+(limited to 'gst/audioparsers/gstflacparse.c')
+
+diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c
+index 0c76655..0995d79 100644
+--- a/gst/audioparsers/gstflacparse.c
++++ b/gst/audioparsers/gstflacparse.c
+@@ -1372,7 +1372,8 @@ gst_flac_parse_convert (GstBaseParse * parse,
+       else
+         *dest_value = -1;
+       return TRUE;
+-    } else if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_TIME) {
++    } else if (src_format == GST_FORMAT_TIME &&
++        dest_format == GST_FORMAT_DEFAULT) {
+       if (src_value != -1)
+         *dest_value =
+             gst_util_uint64_scale (src_value, flacparse->samplerate,
+--
+cgit v0.9.0.2-2-gbebe
+
diff --git a/gstreamer-plugins-good-0.10.30-flacparse_tell_baseparse.patch b/gstreamer-plugins-good-0.10.30-flacparse_tell_baseparse.patch
new file mode 100644
index 0000000..7c11f77
--- /dev/null
+++ b/gstreamer-plugins-good-0.10.30-flacparse_tell_baseparse.patch
@@ -0,0 +1,34 @@
+From a53540346a18d27b94f5254ac2582cb844e9bde0 Mon Sep 17 00:00:00 2001
+From: Tim-Philipp Müller <tim.muller at collabora.co.uk>
+Date: Mon, 23 May 2011 12:50:46 +0000
+Subject: flacparse: tell baseparse the duration in samples for better accuracy
+
+Tell GstBaseParse the duration in samples instead of time, so that
+a duration query in DEFAULT format will return the correct number
+of samples without rounding errors. Baseparse will convert this
+into time itself when needed.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=650785
+---
+diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c
+index 0995d79..0c6c529 100644
+--- a/gst/audioparsers/gstflacparse.c
++++ b/gst/audioparsers/gstflacparse.c
+@@ -798,10 +798,10 @@ gst_flac_parse_handle_streaminfo (GstFlacParse * flacparse, GstBuffer * buffer)
+ 
+   if (!gst_bit_reader_get_bits_uint64 (&reader, &flacparse->total_samples, 36))
+     goto error;
+-  if (flacparse->total_samples)
+-    gst_base_parse_set_duration (GST_BASE_PARSE (flacparse), GST_FORMAT_TIME,
+-        GST_FRAMES_TO_CLOCK_TIME (flacparse->total_samples,
+-            flacparse->samplerate), 0);
++  if (flacparse->total_samples) {
++    gst_base_parse_set_duration (GST_BASE_PARSE (flacparse),
++        GST_FORMAT_DEFAULT, flacparse->total_samples, 0);
++  }
+ 
+   GST_DEBUG_OBJECT (flacparse, "STREAMINFO:\n"
+       "\tmin/max blocksize: %u/%u,\n"
+--
+cgit v0.9.0.2-2-gbebe
+
diff --git a/gstreamer-plugins-good-0.10.30-off_by_one.patch b/gstreamer-plugins-good-0.10.30-off_by_one.patch
new file mode 100644
index 0000000..4880df4
--- /dev/null
+++ b/gstreamer-plugins-good-0.10.30-off_by_one.patch
@@ -0,0 +1,29 @@
+From 6ac7ad8a2ce59bebcb5b5085fa48c354afff539f Mon Sep 17 00:00:00 2001
+From: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
+Date: Tue, 16 Aug 2011 12:16:22 +0000
+Subject: flacparse: fix off by one in frame size check
+
+Yes, I was tracking another bug and the small test file I generated
+to test with improbably just happened to trigger this, with a second
+and last frame of 1615 bytes.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=656649
+---
+(limited to 'gst/audioparsers/gstflacparse.c')
+
+diff --git a/gst/audioparsers/gstflacparse.c b/gst/audioparsers/gstflacparse.c
+index 0c6c529..3011bf0 100644
+--- a/gst/audioparsers/gstflacparse.c
++++ b/gst/audioparsers/gstflacparse.c
+@@ -581,7 +581,7 @@ gst_flac_parse_frame_is_valid (GstFlacParse * flacparse,
+   data = GST_BUFFER_DATA (buffer);
+   size = GST_BUFFER_SIZE (buffer);
+ 
+-  if (size <= flacparse->min_framesize)
++  if (size < flacparse->min_framesize)
+     goto need_more;
+ 
+   header_ret =
+--
+cgit v0.9.0.2-2-gbebe
+
diff --git a/gstreamer-plugins-good.spec b/gstreamer-plugins-good.spec
index 219c7d6..9a9595c 100644
--- a/gstreamer-plugins-good.spec
+++ b/gstreamer-plugins-good.spec
@@ -6,7 +6,7 @@
 
 Name:           %{gstreamer}-plugins-good
 Version:        0.10.30
-Release:        2%{?dist}
+Release:        4%{?dist}
 Summary:        GStreamer plug-ins with good code and licensing
 
 Group:          Applications/Multimedia
@@ -14,6 +14,12 @@ License:        LGPLv2+
 URL:            http://gstreamer.freedesktop.org/
 #Source:         http://gstreamer.freedesktop.org/src/gst-plugins-good/pre/gst-plugins-good-%{version}.tar.bz2
 Source:         http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-%{version}.tar.xz
+# Upstream patches to fix https://bugzilla.gnome.org/show_bug.cgi?id=650785
+Patch0:         gstreamer-plugins-good-0.10.30-flacparse_tell_baseparse.patch
+Patch1:         gstreamer-plugins-good-0.10.30-flacdec_also_try_upstream.patch
+Patch2:         gstreamer-plugins-good-0.10.30-flacparse_conversions.patch
+Patch3:         gstreamer-plugins-good-0.10.30-flacparse_fix_conversions.patch
+Patch4:         gstreamer-plugins-good-0.10.30-off_by_one.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires:       %{gstreamer} >= %{_gst}
@@ -103,6 +109,11 @@ This package contains documentation for the provided plugins.
 
 %prep
 %setup -q -n gst-plugins-good-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 %build
 
@@ -244,6 +255,12 @@ export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
 gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/gstreamer-%{majorminor}.schemas > /dev/null || :
 
 %changelog
+* Fri Nov  4 2011 Adam Williamson <awilliam at redhat.com> - 0.10.30-4
+- backport more upstream flacparse fixes to complete #650785 fix
+
+* Fri Oct 14 2011 Adam Williamson <awilliam at redhat.com> - 0.10.30-3
+- backport a couple of patches to fix GNOME #650785
+
 * Sun Jul  3 2011 Ville Skyttä <ville.skytta at iki.fi> - 0.10.30-2
 - Own the /usr/share/gstreamer-0.10 dir (#681625).
 


More information about the scm-commits mailing list