mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
x11: don't block in buffer acquire
Don't ever block when acquiring a buffer from the bufferpool in the fallback mode. If we block, we might deadlock when going to PAUSED because we never unlock when going to paused. The acquire can block when there are no more buffers in the pool, this is a sign that the pool is too small. Since we are the only ones using the pool in the fallback case and because we scale the buffer, someone else must be using our pool as well and is doing something bad.
This commit is contained in:
parent
0dd2766d83
commit
da4884a834
2 changed files with 16 additions and 8 deletions
|
@ -1312,6 +1312,7 @@ gst_ximagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
res = GST_FLOW_OK;
|
||||
} else {
|
||||
GstVideoFrame src, dest;
|
||||
GstBufferPoolAcquireParams params = { 0, };
|
||||
|
||||
/* Else we have to copy the data into our private image, */
|
||||
/* if we have one... */
|
||||
|
@ -1324,8 +1325,11 @@ gst_ximagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
if (!gst_buffer_pool_set_active (ximagesink->pool, TRUE))
|
||||
goto activate_failed;
|
||||
|
||||
/* take a buffer from our pool */
|
||||
res = gst_buffer_pool_acquire_buffer (ximagesink->pool, &to_put, NULL);
|
||||
/* take a buffer from our pool, if there is no buffer in the pool something
|
||||
* is seriously wrong, waiting for the pool here might deadlock when we try
|
||||
* to go to PAUSED because we never flush the pool. */
|
||||
params.flags = GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT;
|
||||
res = gst_buffer_pool_acquire_buffer (ximagesink->pool, &to_put, ¶ms);
|
||||
if (res != GST_FLOW_OK)
|
||||
goto no_buffer;
|
||||
|
||||
|
@ -1367,12 +1371,12 @@ no_buffer:
|
|||
{
|
||||
/* No image available. That's very bad ! */
|
||||
GST_WARNING_OBJECT (ximagesink, "could not create image");
|
||||
return res;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
invalid_buffer:
|
||||
{
|
||||
/* No Window available to put our image into */
|
||||
GST_WARNING_OBJECT (ximagesink, "could map image");
|
||||
GST_WARNING_OBJECT (ximagesink, "could not map image");
|
||||
res = GST_FLOW_OK;
|
||||
goto done;
|
||||
}
|
||||
|
|
|
@ -1831,6 +1831,7 @@ gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
res = GST_FLOW_OK;
|
||||
} else {
|
||||
GstVideoFrame src, dest;
|
||||
GstBufferPoolAcquireParams params = { 0, };
|
||||
|
||||
/* Else we have to copy the data into our private image, */
|
||||
/* if we have one... */
|
||||
|
@ -1843,8 +1844,11 @@ gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
if (!gst_buffer_pool_set_active (xvimagesink->pool, TRUE))
|
||||
goto activate_failed;
|
||||
|
||||
/* take a buffer from our pool */
|
||||
res = gst_buffer_pool_acquire_buffer (xvimagesink->pool, &to_put, NULL);
|
||||
/* take a buffer from our pool, if there is no buffer in the pool something
|
||||
* is seriously wrong, waiting for the pool here might deadlock when we try
|
||||
* to go to PAUSED because we never flush the pool then. */
|
||||
params.flags = GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT;
|
||||
res = gst_buffer_pool_acquire_buffer (xvimagesink->pool, &to_put, ¶ms);
|
||||
if (res != GST_FLOW_OK)
|
||||
goto no_buffer;
|
||||
|
||||
|
@ -1886,12 +1890,12 @@ no_buffer:
|
|||
{
|
||||
/* No image available. That's very bad ! */
|
||||
GST_WARNING_OBJECT (xvimagesink, "could not create image");
|
||||
return res;
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
invalid_buffer:
|
||||
{
|
||||
/* No Window available to put our image into */
|
||||
GST_WARNING_OBJECT (xvimagesink, "could map image");
|
||||
GST_WARNING_OBJECT (xvimagesink, "could not map image");
|
||||
res = GST_FLOW_OK;
|
||||
goto done;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue