diff options
author | Janne Grunau <janne-libav@jannau.net> | 2012-03-13 18:12:06 +0100 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-05-06 13:18:38 +0200 |
commit | 29d27b54251fe250f6fe512b7759a1405362ae67 (patch) | |
tree | 02cd335106b93319b8fe29c73bb0376bb043e51f /libavformat | |
parent | ddce7dabd2dcabac1655e76901192ae6aedecb69 (diff) | |
download | ffmpeg-29d27b54251fe250f6fe512b7759a1405362ae67.tar.gz |
mpegmux: add stuffing to avoid incomplete PCM frames
Fixes https://bugzilla.libav.org/show_bug.cgi?id=244
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mpegenc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index bda8d8324b..7bcf289c07 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -832,6 +832,12 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, if (stuffing_size < 0) stuffing_size = 0; + + if (startcode == PRIVATE_STREAM_1 && id >= 0xa0) { + if (payload_size < av_fifo_size(stream->fifo)) + stuffing_size += payload_size % stream->lpcm_align; + } + if (stuffing_size > 16) { /*<=16 for MPEG-1, <=32 for MPEG-2*/ pad_packet_bytes += stuffing_size; packet_size -= stuffing_size; |