aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mpegtsenc.c
diff options
context:
space:
mode:
authorJindřich Makovička <makovick@gmail.com>2011-12-19 20:03:24 +0100
committerAnton Khirnov <anton@khirnov.net>2011-12-28 20:31:15 +0100
commit6fa9843b4baf93a95be5ce7c6ad5c041992504bf (patch)
treee5c9d5441e1ed44865001f044924e6261d8e8dbe /libavformat/mpegtsenc.c
parentb5aecc6bc025461e016baad4486c4e1cacbd6263 (diff)
downloadffmpeg-6fa9843b4baf93a95be5ce7c6ad5c041992504bf.tar.gz
mpegts: properly output large audio packets
Do not assume the audio packets being always smaller than DEFAULT_PES_PAYLOAD_SIZE. Signed-off-by: Jindřich Makovička <makovick@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/mpegtsenc.c')
-rw-r--r--libavformat/mpegtsenc.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 57cfe4552b..48b1617016 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1007,10 +1007,18 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if (ts_st->payload_size + size > DEFAULT_PES_PAYLOAD_SIZE) {
- mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_size,
- ts_st->payload_pts, ts_st->payload_dts,
- ts_st->payload_flags & AV_PKT_FLAG_KEY);
- ts_st->payload_size = 0;
+ if (ts_st->payload_size) {
+ mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_size,
+ ts_st->payload_pts, ts_st->payload_dts,
+ ts_st->payload_flags & AV_PKT_FLAG_KEY);
+ ts_st->payload_size = 0;
+ }
+ if (size > DEFAULT_PES_PAYLOAD_SIZE) {
+ mpegts_write_pes(s, st, buf, size, pts, dts,
+ pkt->flags & AV_PKT_FLAG_KEY);
+ av_free(data);
+ return 0;
+ }
}
if (!ts_st->payload_size) {