mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-08 04:41:31 +00:00
bufferpool: avoid excessive GstPoll activity
Keep an extra write ref on the control socket. This ensures that we avoid a read/write on the socket when going from non-empty->empty->not-empty. We remove the write ref only when we actually are empty and we need to wait for flushing or a new buffer. This makes the bufferpool benchmark about 30% faster than the pure malloc implementation.
This commit is contained in:
parent
fb44b4d2ec
commit
878621f6f5
1 changed files with 8 additions and 2 deletions
|
@ -178,6 +178,9 @@ gst_buffer_pool_init (GstBufferPool * pool)
|
|||
gst_allocation_params_init (&priv->params);
|
||||
gst_buffer_pool_config_set_allocator (priv->config, priv->allocator,
|
||||
&priv->params);
|
||||
/* 1 control write for flushing */
|
||||
gst_poll_write_control (priv->poll);
|
||||
/* 1 control write for marking that we are not waiting for poll */
|
||||
gst_poll_write_control (priv->poll);
|
||||
|
||||
GST_DEBUG_OBJECT (pool, "created");
|
||||
|
@ -1007,9 +1010,12 @@ default_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer,
|
|||
break;
|
||||
}
|
||||
|
||||
/* now wait */
|
||||
GST_LOG_OBJECT (pool, "waiting for free buffers");
|
||||
/* now we release the control socket, we wait for a buffer release or
|
||||
* flushing */
|
||||
gst_poll_read_control (pool->priv->poll);
|
||||
GST_LOG_OBJECT (pool, "waiting for free buffers or flushing");
|
||||
gst_poll_wait (priv->poll, GST_CLOCK_TIME_NONE);
|
||||
gst_poll_write_control (pool->priv->poll);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue