p = interleaved_to_planar( samples, channels, p, sizeof( uint8_t ) );
#endif
#if LIBAVCODEC_VERSION_MAJOR >= 55
- audio_avframe->nb_samples = samples;
+ audio_avframe->nb_samples = FFMAX( samples, audio_input_nb_samples );
avcodec_fill_audio_frame( audio_avframe, codec->channels, codec->sample_fmt,
(const uint8_t*) p, AUDIO_ENCODE_BUFFER_SIZE, 0 );
int got_packet = 0;
else if ( !got_packet )
pkt.size = 0;
#else
- codec->frame_size = samples;
+ codec->frame_size = FFMAX( samples, audio_input_nb_samples );
pkt.size = avcodec_encode_audio( codec, audio_outbuf, audio_outbuf_size, p );
pkt.pts = codec->coded_frame? codec->coded_frame->pts : AV_NOPTS_VALUE;
pkt.flags |= PKT_FLAG_KEY;