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

Rémi Denis-Courmont remi at remlab.net
Mon Jun 13 10:29:10 CEST 2016


Le 2016-06-12 11:11, Sebastian Ramacher a écrit :
> On 2015-10-07 11:18:22, Emeric Grange wrote:
>> 2015-10-06 19:10 GMT+02:00 Ilkka Ollakka <ileoo at videolan.org>:
>> >
>> > 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.
>> >
>> > _______________________________________________
>> > vlc-devel mailing list
>> > To unsubscribe or modify your subscription options:
>> > https://mailman.videolan.org/listinfo/vlc-devel
>> >
>>
>> Hi,
>> Yes you are right the default will probably be wrong, the goal was
>> only to avoid VLC segfaulting. My use case was trancoding mp4 file
>> with "DASH style" tracks from youtube, and the problem was not an
>> exotic framerate but just the mp4 parser unable to get framerate. 
>> Most
>> files are 24fps so 25 is not that far of.
>> Maybe the proper way to handle that situation is just to fail with 
>> an
>> error trace then.
>
> Hi,
>
> any news on this patch? We got a bug report [1] for a SIGFPE while
> transcoding which is supposedly fixed by this patch.

It looks wrong. If the frame rate is unknown (or variable), it should 
be coded as 0:0, not some standard value.

The bug is probably where the division happens.

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list