Re: [FFmpeg-devel] [PATCH] libavformat/mov: Fix inserting frames before current_frame.
On Thu, Jul 27, 2017 at 10:34:32AM -0700, Jacob Trimble wrote: > When using streaming input, it may be possible to see frames that appear > before the current_frame. When these frames are inserted into the > index, the current_frame needs to be updated so it is still pointing > at the same frame. > > Signed-off-by: Jacob Trimble> --- > libavformat/mov.c | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/mov: Fix inserting frames before current_frame.
On Mon, Aug 7, 2017 at 9:24 AM, Jacob Trimblewrote: > Ping > > On Thu, Jul 27, 2017 at 10:34 AM, Jacob Trimble wrote: >> When using streaming input, it may be possible to see frames that appear >> before the current_frame. When these frames are inserted into the >> index, the current_frame needs to be updated so it is still pointing >> at the same frame. >> >> Signed-off-by: Jacob Trimble >> --- >> libavformat/mov.c | 12 +--- >> 1 file changed, 9 insertions(+), 3 deletions(-) >> >> diff --git a/libavformat/mov.c b/libavformat/mov.c >> index 63f84be782..d039f27063 100644 >> --- a/libavformat/mov.c >> +++ b/libavformat/mov.c >> @@ -4259,7 +4259,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext >> *pb, MOVAtom atom) >> int64_t dts; >> int data_offset = 0; >> unsigned entries, first_sample_flags = frag->flags; >> -int flags, distance, i, err; >> +int flags, distance, i, err, old_nb_index_entries; >> >> for (i = 0; i < c->fc->nb_streams; i++) { >> if (c->fc->streams[i]->id == frag->track_id) { >> @@ -4352,13 +4352,19 @@ static int mov_read_trun(MOVContext *c, AVIOContext >> *pb, MOVAtom atom) >>MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES)); >> if (keyframe) >> distance = 0; >> +old_nb_index_entries = st->nb_index_entries; >> err = av_add_index_entry(st, offset, dts, sample_size, distance, >> keyframe ? AVINDEX_KEYFRAME : 0); >> if (err < 0) { >> av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n"); >> +} else if (err <= sc->current_sample && err + 1 != >> st->nb_index_entries && >> +st->nb_index_entries != old_nb_index_entries) { >> +// if we inserted a new item before the current sample, move the >> +// counter ahead so it is still pointing to the same sample. >> +sc->current_sample++; >> } >> -av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %u, offset >> %"PRIx64", dts %"PRId64", " >> -"size %u, distance %d, keyframe %d\n", st->index, >> sc->sample_count+i, >> +av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %d, offset >> %"PRIx64", dts %"PRId64", " >> +"size %u, distance %d, keyframe %d\n", st->index, err, >> offset, dts, sample_size, distance, keyframe); >> distance++; >> dts += sample_duration; Ping again. I have been waiting 20 days. Someone please take a look!! ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/mov: Fix inserting frames before current_frame.
Ping On Thu, Jul 27, 2017 at 10:34 AM, Jacob Trimblewrote: > When using streaming input, it may be possible to see frames that appear > before the current_frame. When these frames are inserted into the > index, the current_frame needs to be updated so it is still pointing > at the same frame. > > Signed-off-by: Jacob Trimble > --- > libavformat/mov.c | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 63f84be782..d039f27063 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -4259,7 +4259,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > int64_t dts; > int data_offset = 0; > unsigned entries, first_sample_flags = frag->flags; > -int flags, distance, i, err; > +int flags, distance, i, err, old_nb_index_entries; > > for (i = 0; i < c->fc->nb_streams; i++) { > if (c->fc->streams[i]->id == frag->track_id) { > @@ -4352,13 +4352,19 @@ static int mov_read_trun(MOVContext *c, AVIOContext > *pb, MOVAtom atom) >MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES)); > if (keyframe) > distance = 0; > +old_nb_index_entries = st->nb_index_entries; > err = av_add_index_entry(st, offset, dts, sample_size, distance, > keyframe ? AVINDEX_KEYFRAME : 0); > if (err < 0) { > av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n"); > +} else if (err <= sc->current_sample && err + 1 != > st->nb_index_entries && > +st->nb_index_entries != old_nb_index_entries) { > +// if we inserted a new item before the current sample, move the > +// counter ahead so it is still pointing to the same sample. > +sc->current_sample++; > } > -av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %u, offset > %"PRIx64", dts %"PRId64", " > -"size %u, distance %d, keyframe %d\n", st->index, > sc->sample_count+i, > +av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %d, offset > %"PRIx64", dts %"PRId64", " > +"size %u, distance %d, keyframe %d\n", st->index, err, > offset, dts, sample_size, distance, keyframe); > distance++; > dts += sample_duration; ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavformat/mov: Fix inserting frames before current_frame.
When using streaming input, it may be possible to see frames that appear before the current_frame. When these frames are inserted into the index, the current_frame needs to be updated so it is still pointing at the same frame. Signed-off-by: Jacob Trimble--- libavformat/mov.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 63f84be782..d039f27063 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4259,7 +4259,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) int64_t dts; int data_offset = 0; unsigned entries, first_sample_flags = frag->flags; -int flags, distance, i, err; +int flags, distance, i, err, old_nb_index_entries; for (i = 0; i < c->fc->nb_streams; i++) { if (c->fc->streams[i]->id == frag->track_id) { @@ -4352,13 +4352,19 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES)); if (keyframe) distance = 0; +old_nb_index_entries = st->nb_index_entries; err = av_add_index_entry(st, offset, dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); if (err < 0) { av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n"); +} else if (err <= sc->current_sample && err + 1 != st->nb_index_entries && +st->nb_index_entries != old_nb_index_entries) { +// if we inserted a new item before the current sample, move the +// counter ahead so it is still pointing to the same sample. +sc->current_sample++; } -av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %u, offset %"PRIx64", dts %"PRId64", " -"size %u, distance %d, keyframe %d\n", st->index, sc->sample_count+i, +av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " +"size %u, distance %d, keyframe %d\n", st->index, err, offset, dts, sample_size, distance, keyframe); distance++; dts += sample_duration; ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/mov: Fix inserting frames before current_frame
On Wed, Jul 26, 2017 at 15:37:16 -0700, Jacob Trimble wrote: > av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n"); > +} else if (err <= sc->current_sample && err + 1 != > st->nb_index_entries && > +st->nb_index_entries != old_nb_index_entries) { Your mailer inserted line breaks into the patch. Please either attach it, or even better, send it with git send-email. Thanks, Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavformat/mov: Fix inserting frames before current_frame
When using streaming input, it may be possible to see frames that appear before the current_frame. When these frames are inserted into the index, the current_frame needs to be updated so it is still pointing at the same frame. Signed-off-by: Jacob Trimble--- libavformat/mov.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 63f84be782..d039f27063 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4259,7 +4259,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) int64_t dts; int data_offset = 0; unsigned entries, first_sample_flags = frag->flags; -int flags, distance, i, err; +int flags, distance, i, err, old_nb_index_entries; for (i = 0; i < c->fc->nb_streams; i++) { if (c->fc->streams[i]->id == frag->track_id) { @@ -4352,13 +4352,19 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES)); if (keyframe) distance = 0; +old_nb_index_entries = st->nb_index_entries; err = av_add_index_entry(st, offset, dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); if (err < 0) { av_log(c->fc, AV_LOG_ERROR, "Failed to add index entry\n"); +} else if (err <= sc->current_sample && err + 1 != st->nb_index_entries && +st->nb_index_entries != old_nb_index_entries) { +// if we inserted a new item before the current sample, move the +// counter ahead so it is still pointing to the same sample. +sc->current_sample++; } -av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %u, offset %"PRIx64", dts %"PRId64", " -"size %u, distance %d, keyframe %d\n", st->index, sc->sample_count+i, +av_log(c->fc, AV_LOG_TRACE, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " +"size %u, distance %d, keyframe %d\n", st->index, err, offset, dts, sample_size, distance, keyframe); distance++; dts += sample_duration; ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel