avaudenc: Set all required fields in the AVFrame
authorSebastian Dröge <sebastian@centricular.com>
Thu, 28 Apr 2016 15:43:37 +0000 (18:43 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 28 Apr 2016 15:43:37 +0000 (18:43 +0300)
Various functions in libavcodec need them, like the format, sample rate, etc.
and just having them in the context is not enough.

This fixes draining for codecs like MP2 that require a fixed frame size and
require libav to pad the last frame if required.

ext/libav/gstavaudenc.c

index 93eecf5..b895a9d 100644 (file)
@@ -475,6 +475,10 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc,
 
     info = gst_audio_encoder_get_audio_info (enc);
     planar = av_sample_fmt_is_planar (ffmpegaudenc->context->sample_fmt);
+    frame->format = ffmpegaudenc->context->sample_fmt;
+    frame->sample_rate = ffmpegaudenc->context->sample_rate;
+    frame->channels = ffmpegaudenc->context->channels;
+    frame->channel_layout = ffmpegaudenc->context->channel_layout;
 
     if (planar && info->channels > 1) {
       gint channels;