[vlc-devel] [PATCH 1/3] codec: avcodec: simplify hurry-up cases
Jean-Baptiste Kempf
jb at videolan.org
Sat Jan 16 18:58:07 CET 2016
On 15 Jan, Francois Cartegnie wrote :
> - if( p_sys->i_pts > VLC_TS_INVALID )
> - {
> - p_sys->i_pts = VLC_TS_INVALID; /* To make sure we recover properly */
> - }
> + p_sys->i_pts = VLC_TS_INVALID; /* To make sure we recover properly */
Why can you do that?
The rest feels like a good idea.
> - /* A good idea could be to decode all I pictures and see for the other */
> - if( p_dec->b_frame_drop_allowed &&
> - p_sys->b_hurry_up &&
> - (p_sys->i_late_frames > 4) )
> + b_drawpicture = ( !p_block || !(p_block->i_flags & BLOCK_FLAG_PREROLL) );
> +
> + if( p_sys->b_hurry_up )
> {
> - b_drawpicture = 0;
> - if( p_sys->i_late_frames < 12 )
> + /* reset any changes from previous frame, if we stopped dropping */
> + p_context->skip_frame = p_sys->i_skip_frame;
> +
> + /* A good idea could be to decode all I pictures and see for the other */
> + if( p_dec->b_frame_drop_allowed && p_sys->i_late_frames > 4 )
> {
> - p_context->skip_frame =
> - (p_sys->i_skip_frame <= AVDISCARD_NONREF) ?
> - AVDISCARD_NONREF : p_sys->i_skip_frame;
> + if( p_sys->i_late_frames < 12 )
> + {
> + b_drawpicture = 0;
> + if( p_context->width > 0 && p_context->height > 0 )
> + p_context->skip_frame = __MAX( p_sys->i_skip_frame, AVDISCARD_NONREF );
> + }
> + else
> + {
> + /* picture too late, won't decode
> + * but break picture until a new I, and for mpeg4 ...*/
> + p_sys->i_late_frames--; /* needed else it will never be decrease */
> + if( p_block )
> + block_Release( p_block );
> + msg_Warn( p_dec, "More than 4 late frames, dropping frame" );
> + return NULL;
> + }
> }
> - else
> +#if 0
> + if( !b_drawpicture )
> {
> - /* picture too late, won't decode
> - * but break picture until a new I, and for mpeg4 ...*/
> - p_sys->i_late_frames--; /* needed else it will never be decrease */
> - if( p_block )
> - block_Release( p_block );
> - msg_Warn( p_dec, "More than 4 late frames, dropping frame" );
> - return NULL;
> - }
> - }
> - else
> - {
> - if( p_sys->b_hurry_up )
> - p_context->skip_frame = p_sys->i_skip_frame;
> - if( !p_block || !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
> - b_drawpicture = 1;
> - else
> - b_drawpicture = 0;
> - }
> + /* It creates broken picture
> + * FIXME either our parser or ffmpeg is broken */
>
> - if( p_context->width <= 0 || p_context->height <= 0 )
> - {
> - if( p_sys->b_hurry_up )
> - p_context->skip_frame = p_sys->i_skip_frame;
> - }
> - else if( !b_drawpicture )
> - {
> - /* It creates broken picture
> - * FIXME either our parser or ffmpeg is broken */
> -#if 0
> - if( p_sys->b_hurry_up )
> - p_context->skip_frame = __MAX( p_context->skip_frame,
> - AVDISCARD_NONREF );
> + p_context->skip_frame = __MAX( p_context->skip_frame,
> + AVDISCARD_NONREF );
> + }
> #endif
> }
>
> --
> 2.5.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the vlc-devel
mailing list