Ticket #9355: 0001-Fix-setting-the-correct-size-for-PES-packets-with-to.patch

File 0001-Fix-setting-the-correct-size-for-PES-packets-with-to.patch, 1011 bytes (added by Sergio Ammirata, Ph.D., 5 years ago)

proposed patch

  • libavformat/mpegts.c

    From 3a2760d42b38023c73f9a3ab18de01a44526dbc9 Mon Sep 17 00:00:00 2001
    From: Sergio Ammirata <sergio@ammirata.net>
    Date: Tue, 3 Aug 2021 13:43:44 +0000
    Subject: [PATCH] Fix setting the correct size for PES packets with too much
     padding
    
    ---
     libavformat/mpegts.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
    index 640c9afa5d..40439c26c0 100644
    a b skip:  
    13551355                           buf_size > pes->total_size) {
    13561356                    // pes packet size is < ts size packet and pes data is padded with 0xff
    13571357                    // not sure if this is legal in ts but see issue #2392
    1358                     buf_size = pes->total_size;
     1358                    buf_size = PES_START_SIZE + pes->total_size - pes->pes_header_size;
    13591359                }
    13601360                memcpy(pes->buffer->data + pes->data_index, p, buf_size);
    13611361                pes->data_index += buf_size;