[vlc-devel] [PATCH] transcoding: avoid a divide by 0 when source video framerate is mistakenly set to 0 by a demuxer

Ilkka Ollakka ileoo at videolan.org
Tue Oct 6 19:10:29 CEST 2015


On Tue, Oct 06, 2015 at 02:57:03PM +0200, Emeric Grange wrote:

Hi,

Patch looks ok, but I have feeling that most cases default framerate is wrong on cases where
demuxer isn't able to give. Do you have some cases currently that
demuxer fails to get framerate but that default is actually reasonable
guess?

> ---
>  modules/stream_out/transcode/video.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

> diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
> index 2c2d4f3..8f85036 100644
> --- a/modules/stream_out/transcode/video.c
> +++ b/modules/stream_out/transcode/video.c
> @@ -465,7 +465,7 @@ static void transcode_video_encoder_init( sout_stream_t *p_stream,
>           i_dst_visible_width, i_dst_visible_height
>       );

> -    /* Handle frame rate conversion */
> +    /* Handle frame rate conversion (encoder) */
>      if( !id->p_encoder->fmt_out.video.i_frame_rate ||
>          !id->p_encoder->fmt_out.video.i_frame_rate_base )
>      {
> @@ -485,6 +485,14 @@ static void transcode_video_encoder_init( sout_stream_t *p_stream,
>          }
>      }

> +    /* Handle frame rate (decoder) */
> +    if (!id->p_decoder->fmt_out.video.i_frame_rate ||
> +        !id->p_decoder->fmt_out.video.i_frame_rate_base)
> +    {
> +        id->p_decoder->fmt_out.video.i_frame_rate = ENC_FRAMERATE;
> +        id->p_decoder->fmt_out.video.i_frame_rate_base = ENC_FRAMERATE_BASE;
> +    }
> +
>      id->p_encoder->fmt_in.video.orientation =
>          id->p_encoder->fmt_out.video.orientation =
>          id->p_decoder->fmt_in.video.orientation;
-- 
Ilkka Ollakka
Each person has the right to take the subway.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20151006/d55e3e20/attachment.sig>


More information about the vlc-devel mailing list