Message ID | 20190212222835.27755-1-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
On 12/02/2019 22:28, Michael Niedermayer wrote: > @@ -5048,7 +5048,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) > for (i = 0; i < c->fc->nb_streams; i++) { > st = c->fc->streams[i]; > sc = st->priv_data; > - if (!sc->has_sidx) { > + if (ref_st && !sc->has_sidx) { > st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale); > } > } Is it perhaps better to not run this loop at all if ref_sc or ref_st do not exist? - Derek
On Wed, Feb 13, 2019 at 12:16:36PM +0000, Derek Buitenhuis wrote: > On 12/02/2019 22:28, Michael Niedermayer wrote: > > @@ -5048,7 +5048,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) > > for (i = 0; i < c->fc->nb_streams; i++) { > > st = c->fc->streams[i]; > > sc = st->priv_data; > > - if (!sc->has_sidx) { > > + if (ref_st && !sc->has_sidx) { > > st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale); > > } > > } > > Is it perhaps better to not run this loop at all if ref_sc or ref_st do not exist? will commit with the check moved to the loop thanks [...]
diff --git a/libavformat/mov.c b/libavformat/mov.c index 73a5ec240e..6aaba1e290 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5048,7 +5048,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < c->fc->nb_streams; i++) { st = c->fc->streams[i]; sc = st->priv_data; - if (!sc->has_sidx) { + if (ref_st && !sc->has_sidx) { st->duration = sc->track_end = av_rescale(ref_st->duration, sc->time_scale, ref_sc->time_scale); } }