On Fri, Jun 17, 2016 at 01:26:10AM +0200, Michael Niedermayer wrote: > On Thu, Jun 16, 2016 at 05:26:14PM +0200, Matthieu Bouron wrote: > > From: Matthieu Bouron <matthieu.bou...@stupeflix.com> > > > > Fixes packet pts of samples which contain ctts entries with count=0. > > --- > > > > Hello, > > > > The following patch fixes packet pts of samples which contain ctts values > > with > > count=0 (so the ctts entry does not apply to any sample if I understand > > correctly). Such samples are produced by a LG G4 phone. I don't have any > > sample I can share at the moment (and thus no fate test following this patch > > yet). > > > > An alternative to this patch is to remove directly the entry when the ctts > > atom > > is parsed. Would you prefer this alternative ? > > i dont know what is preferred but i agree about either solution > > removing them on load would avoid any issues with ctts_count > 0 > and no real entries, i dont know though if that ever matters
I've attached the alternative patch that removes the CTTS entries with count <= 0 at parsing time. I think it's better in the end (I first liked the idea to keep the ctts table as is in memory but after some thoughts I think it's really useful). Anyway I'll go with whatever patch you prefer. Matthieu [...]
>From 3bf2a6a81b8cca09bee4c0b6ef6f6ce78e276f0d Mon Sep 17 00:00:00 2001 From: Matthieu Bouron <matthieu.bou...@stupeflix.com> Date: Thu, 16 Jun 2016 13:16:52 +0200 Subject: [PATCH] lavf/mov: ignore ctts that do not apply to a least one sample Fixes packet pts of samples which contain ctts values with count <= 0. --- libavformat/mov.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 57a0354..8eab34c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2574,7 +2574,7 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; - unsigned int i, entries; + unsigned int i, entries, ctts_count = 0; if (c->fc->nb_streams < 1) return 0; @@ -2600,8 +2600,16 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) int count =avio_rb32(pb); int duration =avio_rb32(pb); - sc->ctts_data[i].count = count; - sc->ctts_data[i].duration= duration; + if (count <= 0) { + av_log(c->fc, AV_LOG_TRACE, + "ignoring CTTS entry with count=%d duration=%d\n", + count, duration); + continue; + } + + sc->ctts_data[ctts_count].count = count; + sc->ctts_data[ctts_count].duration = duration; + ctts_count++; av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); @@ -2617,7 +2625,7 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) mov_update_dts_shift(sc, duration); } - sc->ctts_count = i; + sc->ctts_count = ctts_count; if (pb->eof_reached) return AVERROR_EOF; -- 2.8.3
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel