Commit 144e48a7 authored by Laurent Aimar's avatar Laurent Aimar Committed by Christophe Mutricy

Fixed timestamp in ffmpeg reget_buffer callback.

(cherry picked from commit 0ef30fab)
Signed-off-by: default avatarChristophe Mutricy <xtophe@videolan.org>
parent 40d7e36f
......@@ -871,12 +871,20 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
static int ffmpeg_ReGetFrameBuf( struct AVCodecContext *p_context, AVFrame *p_ff_pic )
{
decoder_t *p_dec = (decoder_t *)p_context->opaque;
int i_ret;
/* Set picture PTS */
ffmpeg_SetFrameBufferPts( p_dec, p_ff_pic );
/* */
p_ff_pic->pts = AV_NOPTS_VALUE;
/* We always use default reget function, it works perfectly fine */
return avcodec_default_reget_buffer( p_context, p_ff_pic );
i_ret = avcodec_default_reget_buffer( p_context, p_ff_pic );
/* Set picture PTS if avcodec_default_reget_buffer didn't set it (through a
* ffmpeg_GetFrameBuf call) */
if( !i_ret && p_ff_pic->pts == AV_NOPTS_VALUE )
ffmpeg_SetFrameBufferPts( p_dec, p_ff_pic );
return i_ret;
}
static void ffmpeg_SetFrameBufferPts( decoder_t *p_dec, AVFrame *p_ff_pic )
......@@ -897,9 +905,15 @@ static void ffmpeg_SetFrameBufferPts( decoder_t *p_dec, AVFrame *p_ff_pic )
{
p_ff_pic->pts = p_sys->input_dts;
}
else p_ff_pic->pts = 0;
else
{
p_ff_pic->pts = 0;
}
}
else
{
p_ff_pic->pts = 0;
}
else p_ff_pic->pts = 0;
if( p_sys->i_pts ) /* make sure 1st frame has a pts > 0 */
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment