Commit b9883cb9 authored by Alex Woods's avatar Alex Woods Committed by Ilkka Ollakka
Browse files

Fix glitching at start of stream playback

This patch fixes a problem that occurs at the start of playback of MPEG2
streams.  The symptom is that an initial good frame will display and
then the video appears to skip back a frame or two and some
macroblocking is observed. The stream then plays correctly. This is
really obvious when switching between SAPed multicast streams, where
you're jumping right in to a lot of movement and probably not starting
with an I frame.

The issue appears to be some code introduced way back in 2004 (commit

) which resubmits data to the
video codec. The commit notes suggest it was to avoid dropping the first
I frame, but I see no obviously lost I frames after removing the code
with my test samples. Presumably this was a work-around for a libavcodec
issue that is no longer required.

Therefore, this patch basically just reverts the 2004 commit in its
current form.
Signed-off-by: Ilkka Ollakka's avatarIlkka Ollakka <>
parent 7ebdca36
......@@ -434,7 +434,6 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
decoder_sys_t *p_sys = p_dec->p_sys;
AVCodecContext *p_context = p_sys->p_context;
int b_drawpicture;
int b_null_size = false;
block_t *p_block;
if( !pp_block )
......@@ -539,7 +538,6 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
if( p_sys->b_hurry_up )
p_context->skip_frame = p_sys->i_skip_frame;
b_null_size = true;
else if( !b_drawpicture )
......@@ -615,16 +613,6 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
i_used = avcodec_decode_video2( p_context, p_sys->p_ff_pic,
&b_gotpicture, &pkt );
if( b_null_size && !p_sys->b_flush &&
p_context->width > 0 && p_context->height > 0 )
/* Reparse it to not drop the I frame */
b_null_size = false;
if( p_sys->b_hurry_up )
p_context->skip_frame = p_sys->i_skip_frame;
i_used = avcodec_decode_video2( p_context, p_sys->p_ff_pic,
&b_gotpicture, &pkt );
wait_mt( p_sys );
if( p_sys->b_flush )
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