omxaudioenc: Minor code refactoring
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 8 Nov 2011 07:31:58 +0000 (08:31 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 8 Nov 2011 07:31:58 +0000 (08:31 +0100)
omx/gstomxaudioenc.c

index 238fa0f..a79c140 100644 (file)
@@ -877,8 +877,10 @@ gst_omx_audio_enc_handle_frame (GstBaseAudioEncoder * encoder,
       return self->downstream_flow_ret;
     }
 
-    if (buf->omx_buf->nAllocLen - buf->omx_buf->nOffset <= 0)
+    if (buf->omx_buf->nAllocLen - buf->omx_buf->nOffset <= 0) {
+      gst_omx_port_release_buffer (self->in_port, buf);
       goto full_buffer;
+    }
 
     /* Copy the buffer content in chunks of size as requested
      * by the port */
@@ -919,7 +921,6 @@ full_buffer:
     GST_ELEMENT_ERROR (self, LIBRARY, FAILED, (NULL),
         ("Got OpenMAX buffer with no free space (%p, %u/%u)", buf,
             buf->omx_buf->nOffset, buf->omx_buf->nAllocLen));
-    gst_omx_port_release_buffer (self->in_port, buf);
     return GST_FLOW_ERROR;
   }
 component_error: