Commit 29d27b54 authored by Janne Grunau's avatar Janne Grunau

mpegmux: add stuffing to avoid incomplete PCM frames

Fixes https://bugzilla.libav.org/show_bug.cgi?id=244
parent ddce7dab
...@@ -832,6 +832,12 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, ...@@ -832,6 +832,12 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
if (stuffing_size < 0) if (stuffing_size < 0)
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*/ if (stuffing_size > 16) { /*<=16 for MPEG-1, <=32 for MPEG-2*/
pad_packet_bytes += stuffing_size; pad_packet_bytes += stuffing_size;
packet_size -= stuffing_size; packet_size -= stuffing_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment