summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-05-24 16:28:21 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-08-30 10:59:30 +0200
commitd2f7e21ab9be7f3d543a50b6cbac6dffca33384a (patch)
tree82f4c9a959de7ee4ab98f7b64c62718f0c6e6a59
parent3b92b225540c861131fad96730d4546460c2ede6 (diff)
downloadgst-omx-d2f7e21ab9be7f3d543a50b6cbac6dffca33384a.tar.gz
omx: call gst_omx_buffer_unmap() when handling BUFFER_DONE
When using a input buffer pool, the buffer may be released to the pool when gst_omx_buffer_unmap() is called. We need to have buf->used unset at this point as the pool may use it to check the status of the pool. {Empty,Fill}BufferDone is called from OMX internal threads while messages are handled from gst elements' thread. Best to do all this when handling the message so we don't mess with OMX threads and keep the original thread/logic split. https://bugzilla.gnome.org/show_bug.cgi?id=796918
-rw-r--r--omx/gstomx.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c
index f7a548f..0acf413 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -247,6 +247,8 @@ gst_omx_buffer_reset (GstOMXBuffer * buf)
GST_OMX_SET_TICKS (buf->omx_buf->nTimeStamp, G_GUINT64_CONSTANT (0));
}
+static void gst_omx_buffer_unmap (GstOMXBuffer * buffer);
+
/* NOTE: Call with comp->lock, comp->messages_lock will be used */
static void
gst_omx_component_handle_messages (GstOMXComponent * comp)
@@ -388,6 +390,8 @@ gst_omx_component_handle_messages (GstOMXComponent * comp)
port = buf->port;
+ buf->used = FALSE;
+
if (msg->content.buffer_done.empty) {
/* Input buffer is empty again and can be used to contain new input */
GST_LOG_OBJECT (port->comp->parent,
@@ -399,6 +403,9 @@ gst_omx_component_handle_messages (GstOMXComponent * comp)
* valid anymore after the buffer was consumed
*/
gst_omx_buffer_reset (buf);
+
+ /* Release and unmap the parent buffer, if any */
+ gst_omx_buffer_unmap (buf);
} else {
/* Output buffer contains output now or
* the port was flushed */
@@ -411,8 +418,6 @@ gst_omx_component_handle_messages (GstOMXComponent * comp)
port->eos = TRUE;
}
- buf->used = FALSE;
-
g_queue_push_tail (&port->pending_buffers, buf);
break;
@@ -710,9 +715,6 @@ EmptyBufferDone (OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
return OMX_ErrorBadParameter;
}
- /* Release and unmap the parent buffer, if any */
- gst_omx_buffer_unmap (buf);
-
comp = buf->port->comp;
msg = g_slice_new (GstOMXMessage);