diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-19 22:57:36 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-09 03:45:40 +0100 |
commit | d38580a7bb811028b5d3bac4924fd486c06b816f (patch) | |
tree | d071ceee8624cee28a07636e996c1b46288c35e7 /libavformat/mpegtsenc.c | |
parent | 8acf9905a1c0f49325f31c757a681775e2c5d652 (diff) | |
download | ffmpeg-d38580a7bb811028b5d3bac4924fd486c06b816f.tar.gz |
mpegtsenc: fix handling of large audio packets
(sorry i have no sample, just a user report)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e31c5ebe1146d98d17a5121312c5444432c81904)
Conflicts:
libavformat/mpegtsenc.c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpegtsenc.c')
-rw-r--r-- | libavformat/mpegtsenc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 32dedfbae6..45a6f2213b 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -23,6 +23,7 @@ #include "libavutil/crc.h" #include "libavutil/dict.h" #include "libavutil/opt.h" +#include "libavutil/avassert.h" #include "libavcodec/mpegvideo.h" #include "avformat.h" #include "internal.h" @@ -947,19 +948,20 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) } } - if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO) { + if (ts_st->payload_index && ts_st->payload_index + size > DEFAULT_PES_PAYLOAD_SIZE) { + mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index, + ts_st->payload_pts, ts_st->payload_dts); + ts_st->payload_index = 0; + } + + if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO || size > DEFAULT_PES_PAYLOAD_SIZE) { + av_assert0(!ts_st->payload_index); // for video and subtitle, write a single pes packet mpegts_write_pes(s, st, buf, size, pts, dts); av_free(data); return 0; } - if (ts_st->payload_index + size > DEFAULT_PES_PAYLOAD_SIZE) { - mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index, - ts_st->payload_pts, ts_st->payload_dts); - ts_st->payload_index = 0; - } - if (!ts_st->payload_index) { ts_st->payload_pts = pts; ts_st->payload_dts = dts; |