[0.10] gst-plugins-good: flacdec: improve upstream peer duration querying

Tim Müller tpm at kemper.freedesktop.org
Mon Jan 23 15:40:59 PST 2012


Module: gst-plugins-good
Branch: 0.10
Commit: 1572c1fb432de86f01608225e29f73c070249f87
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=1572c1fb432de86f01608225e29f73c070249f87

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Fri Jan 20 16:48:49 2012 +0100

flacdec: improve upstream peer duration querying

... to avoid accepting unhandled duration query result.

---

 ext/flac/gstflacdec.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index 65aa927..10f8916 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -711,17 +711,12 @@ gst_flac_dec_length (const FLAC__StreamDecoder * decoder,
 {
   GstFlacDec *flacdec;
   GstFormat fmt = GST_FORMAT_BYTES;
-  gint64 len;
-  GstPad *peer;
+  gint64 len = -1;
 
   flacdec = GST_FLAC_DEC (client_data);
 
-  if (!(peer = gst_pad_get_peer (flacdec->sinkpad)))
-    return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
-
-  gst_pad_query_duration (peer, &fmt, &len);
-  gst_object_unref (peer);
-  if (fmt != GST_FORMAT_BYTES || len == -1)
+  if (!gst_pad_query_peer_duration (flacdec->sinkpad, &fmt, &len) ||
+      (fmt != GST_FORMAT_BYTES || len == -1))
     return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
 
   *length = len;



More information about the gstreamer-commits mailing list