Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Fix timestamps to be strictly monotonic for video also.
On Fri, Jun 1, 2018 at 12:23 AM, wrote: > From: Sasi Inguva > > Using same timestamp for multiple packets confuses clients like Ffms2 > while seeking to a packet with specific timestamp. > > Signed-off-by: Sasi Inguva > --- > libavformat/mov.c | 9 + > 1 file changed, 5 insertions(+), 4 deletions(-) OK, aside from the wrong mail (can be fixed by whoever pushes). - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/mov.c: Fix timestamps to be strictly monotonic for video also.
From: Sasi Inguva Using same timestamp for multiple packets confuses clients like Ffms2 while seeking to a packet with specific timestamp. Signed-off-by: Sasi Inguva --- libavformat/mov.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index cb6f3a45de..39d21e6e1c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3554,7 +3554,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) edit_list_dts_counter -= packet_skip_samples; if (edit_list_start_encountered == 0) { edit_list_start_encountered = 1; -// Make timestamps strictly monotonically increasing for audio, by rewriting timestamps for +// Make timestamps strictly monotonically increasing, by rewriting timestamps for // discarded packets. if (frame_duration_buffer) { fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter, @@ -3568,7 +3568,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) flags |= AVINDEX_DISCARD_FRAME; av_log(mov->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index); -if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) { +if (edit_list_start_encountered == 0) { num_discarded_begin++; frame_duration_buffer = av_realloc(frame_duration_buffer, num_discarded_begin * sizeof(int64_t)); @@ -3579,7 +3579,8 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) frame_duration_buffer[num_discarded_begin - 1] = frame_duration; // Increment skip_samples for the first non-zero audio edit list -if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) { +if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && +first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) { st->skip_samples += frame_duration; } } @@ -3594,7 +3595,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) edit_list_start_encountered = 1; // Make timestamps strictly monotonically increasing for audio, by rewriting timestamps for // discarded packets. -if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) { +if (frame_duration_buffer) { fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter, frame_duration_buffer, num_discarded_begin); av_freep(_duration_buffer); -- 2.17.0.rc1.321.gba9d0f2565-goog ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/mov.c: Fix timestamps to be strictly monotonic for video also.
From: Sasi InguvaUsing same timestamp for multiple packets confuses clients like Ffms2 while seeking to a packet with specific timestamp. Signed-off-by: Sasi Inguva --- libavformat/mov.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index cb6f3a45de..39d21e6e1c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3554,7 +3554,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) edit_list_dts_counter -= packet_skip_samples; if (edit_list_start_encountered == 0) { edit_list_start_encountered = 1; -// Make timestamps strictly monotonically increasing for audio, by rewriting timestamps for +// Make timestamps strictly monotonically increasing, by rewriting timestamps for // discarded packets. if (frame_duration_buffer) { fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter, @@ -3568,7 +3568,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) flags |= AVINDEX_DISCARD_FRAME; av_log(mov->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index); -if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) { +if (edit_list_start_encountered == 0) { num_discarded_begin++; frame_duration_buffer = av_realloc(frame_duration_buffer, num_discarded_begin * sizeof(int64_t)); @@ -3579,7 +3579,8 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) frame_duration_buffer[num_discarded_begin - 1] = frame_duration; // Increment skip_samples for the first non-zero audio edit list -if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) { +if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && +first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) { st->skip_samples += frame_duration; } } @@ -3594,7 +3595,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) edit_list_start_encountered = 1; // Make timestamps strictly monotonically increasing for audio, by rewriting timestamps for // discarded packets. -if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) { +if (frame_duration_buffer) { fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter, frame_duration_buffer, num_discarded_begin); av_freep(_duration_buffer); -- 2.17.0.rc1.321.gba9d0f2565-goog ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Fix timestamps to be strictly monotonic for video also.
On Thu, Mar 29, 2018 at 03:58:09PM -0700, Sasi Inguva wrote: > Signed-off-by: Sasi Inguva> --- > libavformat/mov.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) The commit message should explain why this change is done. Not just what is changed [...] > @@ -3594,7 +3595,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) > edit_list_start_encountered = 1; > // Make timestamps strictly monotonically increasing for > audio, by rewriting timestamps for > // discarded packets. > -if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && > frame_duration_buffer) { > +if (frame_duration_buffer) { The comment above needs an update too i think thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/mov.c: Fix timestamps to be strictly monotonic for video also.
Signed-off-by: Sasi Inguva--- libavformat/mov.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index cb6f3a45de..6b13742e4d 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3568,7 +3568,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) flags |= AVINDEX_DISCARD_FRAME; av_log(mov->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index); -if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) { +if (edit_list_start_encountered == 0) { num_discarded_begin++; frame_duration_buffer = av_realloc(frame_duration_buffer, num_discarded_begin * sizeof(int64_t)); @@ -3579,7 +3579,8 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) frame_duration_buffer[num_discarded_begin - 1] = frame_duration; // Increment skip_samples for the first non-zero audio edit list -if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) { +if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && +first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) { st->skip_samples += frame_duration; } } @@ -3594,7 +3595,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) edit_list_start_encountered = 1; // Make timestamps strictly monotonically increasing for audio, by rewriting timestamps for // discarded packets. -if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) { +if (frame_duration_buffer) { fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter, frame_duration_buffer, num_discarded_begin); av_freep(_duration_buffer); -- 2.17.0.rc1.321.gba9d0f2565-goog ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel