flacparse: tell baseparse the duration in samples for better accuracy
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 23 May 2011 12:50:46 +0000 (13:50 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 23 May 2011 12:50:46 +0000 (13:50 +0100)
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

gst/audioparsers/gstflacparse.c

index 0995d79..0c6c529 100644 (file)
@@ -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"