[FFmpeg-cvslog] mov: Fix start_time for streams with empty edits in the middle

Justin Ruggles git at videolan.org
Tue Feb 26 21:57:31 EET 2019


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Fri Feb 22 17:21:00 2019 -0500| [97f47fd601d0e380109f501e4aabff71ffbad052] | committer: Vittorio Giovara

mov: Fix start_time for streams with empty edits in the middle

Empty edits can occur at any position within the edit list except for at
the end. Empty edits in the middle should not impact the reported stream
start_time or the video PTS adjustment, so only include empty edits at
the start of the list in empty_edits_sum_duration.

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=97f47fd601d0e380109f501e4aabff71ffbad052
---

 libavformat/mov.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index bbd588c705..a7d444b0ee 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3446,6 +3446,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
     MOVIndexRange *current_index_range;
     int i;
     int found_keyframe_after_edit = 0;
+    int found_non_empty_edit = 0;
 
     if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) {
         return;
@@ -3492,10 +3493,11 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
         edit_list_dts_counter = edit_list_dts_entry_end;
         edit_list_dts_entry_end += edit_list_duration;
         num_discarded_begin = 0;
-        if (edit_list_media_time == -1) {
+        if (!found_non_empty_edit && edit_list_media_time == -1) {
             empty_edits_sum_duration += edit_list_duration;
             continue;
         }
+        found_non_empty_edit = 1;
 
         // If we encounter a non-negative edit list reset the skip_samples/start_pad fields and set them
         // according to the edit list below.



More information about the ffmpeg-cvslog mailing list