From 799c8e3d04456ce0b22c03de66d20d0a1a599643 Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Thu, 21 Jul 2011 17:23:28 -0400 Subject: [PATCH 1/3] 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 --- ext/flac/gstflacdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 061fa811f7..1e2ef5ee46 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: From bd604175c559fb524a54a55c85becdfa852673a8 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Tue, 23 Aug 2011 21:41:15 +0530 Subject: [PATCH 2/3] pulsesink: Trivial indentation fix --- ext/pulse/pulsesink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index b90ebe380d..51f60beb88 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -1490,7 +1490,7 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample, /* Recalculate what we can write in the next chunk */ towrite = out_samples * bps; if (pbuf->m_writable > towrite) - pbuf->m_writable = towrite; + pbuf->m_writable = towrite; GST_LOG_OBJECT (psink, "requesting %" G_GSIZE_FORMAT " bytes of " "shared memory", pbuf->m_writable); From f3fc3e1f69587e1bda5e628093918a2a3dd5f874 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Tue, 23 Aug 2011 12:12:15 +0100 Subject: [PATCH 3/3] aacparse: only require two frames in a row when we do not have sync This avoids a single bit error dropping two frames unnecessarily. The two consecutive frames check is still required when we don't have sync. https://bugzilla.gnome.org/show_bug.cgi?id=657080 --- gst/audioparsers/gstaacparse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gst/audioparsers/gstaacparse.c b/gst/audioparsers/gstaacparse.c index 5ee8466913..5c50da852c 100644 --- a/gst/audioparsers/gstaacparse.c +++ b/gst/audioparsers/gstaacparse.c @@ -340,8 +340,12 @@ gst_aac_parse_check_adts_frame (GstAacParse * aacparse, if ((data[0] == 0xff) && ((data[1] & 0xf6) == 0xf0)) { *framesize = gst_aac_parse_adts_get_frame_len (data); - /* In EOS mode this is enough. No need to examine the data further */ - if (drain) { + /* In EOS mode this is enough. No need to examine the data further. + We also relax the check when we have sync, on the assumption that + if we're not looking at random data, we have a much higher chance + to get the correct sync, and this avoids losing two frames when + a single bit corruption happens. */ + if (drain || !GST_BASE_PARSE_LOST_SYNC (aacparse)) { return TRUE; }