rpms/gstreamer-plugins-good/F-11 0001-flacdec-fix-intermittent-FLAC__STREAM_DECODER_ABORTE.patch, NONE, 1.1 gstreamer-plugins-good.spec, 1.97, 1.98

Bastien Nocera hadess at fedoraproject.org
Tue Jul 21 20:59:49 UTC 2009


Author: hadess

Update of /cvs/pkgs/rpms/gstreamer-plugins-good/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26058

Modified Files:
	gstreamer-plugins-good.spec 
Added Files:
	0001-flacdec-fix-intermittent-FLAC__STREAM_DECODER_ABORTE.patch 
Log Message:
* Tue Jul 21 2009 Bastien Nocera <bnocera at redhat.com> 0.10.15-4
- Fix FLAC seeking

0001-flacdec-fix-intermittent-FLAC__STREAM_DECODER_ABORTE.patch:
 gstflacdec.c |   36 +++++++++++++++++++++++++++++++-----
 gstflacdec.h |    3 ++-
 2 files changed, 33 insertions(+), 6 deletions(-)

--- NEW FILE 0001-flacdec-fix-intermittent-FLAC__STREAM_DECODER_ABORTE.patch ---
>From ee98c0f1d06e5f401218f88b96e39e33f0d2c7aa Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Tim-Philipp=20M=C3=BCller?= <tim.muller at collabora.co.uk>
Date: Tue, 21 Jul 2009 19:46:55 +0100
Subject: [PATCH] flacdec: fix intermittent FLAC__STREAM_DECODER_ABORTED errors when seeking

When seeking in a local flac file (ie. operating pull-based), the decoder
would often just error out after the loop function sees a DECODER_ABORTED
status. This, however, is the read callback's way of telling our loop
function that pull_range failed and streaming should stop, in this case
because of the flush-start event that the seek handler pushed upstream
from the seeking thread. Handle this slightly better by storing the last
flow return from pull_range, so the loop function can evaluate it properly
when it encounters a DECODER_ABORTED and take the right action.

Fixes #578612.
---
 ext/flac/gstflacdec.c |   36 +++++++++++++++++++++++++++++++-----
 ext/flac/gstflacdec.h |    2 ++
 2 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index 3f9c75f..4d04702 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -773,15 +773,25 @@ static FLAC__StreamDecoderReadStatus
 gst_flac_dec_read_seekable (const FLAC__StreamDecoder * decoder,
     FLAC__byte buffer[], size_t * bytes, void *client_data)
 {
+  GstFlowReturn flow;
   GstFlacDec *flacdec;
-
   GstBuffer *buf;
 
   flacdec = GST_FLAC_DEC (client_data);
 
-  if (gst_pad_pull_range (flacdec->sinkpad, flacdec->offset, *bytes,
-          &buf) != GST_FLOW_OK)
-    return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+  flow = gst_pad_pull_range (flacdec->sinkpad, flacdec->offset, *bytes, &buf);
+
+  GST_PAD_STREAM_LOCK (flacdec->sinkpad);
+  flacdec->pull_flow = flow;
+  GST_PAD_STREAM_UNLOCK (flacdec->sinkpad);
+
+  if (G_UNLIKELY (flow != GST_FLOW_OK)) {
+    GST_INFO_OBJECT (flacdec, "pull_range flow: %s", gst_flow_get_name (flow));
+    if (flow == GST_FLOW_UNEXPECTED)
+      return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+    else
+      return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
+  }
 
   GST_DEBUG_OBJECT (flacdec, "Read %d bytes at %" G_GUINT64_FORMAT,
       GST_BUFFER_SIZE (buf), flacdec->offset);
@@ -1152,9 +1162,23 @@ analyze_state:
       goto eos_and_pause;
     }
 
