audioencoder: reshuffle code in error handling

Move the assert to the error handling block at the end of the function so the
the logging is still triggered. Reword the logging slightly and add another
comment to hint what went wrong.

Fixes #737138
This commit is contained in:
Stefan Sauer 2014-09-23 11:56:33 +02:00
parent cabe5746fb
commit 5f0aad6f42

View file

@ -741,9 +741,7 @@ gst_audio_encoder_finish_frame (GstAudioEncoder * enc, GstBuffer * buf,
/* advance sample view */ /* advance sample view */
if (G_UNLIKELY (samples * ctx->info.bpf > priv->offset)) { if (G_UNLIKELY (samples * ctx->info.bpf > priv->offset)) {
if (G_LIKELY (!priv->force)) { if (G_LIKELY (!priv->force)) {
/* no way we can let this pass */ /* we should have received EOS to enable force */
g_assert_not_reached ();
/* really no way */
goto overflow; goto overflow;
} else { } else {
priv->offset = 0; priv->offset = 0;
@ -893,11 +891,14 @@ no_caps:
overflow: overflow:
{ {
GST_ELEMENT_ERROR (enc, STREAM, ENCODE, GST_ELEMENT_ERROR (enc, STREAM, ENCODE,
("received more encoded samples %d than provided %d", ("received more encoded samples %d than provided %d as inputs",
samples, priv->offset / ctx->info.bpf), (NULL)); samples, priv->offset / ctx->info.bpf), (NULL));
if (buf) if (buf)
gst_buffer_unref (buf); gst_buffer_unref (buf);
ret = GST_FLOW_ERROR; ret = GST_FLOW_ERROR;
/* no way we can let this pass */
g_assert_not_reached ();
/* really no way */
goto exit; goto exit;
} }
} }