omx: Do number of buffers configuration explicitely

This commit is contained in:
Sebastian Dröge 2013-03-06 17:05:51 +01:00
parent cc495aeb16
commit 60861f3990
5 changed files with 20 additions and 28 deletions

View file

@ -1565,22 +1565,14 @@ gst_omx_port_allocate_buffers_unlocked (GstOMXPort * port,
*/
gst_omx_port_update_port_definition (port, NULL);
g_return_val_if_fail (n == -1 || n >= port->port_def.nBufferCountMin,
OMX_ErrorBadParameter);
g_return_val_if_fail (n != -1 || (!buffers
&& !images), OMX_ErrorBadParameter);
if (n == -1)
n = port->port_def.nBufferCountMin;
n = port->port_def.nBufferCountActual;
if (port->port_def.nBufferCountActual != n) {
port->port_def.nBufferCountActual = n;
err = gst_omx_port_update_port_definition (port, &port->port_def);
}
if (err != OMX_ErrorNone) {
GST_ERROR_OBJECT (comp->parent,
"Failed to configure number of buffers of port %u: %s (0x%08x)",
port->index, gst_omx_error_to_string (err), err);
goto done;
}
g_return_val_if_fail (n == port->port_def.nBufferCountActual,
OMX_ErrorBadParameter);
GST_DEBUG_OBJECT (comp->parent,
"Allocating %d buffers of size %u for port %u", n,
@ -1645,14 +1637,14 @@ done:
/* NOTE: Uses comp->lock and comp->messages_lock */
OMX_ERRORTYPE
gst_omx_port_allocate_buffers (GstOMXPort * port, guint n)
gst_omx_port_allocate_buffers (GstOMXPort * port)
{
OMX_ERRORTYPE err;
g_return_val_if_fail (port != NULL, OMX_ErrorUndefined);
g_mutex_lock (&port->comp->lock);
err = gst_omx_port_allocate_buffers_unlocked (port, NULL, NULL, n);
err = gst_omx_port_allocate_buffers_unlocked (port, NULL, NULL, -1);
g_mutex_unlock (&port->comp->lock);
return err;

View file

@ -304,7 +304,7 @@ OMX_ERRORTYPE gst_omx_port_release_buffer (GstOMXPort *port, GstOMXBuffer *b
OMX_ERRORTYPE gst_omx_port_set_flushing (GstOMXPort *port, gboolean flush);
gboolean gst_omx_port_is_flushing (GstOMXPort *port);
OMX_ERRORTYPE gst_omx_port_allocate_buffers (GstOMXPort *port, guint n);
OMX_ERRORTYPE gst_omx_port_allocate_buffers (GstOMXPort *port);
OMX_ERRORTYPE gst_omx_port_use_buffers (GstOMXPort *port, const GList *buffers);
OMX_ERRORTYPE gst_omx_port_use_eglimages (GstOMXPort *port, const GList *images);
OMX_ERRORTYPE gst_omx_port_deallocate_buffers (GstOMXPort *port);

View file

@ -354,7 +354,7 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
if (err != OMX_ErrorNone)
goto reconfigure_error;
err = gst_omx_port_allocate_buffers (port, -1);
err = gst_omx_port_allocate_buffers (port);
if (err != OMX_ErrorNone)
goto reconfigure_error;
@ -733,7 +733,7 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
if (needs_disable) {
if (gst_omx_port_set_enabled (self->enc_in_port, TRUE) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_allocate_buffers (self->enc_in_port, -1) != OMX_ErrorNone)
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_wait_enabled (self->enc_in_port,
5 * GST_SECOND) != OMX_ErrorNone)
@ -745,7 +745,7 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info)
return FALSE;
/* Need to allocate buffers to reach Idle state */
if (gst_omx_port_allocate_buffers (self->enc_in_port, -1) != OMX_ErrorNone)
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
return FALSE;
/* And disable output port */
@ -900,7 +900,7 @@ gst_omx_audio_enc_handle_frame (GstAudioEncoder * encoder, GstBuffer * inbuf)
goto reconfigure_error;
}
err = gst_omx_port_allocate_buffers (port, -1);
err = gst_omx_port_allocate_buffers (port);
if (err != OMX_ErrorNone) {
GST_AUDIO_ENCODER_STREAM_LOCK (self);
goto reconfigure_error;

View file

@ -1201,7 +1201,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
if (needs_disable) {
if (gst_omx_port_set_enabled (self->dec_in_port, TRUE) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_allocate_buffers (self->dec_in_port, -1) != OMX_ErrorNone)
if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_wait_enabled (self->dec_in_port,
5 * GST_SECOND) != OMX_ErrorNone)
@ -1213,7 +1213,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
return FALSE;
/* Need to allocate buffers to reach Idle state */
if (gst_omx_port_allocate_buffers (self->dec_in_port, -1) != OMX_ErrorNone)
if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone)
return FALSE;
/* And disable output port */
@ -1389,7 +1389,7 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder,
goto reconfigure_error;
}
err = gst_omx_port_allocate_buffers (port, -1);
err = gst_omx_port_allocate_buffers (port);
if (err != OMX_ErrorNone) {
GST_VIDEO_DECODER_STREAM_LOCK (self);
goto reconfigure_error;

View file

@ -807,7 +807,7 @@ gst_omx_video_enc_loop (GstOMXVideoEnc * self)
if (err != OMX_ErrorNone)
goto reconfigure_error;
err = gst_omx_port_allocate_buffers (port, -1);
err = gst_omx_port_allocate_buffers (port);
if (err != OMX_ErrorNone)
goto reconfigure_error;
@ -1206,7 +1206,7 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
if (needs_disable) {
if (gst_omx_port_set_enabled (self->enc_in_port, TRUE) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_allocate_buffers (self->enc_in_port, -1) != OMX_ErrorNone)
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_wait_enabled (self->enc_in_port,
5 * GST_SECOND) != OMX_ErrorNone)
@ -1218,7 +1218,7 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
return FALSE;
/* Need to allocate buffers to reach Idle state */
if (gst_omx_port_allocate_buffers (self->enc_in_port, -1) != OMX_ErrorNone)
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
return FALSE;
/* And disable output port */
@ -1542,7 +1542,7 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
goto reconfigure_error;
}
err = gst_omx_port_allocate_buffers (port, -1);
err = gst_omx_port_allocate_buffers (port);
if (err != OMX_ErrorNone) {
GST_VIDEO_ENCODER_STREAM_LOCK (self);
goto reconfigure_error;