+      /* gst_flac_dec_read_seekable() returned ABORTED */
+    case FLAC__STREAM_DECODER_ABORTED:
+    {
+      GST_INFO_OBJECT (flacdec, "read aborted: last pull_range flow = %s",
+          gst_flow_get_name (flacdec->pull_flow));
+      if (!GST_FLOW_IS_FATAL (flacdec->pull_flow)) {
+        /* it seems we need to flush the decoder here to reset the decoder
+         * state after the abort for FLAC__stream_decoder_seek_absolute()
+         * to work properly */
+        GST_DEBUG_OBJECT (flacdec, "flushing decoder to reset decoder state");
+        FLAC__stream_decoder_flush (flacdec->seekable_decoder);
+        goto pause;
+      }
+      /* fall through */
+    }
     case FLAC__STREAM_DECODER_OGG_ERROR:
     case FLAC__STREAM_DECODER_SEEK_ERROR:
-    case FLAC__STREAM_DECODER_ABORTED:
     case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
     case FLAC__STREAM_DECODER_UNINITIALIZED:
     default:{
@@ -1782,8 +1806,10 @@ gst_flac_dec_handle_seek_event (GstFlacDec * flacdec, GstEvent * event)
    * callbacks that need to behave differently when seeking */
   flacdec->seeking = TRUE;
 
+  GST_LOG_OBJECT (flacdec, "calling seek_absolute");
   seek_ok = FLAC__stream_decoder_seek_absolute (flacdec->seekable_decoder,
       flacdec->segment.last_stop);
+  GST_LOG_OBJECT (flacdec, "done with seek_absolute, seek_ok=%d", seek_ok);
 
   flacdec->seeking = FALSE;
 
diff --git a/ext/flac/gstflacdec.h b/ext/flac/gstflacdec.h
index a9daf3e..e6a76bb 100644
--- a/ext/flac/gstflacdec.h
+++ b/ext/flac/gstflacdec.h
@@ -74,6 +74,8 @@ struct _GstFlacDec {
   GstEvent      *start_segment;
   GstTagList    *tags;
 
+  GstFlowReturn  pull_flow;   /* last flow from pull_range */ /* STREAM_LOCK */
+
   GstFlowReturn  last_flow;   /* the last flow return received from either
                                * gst_pad_push or gst_pad_buffer_alloc */
 
-- 
1.6.3.3



Index: gstreamer-plugins-good.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gstreamer-plugins-good/F-11/gstreamer-plugins-good.spec,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -p -r1.97 -r1.98
--- gstreamer-plugins-good.spec	22 Jun 2009 17:12:06 -0000	1.97
+++ gstreamer-plugins-good.spec	21 Jul 2009 20:59:49 -0000	1.98
@@ -6,7 +6,7 @@
 
 Name: 		%{gstreamer}-plugins-good
 Version: 	0.10.15
-Release:  	3%{?dist}
+Release:  	4%{?dist}
 Summary: 	GStreamer plug-ins with good code and licensing
 
 Group: 		Applications/Multimedia
@@ -71,6 +71,8 @@ BuildRequires: automake autoconf libtool
 Provides: gstreamer-plugins-farsight = 0.12.12-1
 Obsoletes: gstreamer-plugins-farsight < 0.12.12
 
+Patch1: 0001-flacdec-fix-intermittent-FLAC__STREAM_DECODER_ABORTE.patch
+
 %description
 GStreamer is a streaming media framework, based on graphs of filters which
 operate on media data. Applications using this library can do anything
@@ -108,6 +110,7 @@ This is a dummy package to make gstreame
 %patch0 -p1 -b .farsight
 libtoolize -f
 autoreconf
+%patch1 -p1 -b .flac
 
 %build
 
@@ -271,6 +274,9 @@ export GCONF_CONFIG_SOURCE=`gconftool-2 
 gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/gstreamer-%{majorminor}.schemas > /dev/null || :
 
 %changelog
+* Tue Jul 21 2009 Bastien Nocera <bnocera at redhat.com> 0.10.15-4
+- Fix FLAC seeking
+
 * Mon Jun 22 2009 Brian Pepple <bpepple at fedoraproject.org> - 0.10.15-3
 - Add obsolete for gst-plugins-farsight.
 




More information about the fedora-extras-commits mailing list