Index: ext/ffmpeg/gstffmpegdec.c
===================================================================
RCS file: /cvs/gstreamer/gst-ffmpeg/ext/ffmpeg/gstffmpegdec.c,v
retrieving revision 1.208
diff -u -p -r1.208 gstffmpegdec.c
--- ext/ffmpeg/gstffmpegdec.c	29 Aug 2008 09:59:29 -0000	1.208
+++ ext/ffmpeg/gstffmpegdec.c	30 Aug 2008 14:11:59 -0000
@@ -1742,6 +1742,7 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec 
       "Decode audio: len=%d, have_data=%d", len, have_data);
 
   if (len >= 0 && have_data > 0) {
+    gint64 jitter = 0;
     GST_DEBUG_OBJECT (ffmpegdec, "Creating output buffer");
     if (!gst_ffmpegdec_negotiate (ffmpegdec)) {
       gst_buffer_unref (*outbuf);
@@ -1772,10 +1773,20 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec 
     in_duration = gst_util_uint64_scale_int (have_data, GST_SECOND,
         2 * ffmpegdec->context->channels * ffmpegdec->context->sample_rate);
 
+    if (GST_CLOCK_TIME_IS_VALID (ffmpegdec->next_ts)) {
+      jitter = ffmpegdec->next_ts - in_timestamp;
+      if (jitter < (20 * GST_MSECOND)) {
+	GST_DEBUG ("Correcting jitter < 20ms.  %"GST_TIME_FORMAT" => %"GST_TIME_FORMAT,
+		   GST_TIME_ARGS (in_timestamp), GST_TIME_ARGS (ffmpegdec->next_ts));
+	in_timestamp = ffmpegdec->next_ts;
+      }
+    }
+    
     GST_DEBUG_OBJECT (ffmpegdec,
         "Buffer created. Size:%d , timestamp:%" GST_TIME_FORMAT " , duration:%"
-        GST_TIME_FORMAT, have_data,
-        GST_TIME_ARGS (in_timestamp), GST_TIME_ARGS (in_duration));
+		      GST_TIME_FORMAT" jitter:%ldms", have_data,
+		      GST_TIME_ARGS (in_timestamp), GST_TIME_ARGS (in_duration),
+		      jitter / GST_MSECOND);
 
     GST_BUFFER_TIMESTAMP (*outbuf) = in_timestamp;
     GST_BUFFER_DURATION (*outbuf) = in_duration;
