This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 7ea7eb719820cf47846e8e784d26c6c9116895de
Author:     Romain Beauxis <[email protected]>
AuthorDate: Thu Nov 12 12:42:52 2026 -0600
Commit:     Romain Beauxis <[email protected]>
CommitDate: Fri Nov 20 14:48:15 2026 +0000

    avformat/matroskadec: factor out trusting the default duration
    
    So that track setup can use the check too.
---
 libavformat/matroskadec.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a85eec7f81..b3d4ea42dc 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3168,6 +3168,18 @@ static int mkv_parse_subtitle_codec(MatroskaTrack 
*track, AVStream *st,
     return 0;
 }
 
+static int mkv_trust_default_duration(const MatroskaTrack *track,
+                                      const AVCodecParameters *par)
+{
+    if (!track->default_duration)
+        return 0;
+    // If this is needed for more codecs, then add them here
+    if (track->audio.samplerate == 8000 && par->codec_id == AV_CODEC_ID_AC3 &&
+        (track->audio.samplerate != par->sample_rate || !par->frame_size))
+        return 0;
+    return 1;
+}
+
 static int matroska_parse_tracks(AVFormatContext *s)
 {
     MatroskaDemuxContext *matroska = s->priv_data;
@@ -4303,7 +4315,6 @@ static int matroska_parse_block(MatroskaDemuxContext 
*matroska, AVBufferRef *buf
     uint32_t lace_size[256];
     int n, flags, laces = 0;
     uint64_t num;
-    int trust_default_duration;
 
     av_assert1(buf);
 
@@ -4373,16 +4384,7 @@ static int matroska_parse_block(MatroskaDemuxContext 
*matroska, AVBufferRef *buf
         return res;
     }
 
-    trust_default_duration = track->default_duration != 0;
-    if (track->audio.samplerate == 8000 && trust_default_duration) {
-        // If this is needed for more codecs, then add them here
-        if (st->codecpar->codec_id == AV_CODEC_ID_AC3) {
-            if (track->audio.samplerate != st->codecpar->sample_rate || 
!st->codecpar->frame_size)
-                trust_default_duration = 0;
-        }
-    }
-
-    if (!block_duration && trust_default_duration)
+    if (!block_duration && mkv_trust_default_duration(track, st->codecpar))
         block_duration = av_rescale_q(track->default_duration * laces,
                                       (AVRational) { 1, 1000000000 },
                                       st->time_base);

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to