Revision 14cf0fd2
ffmpeg.c | ||
---|---|---|
1390 | 1390 |
} |
1391 | 1391 |
} |
1392 | 1392 |
|
1393 |
static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size) |
|
1394 |
{ |
|
1395 |
int fill_char = 0x00; |
|
1396 |
if (sample_fmt == AV_SAMPLE_FMT_U8) |
|
1397 |
fill_char = 0x80; |
|
1398 |
memset(buf, fill_char, size); |
|
1399 |
} |
|
1400 |
|
|
1393 | 1401 |
/* pkt = NULL means EOF (needed to flush decoder buffers) */ |
1394 | 1402 |
static int output_packet(AVInputStream *ist, int ist_index, |
1395 | 1403 |
AVOutputStream **ost_table, int nb_ostreams, |
... | ... | |
1732 | 1740 |
int frame_bytes = enc->frame_size*osize*enc->channels; |
1733 | 1741 |
if (allocated_audio_buf_size < frame_bytes) |
1734 | 1742 |
ffmpeg_exit(1); |
1735 |
memset(audio_buf+fifo_bytes, 0, frame_bytes - fifo_bytes);
|
|
1743 |
generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes);
|
|
1736 | 1744 |
} |
1737 | 1745 |
|
1738 | 1746 |
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf); |
Also available in: Unified diff