avformat/matroskadec: take into account priming samples in audio tracks

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2026-02-02 16:49:01 -03:00
parent 1dd8547193
commit 0880458e4c
6 changed files with 27 additions and 5 deletions
+1
View File
@@ -2860,6 +2860,7 @@ static int mka_parse_audio(MatroskaTrack *track, AVStream *st,
(AVRational){1, 1000000000},
(AVRational){1, par->codec_id == AV_CODEC_ID_OPUS ?
48000 : par->sample_rate});
sti->skip_samples = par->initial_padding;
}
if (track->seek_preroll > 0) {
par->seek_preroll = av_rescale_q(track->seek_preroll,
+8 -1
View File
@@ -11,7 +11,7 @@ ece637ed28526724c88f5c69b8bf7d6f *tests/data/fate/matroska-encoding-delay.matros
#codec_id 1: mp2
#sample_rate 1: 48000
#channel_layout_name 1: stereo
1, -10, -10, 24, 1152, 0x724077b8
1, -10, -10, 24, 1152, 0x724077b8, S=1, Skip Samples, 10, 0x08d300e2
0, 0, 0, 40, 237628, 0xeff25579
1, 14, 14, 24, 1152, 0x80625572
1, 38, 38, 24, 1152, 0x7d7f4dce
@@ -34,6 +34,13 @@ duration_time=0.024000
size=1152
pos=1263
flags=K__
[SIDE_DATA]
side_data_type=Skip Samples
skip_samples=481
discard_padding=0
skip_reason=0
discard_reason=0
[/SIDE_DATA]
[/PACKET]
[PACKET]
codec_type=video
+8 -1
View File
@@ -6,7 +6,7 @@
#codec_id 0: opus
#sample_rate 0: 48000
#channel_layout_name 0: stereo
0, -7, -7, 20, 402, 0x89b1c40f
0, -7, -7, 20, 402, 0x89b1c40f, S=1, Skip Samples, 10, 0x03f10065
0, 13, 13, 20, 216, 0x7bf97146
0, 33, 33, 20, 215, 0x6cb86d8b
0, 53, 53, 20, 218, 0x9cfd691c
@@ -59,6 +59,13 @@ duration_time=0.020000
size=402
pos=543
flags=K__
[SIDE_DATA]
side_data_type=Skip Samples
skip_samples=356
discard_padding=0
skip_reason=0
discard_reason=0
[/SIDE_DATA]
[/PACKET]
[PACKET]
codec_type=audio
+8 -1
View File
@@ -6,7 +6,7 @@ b9881205f8945fefc16a6f23474071a6 *tests/data/fate/matroska-opus-remux.matroska
#codec_id 0: opus
#sample_rate 0: 48000
#channel_layout_name 0: mono
0, -7, -7, 20, 320, 0x58b9a88d
0, -7, -7, 20, 320, 0x58b9a88d, S=1, Skip Samples, 10, 0x02390039
0, 14, 14, 20, 159, 0x6c9c4b4c
0, 34, 34, 20, 148, 0x0caf4b5d
0, 54, 54, 20, 139, 0xc5624226
@@ -70,6 +70,13 @@ duration_time=0.020000
size=320
pos=499
flags=K__
[SIDE_DATA]
side_data_type=Skip Samples
skip_samples=312
discard_padding=0
skip_reason=0
discard_reason=0
[/SIDE_DATA]
[/PACKET]
[PACKET]
codec_type=audio
+1 -1
View File
@@ -1,3 +1,3 @@
dd709c2b5e173eaca39cdd4a10aac3ec *tests/data/lavf/lavf.mkv
320447 tests/data/lavf/lavf.mkv
tests/data/lavf/lavf.mkv CRC=0xec6c3c68
tests/data/lavf/lavf.mkv CRC=0x29d44368
+1 -1
View File
@@ -1,3 +1,3 @@
7cd7b06892b74d66da217c8dda90bfac *tests/data/lavf/lavf.mkv_attachment
472597 tests/data/lavf/lavf.mkv_attachment
tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68
tests/data/lavf/lavf.mkv_attachment CRC=0x29d44368