If audio_in is NULL, we'll send a NULL frame to libav, to flush
the codec. In that case, we won't know how many samples the codec
will have used, so we use -1 (for don't know) when letting the
base class know about the buffer.
Coverity 1195177
pkt, gst_ffmpegaudenc_free_avpacket);
codec = ffmpegaudenc->context->codec;
- if ((codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) {
+ if ((codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) || !audio_in) {
ret = gst_audio_encoder_finish_frame (enc, outbuf, -1);
} else {
ret = gst_audio_encoder_finish_frame (enc, outbuf, frame.nb_samples);