summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Isorce <julien.isorce@collabora.co.uk>2014-03-25 17:16:31 +0000
committerJosep Torra <n770galaxy@gmail.com>2014-03-28 09:25:33 +0100
commit3cc923a3da43512fe9cfe7ac2f4ab06ac263bf83 (patch)
tree551f7ea3236561afa3cd90665e146291aa04e14b
parent4c8c3a3fc4c9b252231ab5faa8325e2c9ce2e824 (diff)
testegl: keep a ref on the buffer instead of the memorydrain
Like in eglglessink https://bugzilla.gnome.org/show_bug.cgi?id=726107
-rw-r--r--examples/egl/testegl.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/examples/egl/testegl.c b/examples/egl/testegl.c
index baa12e8..73d4374 100644
--- a/examples/egl/testegl.c
+++ b/examples/egl/testegl.c
@@ -173,7 +173,7 @@ typedef struct
GCond *cond;
gboolean flushing;
GstMiniObject *popped_obj;
- GstMemory *current_mem;
+ GstBuffer *current_buffer;
GstBufferPool *pool;
/* GLib mainloop */
@@ -553,8 +553,7 @@ gst_custom_egl_image_buffer_pool_acquire_buffer (GstBufferPool * bpool,
/* XXX: Don't return the memory we just rendered, glEGLImageTargetTexture2DOES()
* keeps the EGLImage unmappable until the next one is uploaded
*/
- if (*buffer
- && gst_buffer_peek_memory (*buffer, 0) == pool->state->current_mem) {
+ if (*buffer && *buffer == pool->state->current_buffer) {
GstBuffer *oldbuf = *buffer;
ret =
@@ -977,12 +976,14 @@ render_scene (APP_STATE_T * state)
static void
update_image (APP_STATE_T * state, GstBuffer * buffer)
{
- GstMemory *mem = gst_buffer_peek_memory (buffer, 0);
+ GstMemory *mem = NULL;
- if (state->current_mem) {
- gst_memory_unref (state->current_mem);
+ if (state->current_buffer) {
+ gst_buffer_unref (state->current_buffer);
}
- state->current_mem = gst_memory_ref (mem);
+ state->current_buffer = gst_buffer_ref (buffer);
+
+ mem = gst_buffer_peek_memory (buffer, 0);
TRACE_VC_MEMORY_ONCE_FOR_ID ("before glEGLImageTargetTexture2DOES", gid0);
@@ -1022,10 +1023,10 @@ terminate_intercom (APP_STATE_T * state)
static void
flush_internal (APP_STATE_T * state)
{
- if (state->current_mem) {
- gst_memory_unref (state->current_mem);
+ if (state->current_buffer) {
+ gst_buffer_unref (state->current_buffer);
}
- state->current_mem = NULL;
+ state->current_buffer = NULL;
}
static void
@@ -1727,6 +1728,7 @@ main (int argc, char **argv)
/* Clear application state */
memset (state, 0, sizeof (*state));
state->animate = TRUE;
+ state->current_buffer = NULL;
/* must initialise the threading system before using any other GLib funtion */
if (!g_thread_supported ())