From 4869163a532a1ba01ee321882c1ecad955e228b1 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 9 Jun 2005 09:53:04 +0000 Subject: [PATCH] ext/ffmpeg/gstffmpegdec.c: Only do timestamp interpolation for delayed streams (containing Original commit message from CVS: * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame): Only do timestamp interpolation for delayed streams (containing B-frames). Fixes stuttering playback of ASF files (#306770). --- ChangeLog | 6 ++++++ ext/ffmpeg/gstffmpegdec.c | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35772466c6..b55b51fb3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-09 Ronald S. Bultje + + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame): + Only do timestamp interpolation for delayed streams (containing + B-frames). Fixes stuttering playback of ASF files (#306770). + 2005-06-09 Ronald S. Bultje * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps), diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 3b9a13724f..5a4c32fb6b 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -685,7 +685,7 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, if (ffmpegdec->picture->opaque != NULL) { outbuf = (GstBuffer *) ffmpegdec->picture->opaque; - }else { + } else { AVPicture pic; gint fsize = gst_ffmpeg_avpicture_get_size (ffmpegdec->context->pix_fmt, ffmpegdec->context->width, ffmpegdec->context->height); @@ -717,10 +717,12 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, * For B-frame containing movies, we get all pictures delayed * except for the I frames, so we synchronize only on I frames * and keep an internal counter based on FPS for the others. */ - if ((ffmpegdec->picture->pict_type == FF_I_TYPE || - !GST_CLOCK_TIME_IS_VALID (ffmpegdec->next_ts)) && - GST_CLOCK_TIME_IS_VALID (*in_ts)) { + if (!(oclass->in_plugin->capabilities & CODEC_CAP_DELAY) || + ((ffmpegdec->picture->pict_type == FF_I_TYPE || + !GST_CLOCK_TIME_IS_VALID (ffmpegdec->next_ts)) && + GST_CLOCK_TIME_IS_VALID (*in_ts))) { ffmpegdec->next_ts = *in_ts; + *in_ts = GST_CLOCK_TIME_NONE; } GST_BUFFER_TIMESTAMP (outbuf) = ffmpegdec->next_ts; @@ -738,12 +740,14 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, } else { ffmpegdec->next_ts = GST_CLOCK_TIME_NONE; } - } else if (ffmpegdec->picture->pict_type != -1) { + } else if (ffmpegdec->picture->pict_type != -1 && + oclass->in_plugin->capabilities & CODEC_CAP_DELAY) { /* update time for skip-frame */ if ((ffmpegdec->picture->pict_type == FF_I_TYPE || !GST_CLOCK_TIME_IS_VALID (ffmpegdec->next_ts)) && GST_CLOCK_TIME_IS_VALID (*in_ts)) { ffmpegdec->next_ts = *in_ts; + *in_ts = GST_CLOCK_TIME_NONE; } if (ffmpegdec->context->frame_rate_base != 0 &&