diff mbox series

[FFmpeg-devel,v3] avformat/movenc: fix duration in mdhd box

Message ID tencent_7D4D80DC34DB3F53572F9D76E0EE5AEE3509@qq.com
State New
Headers show
Series [FFmpeg-devel,v3] avformat/movenc: fix duration in mdhd box | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Zhao Zhili Dec. 17, 2021, 1:58 p.m. UTC
mvhd and tkhd present the post-editlist duration, while mdhd should
have the pre-editlist duration. Regression since c2424b1f3.
---
 libavformat/movenc.c  | 2 +-
 tests/ref/fate/movenc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Martin Storsjö Dec. 17, 2021, 6:48 p.m. UTC | #1
On Fri, 17 Dec 2021, Zhao Zhili wrote:

> mvhd and tkhd present the post-editlist duration, while mdhd should
> have the pre-editlist duration. Regression since c2424b1f3.
> ---
> libavformat/movenc.c  | 2 +-
> tests/ref/fate/movenc | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)

Thanks, this looks sensible to me. I haven't verified these details with 
the spec, but it sounds reasonable.

// Martin
Zhao Zhili Jan. 5, 2022, 11:31 a.m. UTC | #2
> On Dec 18, 2021, at 2:48 AM, Martin Storsjö <martin@martin.st> wrote:
> 
> On Fri, 17 Dec 2021, Zhao Zhili wrote:
> 
>> mvhd and tkhd present the post-editlist duration, while mdhd should
>> have the pre-editlist duration. Regression since c2424b1f3.
>> ---
>> libavformat/movenc.c  | 2 +-
>> tests/ref/fate/movenc | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> Thanks, this looks sensible to me. I haven't verified these details with the spec, but it sounds reasonable.

Ping. Is the patch Ok to be merged?

> 
> // Martin
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0f912dd012..f76ef430cf 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2970,7 +2970,7 @@  static int64_t calc_pts_duration(MOVMuxContext *mov, MOVTrack *track)
 static int mov_write_mdhd_tag(AVIOContext *pb, MOVMuxContext *mov,
                               MOVTrack *track)
 {
-    int64_t duration = calc_pts_duration(mov, track);
+    int64_t duration = calc_samples_pts_duration(mov, track);
     int version = duration < INT32_MAX ? 0 : 1;
 
     if (track->mode == MODE_ISM)
diff --git a/tests/ref/fate/movenc b/tests/ref/fate/movenc
index 81ea75f372..19e4e291b8 100644
--- a/tests/ref/fate/movenc
+++ b/tests/ref/fate/movenc
@@ -7,7 +7,7 @@  write_data len 36, time nopts, type header atom ftyp
 write_data len 2761, time nopts, type header atom -
 write_data len 908, time 966667, type sync atom moof
 write_data len 110, time nopts, type trailer atom -
-caf0876986b5f033efc0958c338289cc 3815 non-empty-moov-elst
+9d260d424e9de4626163fd25ccce5bab 3815 non-empty-moov-elst
 write_data len 36, time nopts, type header atom ftyp
 write_data len 2669, time nopts, type header atom -
 write_data len 908, time 1000000, type sync atom moof