[FFmpeg-cvslog] avformat/matroskaenc: Write CodecDelay for codecs != Opus

Andreas Rheinhardt git at videolan.org
Mon Sep 5 21:51:10 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Sep  1 20:50:53 2022 +0200| [8913539a5d2a81a77980b45455b1eb144827fd96] | committer: Andreas Rheinhardt

avformat/matroskaenc: Write CodecDelay for codecs != Opus

The field is not specific to Opus.
The mp2fixed encoder signals initial_padding and is used
by both the matroska-encoding-delay test as well as
the lavf-mkv tests which necessitated several FATE ref changes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavformat/matroskaenc.c              |  2 +-
 tests/ref/fate/matroska-encoding-delay | 81 ++++++++++++++++++++--------------
 tests/ref/lavf/mkv                     |  4 +-
 tests/ref/lavf/mkv_attachment          |  4 +-
 tests/ref/seek/lavf-mkv                | 44 +++++++++---------
 5 files changed, 74 insertions(+), 61 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 97dcff5607..ed1ad5039d 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1828,7 +1828,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
         break;
 
     case AVMEDIA_TYPE_AUDIO:
-        if (par->initial_padding && par->codec_id == AV_CODEC_ID_OPUS) {
+        if (par->initial_padding) {
             int64_t codecdelay = av_rescale_q(par->initial_padding,
                                               (AVRational){ 1, par->sample_rate },
                                               (AVRational){ 1, 1000000000 });
diff --git a/tests/ref/fate/matroska-encoding-delay b/tests/ref/fate/matroska-encoding-delay
index fb7909fe29..8dd3bf59e2 100644
--- a/tests/ref/fate/matroska-encoding-delay
+++ b/tests/ref/fate/matroska-encoding-delay
@@ -1,5 +1,5 @@
-df0524cac5393212ee103c1d1221f4b3 *tests/data/fate/matroska-encoding-delay.matroska
-961215 tests/data/fate/matroska-encoding-delay.matroska
+b933b7b94de55ae029369312d48d8649 *tests/data/fate/matroska-encoding-delay.matroska
+961221 tests/data/fate/matroska-encoding-delay.matroska
 #extradata 0:       22, 0x32ea0490
 #tb 0: 1/1000
 #media_type 0: video
@@ -11,67 +11,80 @@ df0524cac5393212ee103c1d1221f4b3 *tests/data/fate/matroska-encoding-delay.matros
 #codec_id 1: mp2
 #sample_rate 1: 48000
 #channel_layout_name 1: stereo
-1,          0,          0,       24,     1152, 0x724077b8
-0,         10,         10,       40,   237628, 0xeff25579, S=1,       40
-1,         24,         24,       24,     1152, 0x80625572
-1,         48,         48,       24,     1152, 0x7d7f4dce
-0,         50,         50,       40,   238066, 0xb2265f41
-1,         72,         72,       24,     1152, 0xa6725739
-0,         90,         90,       40,   237723, 0x00d7cd24
-1,         96,         96,       24,     1152, 0xc9e85398
-1,        120,        120,       24,     1152, 0xda1287d3
-0,        130,        130,       40,   238290, 0xbe18b18f
-1,        144,        144,       24,     1152, 0x1c9a6102
+1,        -10,        -10,       24,     1152, 0x724077b8
+0,          0,          0,       40,   237628, 0xeff25579, S=1,       40
+1,         14,         14,       24,     1152, 0x80625572
+1,         38,         38,       24,     1152, 0x7d7f4dce
+0,         40,         40,       40,   238066, 0xb2265f41
+1,         62,         62,       24,     1152, 0xa6725739
+0,         80,         80,       40,   237723, 0x00d7cd24
+1,         86,         86,       24,     1152, 0xc9e85398
+1,        110,        110,       24,     1152, 0xda1287d3
+0,        120,        120,       40,   238290, 0xbe18b18f
+1,        134,        134,       24,     1152, 0x1c9a6102
 [PACKET]
 codec_type=audio
 stream_index=1
-pts=0
-pts_time=0.000000
-dts=0
-dts_time=0.000000
+pts=-10
+pts_time=-0.010000
+dts=-10
+dts_time=-0.010000
 duration=24
 duration_time=0.024000
 size=1152
-pos=1232
+pos=1238
 flags=K_
 [/PACKET]
 [PACKET]
 codec_type=video
 stream_index=0
-pts=10
-pts_time=0.010000
-dts=10
-dts_time=0.010000
+pts=0
+pts_time=0.000000
+dts=0
+dts_time=0.000000
 duration=40
 duration_time=0.040000
 size=237628
-pos=2392
+pos=2398
 flags=K_
 [/PACKET]
 [PACKET]
 codec_type=audio
 stream_index=1
-pts=24
-pts_time=0.024000
-dts=24
-dts_time=0.024000
+pts=14
+pts_time=0.014000
+dts=14
+dts_time=0.014000
 duration=24
 duration_time=0.024000
 size=1152
-pos=240027
+pos=240033
 flags=K_
 [/PACKET]
 [PACKET]
 codec_type=audio
 stream_index=1
-pts=48
-pts_time=0.048000
-dts=48
-dts_time=0.048000
+pts=38
+pts_time=0.038000
+dts=38
+dts_time=0.038000
 duration=24
 duration_time=0.024000
 size=1152
-pos=241202
+pos=241208
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=video
+stream_index=0
+pts=40
+pts_time=0.040000
+dts=40
+dts_time=0.040000
+duration=40
+duration_time=0.040000
+size=238066
+pos=242368
 flags=K_
 [/PACKET]
 [STREAM]
@@ -81,5 +94,5 @@ codec_name=mpeg2video
 [/STREAM]
 [STREAM]
 codec_name=mp2
-initial_padding=0
+initial_padding=481
 [/STREAM]
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
index d9497a0a64..d54c44a647 100644
--- a/tests/ref/lavf/mkv
+++ b/tests/ref/lavf/mkv
@@ -1,3 +1,3 @@
-17e637fc06015fea86428840418ffea2 *tests/data/lavf/lavf.mkv
-320403 tests/data/lavf/lavf.mkv
+0934e35639b6735c1e26595e8f47ba70 *tests/data/lavf/lavf.mkv
+320409 tests/data/lavf/lavf.mkv
 tests/data/lavf/lavf.mkv CRC=0xec6c3c68
diff --git a/tests/ref/lavf/mkv_attachment b/tests/ref/lavf/mkv_attachment
index a8cc075bf1..ad96424098 100644
--- a/tests/ref/lavf/mkv_attachment
+++ b/tests/ref/lavf/mkv_attachment
@@ -1,3 +1,3 @@
-3855fb336711517b32b0ec41e8505b4d *tests/data/lavf/lavf.mkv_attachment
-472553 tests/data/lavf/lavf.mkv_attachment
+d2708709bdd6817d9cb2b475fdfa903f *tests/data/lavf/lavf.mkv_attachment
+472559 tests/data/lavf/lavf.mkv_attachment
 tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68
diff --git a/tests/ref/seek/lavf-mkv b/tests/ref/seek/lavf-mkv
index 6b64367802..8ac0354164 100644
--- a/tests/ref/seek/lavf-mkv
+++ b/tests/ref/seek/lavf-mkv
@@ -1,48 +1,48 @@
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    651 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    657 size:   208
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret:-1         st: 1 flags:0  ts: 2.577000
 ret: 0         st: 1 flags:1  ts: 1.471000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320124 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size:   209
 ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146835 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
 ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret:-1         st: 0 flags:0  ts: 2.153000
 ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    651 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    657 size:   208
 ret: 0         st: 1 flags:1  ts: 2.836000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320124 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size:   209
 ret:-1         st:-1 flags:0  ts: 1.730004
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146835 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret:-1         st: 1 flags:0  ts: 1.307000
 ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    651 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    657 size:   208
 ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret:-1         st: 1 flags:0  ts: 2.672000
 ret: 0         st: 1 flags:1  ts: 1.566000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320124 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size:   209
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146835 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837



More information about the ffmpeg-cvslog mailing list