Alex Converse <alex.conve...@gmail.com> writes:

> On Fri, Nov 23, 2012 at 6:30 AM, Hendrik Leppkes <h.lepp...@gmail.com>wrote:
>
>> On Fri, Nov 23, 2012 at 1:43 PM, Janne Grunau <janne-li...@jannau.net>
>> wrote:
>> > Sample count and delta are in ISO 14496-12 clearly specified as
>> > unsigned int.
>> > Fixes an assert caused by negative avg_frame_rate deduced from a
>> > negative duraton computed in mov_read_stts().
>> > ---
>> >  libavformat/isom.h | 4 ++--
>> >  libavformat/mov.c  | 4 ++--
>> >  2 files changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/libavformat/isom.h b/libavformat/isom.h
>> > index 932b1d0..f4a178b 100644
>> > --- a/libavformat/isom.h
>> > +++ b/libavformat/isom.h
>> > @@ -43,8 +43,8 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4]);
>> >   */
>> >
>> >  typedef struct MOVStts {
>> > -    int count;
>> > -    int duration;
>> > +    unsigned count;
>> > +    unsigned duration;
>> >  } MOVStts;
>> >
>> >  typedef struct MOVStsc {
>> > diff --git a/libavformat/mov.c b/libavformat/mov.c
>> > index 35c07bd..a121aa5 100644
>> > --- a/libavformat/mov.c
>> > +++ b/libavformat/mov.c
>> > @@ -1664,8 +1664,8 @@ static int mov_read_stts(MOVContext *c,
>> AVIOContext *pb, MOVAtom atom)
>> >          return AVERROR(ENOMEM);
>> >
>> >      for (i = 0; i < entries && !pb->eof_reached; i++) {
>> > -        int sample_duration;
>> > -        int sample_count;
>> > +        unsigned sample_duration;
>> > +        unsigned sample_count;
>> >
>> >          sample_count=avio_rb32(pb);
>> >          sample_duration = avio_rb32(pb);
>>
>> I have a sample which only has a proper timeline when sample_duration
>> is negative, and thus is required to be signed.
>> I vote for fixing the logic that trips your assert, and not break this
>> file.
>>
>> In case you are interested:
>> http://files.1f0.de/samples/mp4-negative-stts-problem.mp4
>>
>> Admitedly, this file is not spec compliant, but breaking it seems like
>> something that can be avoided.
>>
> I've run into files like this as well.

How do you sanely interpret a negative count or duration?

-- 
Måns Rullgård
m...@mansr.com
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to