diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2010-11-29 03:43:56 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2010-11-29 03:43:56 +0000 |
commit | 74f726209f5302029797dbb6916aff006563496b (patch) | |
tree | fc3f1b9bb8ac9baa791bf7a0b55d9866a1be7753 /libavformat | |
parent | 79561f0ed45c5a070284626339f2b0e368a7a252 (diff) | |
download | ffmpeg-74f726209f5302029797dbb6916aff006563496b.tar.gz |
In ts demuxer, if pes packet size is < ts packet, honor pes packet and skip padded data.
Fixes issue #2392.
Originally committed as revision 25841 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mpegts.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 3c61d8ba67..bbb00d3538 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -797,13 +797,17 @@ static int mpegts_push_data(MpegTSFilter *filter, 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; |