From 5627c7d3e7b5a855401803fe1a82fd0298d14d21 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 21 Jan 2008 11:19:03 +0000 Subject: [PATCH] ext/ffmpeg/gstffmpegdec.c: Remove some more overly clever code that does nothing but mess up timestamps. Original commit message from CVS: * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_video_frame), (gst_ffmpegdec_chain): Remove some more overly clever code that does nothing but mess up timestamps. --- ChangeLog | 7 +++++++ common | 2 +- ext/ffmpeg/gstffmpegdec.c | 26 ++++++++++---------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index d38e840d79..f003d8e21d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-01-21 Wim Taymans + + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_video_frame), + (gst_ffmpegdec_chain): + Remove some more overly clever code that does nothing but mess up + timestamps. + 2008-01-18 Wim Taymans * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_drain), diff --git a/common b/common index b6bd1a35b6..662f544d56 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit b6bd1a35b641237d016496039e474dee4230de76 +Subproject commit 662f544d56a6d6ef20b8ea5f56e975f9e139bc78 diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index ee9627b557..fbaf889a20 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -1367,8 +1367,7 @@ gst_ffmpegdec_video_frame (GstFFMpegDec * ffmpegdec, if (ffmpegdec->picture->pts != -1) { GST_LOG_OBJECT (ffmpegdec, "using timestamp returned by ffmpeg"); /* Get (interpolated) timestamp from FFMPEG */ - in_timestamp = gst_ffmpeg_time_ff_to_gst ((guint64) ffmpegdec->picture->pts, - ffmpegdec->context->time_base); + in_timestamp = (GstClockTime)ffmpegdec->picture->pts; } if (!GST_CLOCK_TIME_IS_VALID (in_timestamp)) { in_timestamp = ffmpegdec->next_ts; @@ -1995,20 +1994,16 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) /* parse, if at all possible */ if (ffmpegdec->pctx) { gint res; - gint64 ffpts; - - /* convert timestamp to ffmpeg timestamp */ - ffpts = - gst_ffmpeg_time_gst_to_ff (in_timestamp, - ffmpegdec->context->time_base); GST_LOG_OBJECT (ffmpegdec, - "Calling av_parser_parse with ts:%" GST_TIME_FORMAT ", ffpts:%" - G_GINT64_FORMAT, GST_TIME_ARGS (in_timestamp), ffpts); + "Calling av_parser_parse with ts:%" GST_TIME_FORMAT, + GST_TIME_ARGS (in_timestamp)); - /* feed the parser */ + /* feed the parser. We store the raw gstreamer timestamp because + * converting it to ffmpeg timestamps can corrupt it if the framerate is + * wrong. */ res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context, - &data, &size, bdata, bsize, ffpts, ffpts); + &data, &size, bdata, bsize, in_timestamp, in_timestamp); GST_LOG_OBJECT (ffmpegdec, "parser returned res %d and size %d", res, size); @@ -2016,8 +2011,8 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) /* store pts for get_buffer */ ffmpegdec->in_ts = ffmpegdec->pctx->pts; - GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. ffpts:%" - G_GINT64_FORMAT, size, ffmpegdec->pctx->pts); + GST_LOG_OBJECT (ffmpegdec, "consuming %d bytes. ts:%" + GST_TIME_FORMAT, size, GST_TIME_ARGS (ffmpegdec->pctx->pts)); /* there is output, set pointers for next round. */ bsize -= res; @@ -2035,8 +2030,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) data = bdata; size = bsize; - ffmpegdec->in_ts = gst_ffmpeg_time_gst_to_ff (in_timestamp, - ffmpegdec->context->time_base); + ffmpegdec->in_ts = in_timestamp; } /* decode a frame of audio/video now */