[vlc-devel] [PATCH] Fix glitching at start of stream playback

Alex Woods alex at packetship.com
Tue Mar 18 14:28:37 CET 2014


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
eaefb8508dba22fb04193241347a072caac34cf1) 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.

---
 modules/codec/avcodec/video.c |   12 ------------
 1 file changed, 12 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 6b32a7d..022dee1 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -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 )
-- 
1.7.10.4




More information about the vlc-devel mailing list