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

Git pushed a commit to branch master
in repository ffmpeg.

commit 6213ad9ec734e5763e46d5b876ef5ce6cdec4655
Author:     Peter Ross <[email protected]>
AuthorDate: Fri Sep 25 13:48:48 2026 +1000
Commit:     Peter Ross <[email protected]>
CommitDate: Fri Sep 25 22:12:25 2026 +0000

    avformat/binka: set AV_PKT_DATA_SKIP_SAMPLES
    
    Export discard padding for a short final packet so the
    decoder does not output samples beyond its declared duration.
    
    Assisted-by: Fairy
---
 libavformat/binka.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libavformat/binka.c b/libavformat/binka.c
index cadb7238d4..ccb12219d8 100644
--- a/libavformat/binka.c
+++ b/libavformat/binka.c
@@ -91,6 +91,7 @@ static int binka_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     AVStream *st = s->streams[0];
     int64_t pos, duration;
     int pkt_size;
+    int discard_padding = 0;
     int ret;
 
     pos = avio_tell(pb);
@@ -106,6 +107,12 @@ static int binka_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     if (binka->is_ueba && pkt_size == 0xFFFF) {
         pkt_size = avio_rl16(pb);
         duration = avio_rl16(pb);
+        if (duration > 0) {
+            /* Match the decoded DCT block size, excluding overlap. */
+            int frame_samples = st->codecpar->sample_rate < 22050 ? 480 :
+                                st->codecpar->sample_rate < 44100 ? 960 : 1920;
+            discard_padding = FFMAX(0, frame_samples - duration);
+        }
     } else
         duration = av_get_audio_frame_duration2(st->codecpar, 0);
 
@@ -118,6 +125,13 @@ static int binka_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         return ret;
     AV_WL32(pkt->data, pkt_size);
 
+    if (discard_padding) {
+        uint8_t *side_data = av_packet_new_side_data(pkt, 
AV_PKT_DATA_SKIP_SAMPLES, 10);
+        if (!side_data)
+            return AVERROR(ENOMEM);
+        AV_WL32(side_data + 4, discard_padding);
+    }
+
     pkt->pos = pos;
     pkt->stream_index = 0;
     pkt->duration = duration;

-- 
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