diff options
author | Zhao Zhili <quinkblack@foxmail.com> | 2022-03-29 12:50:53 +0800 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2022-04-29 17:22:52 +0800 |
commit | 301141b57636c4430e7440e8ff4956daf9cb0fb3 (patch) | |
tree | c456a4fc5a2bbbd80c66e6dacfc8ef80a6be57f4 /libavformat/movenc.c | |
parent | 3946cb02fc67a0fdd23ff9e0678b2801fe479463 (diff) | |
download | ffmpeg-301141b57636c4430e7440e8ff4956daf9cb0fb3.tar.gz |
avformat/movenc: sidx earliest_presentation_time is applied after editlist
Fix #8334
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9956e699c..d2cd5bc6f4 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4781,7 +4781,8 @@ static int mov_write_sidx_tag(AVIOContext *pb, if (track->entry) { entries = 1; - presentation_time = track->cluster[0].dts + track->cluster[0].cts; + presentation_time = track->cluster[0].dts + track->cluster[0].cts - + track->start_dts - track->start_cts; duration = track->end_pts - (track->cluster[0].dts + track->cluster[0].cts); starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE; @@ -4796,6 +4797,9 @@ static int mov_write_sidx_tag(AVIOContext *pb, if (entries <= 0) return 0; presentation_time = track->frag_info[0].time; + /* presentation_time <= 0 is handled by mov_add_tfra_entries() */ + if (presentation_time > 0) + presentation_time -= track->start_dts + track->start_cts; } avio_wb32(pb, 0); /* size */ |