mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
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
This commit is contained in:
parent
406d5ba04a
commit
17e2e9acd9
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue