Commit 17e2e9ac authored by Vincent Penquerc'h's avatar Vincent Penquerc'h
Browse files

avaudenc: avoid using wrong number of samples

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
parent 406d5ba0
...@@ -553,7 +553,7 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc, ...@@ -553,7 +553,7 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc,
pkt, gst_ffmpegaudenc_free_avpacket); pkt, gst_ffmpegaudenc_free_avpacket);
codec = ffmpegaudenc->context->codec; 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); ret = gst_audio_encoder_finish_frame (enc, outbuf, -1);
} else { } else {
ret = gst_audio_encoder_finish_frame (enc, outbuf, frame.nb_samples); ret = gst_audio_encoder_finish_frame (enc, outbuf, frame.nb_samples);
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