Revision b10d7e4e ffmpeg.c

View differences:

ffmpeg.c
1464 1464
                            fifo_bytes = av_fifo_size(ost->fifo);
1465 1465
                            ret = 0;
1466 1466
                            /* encode any samples remaining in fifo */
1467
                            if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
1467
                            if (fifo_bytes > 0) {
1468 1468
                                int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3;
1469 1469
                                int fs_tmp = enc->frame_size;
1470
                                enc->frame_size = fifo_bytes / (osize * enc->channels);
1470

  
1471 1471
                                av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL);
1472
                                if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
1473
                                    enc->frame_size = fifo_bytes / (osize * enc->channels);
1474
                                } else { /* pad */
1475
                                    int frame_bytes = enc->frame_size*osize*enc->channels;
1476
                                    if (samples_size < frame_bytes)
1477
                                        av_exit(1);
1478
                                    memset((uint8_t*)samples+fifo_bytes, 0, frame_bytes - fifo_bytes);
1479
                                }
1480

  
1472 1481
                                ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples);
1473 1482
                                pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den,
1474 1483
                                                          ost->st->time_base.num, enc->sample_rate);

Also available in: Unified diff