[vlc-devel] Glitching at start of MPEG2 streams

Alex Woods alex at packetship.com
Mon Mar 17 14:23:23 CET 2014


On Thu, Mar 13, 2014 at 05:53:55PM +0000, Alex Woods wrote:
> I'm looking into an issue that can be seen at the start of MPEG2
> streams. The particular scenario that we are really noticing it is when
> switching between SAP notified streams. VLC will show a nice clean frame
> very soon after starting the stream then there is a little glitching
> that looks like a tiny jump backwards in the stream and then the stream
> will play cleanly.

I've now isolated the cause of this issue to a few lines of code within
VLC's modules/codec/avcodec/video.c:618-627

        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 );

Simply removing this re-calling of avcodec_decode_video2 fixes the
issue. I would like to provide a proper fix for this issue, but I have
to admit that I can't imagine why avcodec_decode_video2 would need to be
called again with the same data. Can anyone shed any light on this?
Could this section of code be a work-around for an issue in libav that
no longer exists?



More information about the vlc-devel mailing list