From: Monty Montgomery Date: Thu, 21 Jul 2011 21:23:28 +0000 (-0400) Subject: flacdec: Correct sample number rounding resulting in timestamp jitter X-Git-Tag: RELEASE-0.11.1~7^2~338 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=799c8e3d04456ce0b22c03de66d20d0a1a599643;p=platform%2Fupstream%2Fgst-plugins-good.git flacdec: Correct sample number rounding resulting in timestamp jitter flacdec converts the src timestamp to a sample number, uses that internally, then reconverts the sample number to a timestamp for the output buffer. Unfortunately, sample numbers can't be represented in an integer number of nanoseconds, and the conversion process was truncating rather than rounding, resulting in sample numbers and output timestamps that were often off by a full sample. This corrects the time->sample convesion --- diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 061fa81..1e2ef5e 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -1668,7 +1668,7 @@ gst_flac_dec_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value, case GST_FORMAT_BYTES: scale = bytes_per_sample; case GST_FORMAT_DEFAULT: - *dest_value = gst_util_uint64_scale_int (src_value, + *dest_value = gst_util_uint64_scale_int_round (src_value, scale * flacdec->sample_rate, GST_SECOND); break; default: