[FFmpeg-cvslog] r25841 - trunk/libavformat/mpegts.c

bcoudurier subversion
Mon Nov 29 04:43:57 CET 2010


Author: bcoudurier
Date: Mon Nov 29 04:43:56 2010
New Revision: 25841

Log:
In ts demuxer, if pes packet size is < ts packet, honor pes packet and skip padded data.
Fixes issue #2392.

Modified:
   trunk/libavformat/mpegts.c

Modified: trunk/libavformat/mpegts.c
==============================================================================
--- trunk/libavformat/mpegts.c	Mon Nov 29 00:09:30 2010	(r25840)
+++ trunk/libavformat/mpegts.c	Mon Nov 29 04:43:56 2010	(r25841)
@@ -797,13 +797,17 @@ static int mpegts_push_data(MpegTSFilter
             break;
         case MPEGTS_PAYLOAD:
             if (buf_size > 0 && pes->buffer) {
-                if (pes->data_index+buf_size > pes->total_size) {
+                if (pes->data_index > 0 && pes->data_index+buf_size > pes->total_size) {
                     new_pes_packet(pes, ts->pkt);
                     pes->total_size = MAX_PES_PAYLOAD;
                     pes->buffer = av_malloc(pes->total_size+FF_INPUT_BUFFER_PADDING_SIZE);
                     if (!pes->buffer)
                         return AVERROR(ENOMEM);
                     ts->stop_parse = 1;
+                } else if (pes->data_index == 0 && buf_size > pes->total_size) {
+                    // pes packet size is < ts size packet and pes data is padded with 0xff
+                    // not sure if this is legal in ts but see issue #2392
+                    buf_size = pes->total_size;
                 }
                 memcpy(pes->buffer+pes->data_index, p, buf_size);
                 pes->data_index += buf_size;



More information about the ffmpeg-cvslog mailing list