From 1dcdeb977c5e40214bc94ad9edc42a5a5a06e955 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 30 Jun 2015 19:59:54 +0200 Subject: [PATCH] avaudenc: Remember how many samples the codec consumed for telling the base class --- ext/libav/gstavaudenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/libav/gstavaudenc.c b/ext/libav/gstavaudenc.c index d5c5263..b842c4f 100644 --- a/ext/libav/gstavaudenc.c +++ b/ext/libav/gstavaudenc.c @@ -450,6 +450,7 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc, AVPacket *pkt; AVFrame *frame = ffmpegaudenc->frame; gboolean planar; + gint nsamples = -1; enc = GST_AUDIO_ENCODER (ffmpegaudenc); @@ -474,7 +475,7 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc, planar = av_sample_fmt_is_planar (ffmpegaudenc->context->sample_fmt); if (planar && info->channels > 1) { - gint channels, nsamples; + gint channels; gint i, j; nsamples = frame->nb_samples = in_size / info->bpf; @@ -555,7 +556,7 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc, frame->data[0] = audio_in; frame->extended_data = frame->data; frame->linesize[0] = in_size; - frame->nb_samples = in_size / info->bpf; + frame->nb_samples = nsamples = in_size / info->bpf; frame->buf[0] = av_buffer_create (NULL, 0, buffer_info_free, buffer_info, 0); } @@ -597,7 +598,7 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc, but we have no way to know AFAICT */ ret = gst_audio_encoder_finish_frame (enc, outbuf, -1); } else { - ret = gst_audio_encoder_finish_frame (enc, outbuf, frame->nb_samples); + ret = gst_audio_encoder_finish_frame (enc, outbuf, nsamples); } } else { GST_LOG_OBJECT (ffmpegaudenc, "no output produced"); -- 2.7.4