diff --git a/ext/opus/gstopusenc.c b/ext/opus/gstopusenc.c index f632a72056..327c5fae80 100644 --- a/ext/opus/gstopusenc.c +++ b/ext/opus/gstopusenc.c @@ -588,7 +588,7 @@ gst_opus_enc_encode (GstOpusEnc * enc, GstBuffer * buf) GST_ERROR_OBJECT (enc, "Encoding failed: %d", outsize); ret = GST_FLOW_ERROR; goto done; - } else if (outsize != bytes_per_packet) { + } else if (outsize > bytes_per_packet) { GST_WARNING_OBJECT (enc, "Encoded size %d is different from %d bytes per packet", outsize, bytes_per_packet); @@ -596,6 +596,8 @@ gst_opus_enc_encode (GstOpusEnc * enc, GstBuffer * buf) goto done; } + GST_BUFFER_SIZE (outbuf) = outsize; + ret = gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (enc), outbuf, enc->frame_samples);