glupload: always release the previous buffer

Fixes the case where _perform_with_buffer() is called without
intervening calls to _release_buffer() as is the case on start up
with glimagesink.

Also release the buffer when reseting the upload.

https://bugzilla.gnome.org/show_bug.cgi?id=731107
This commit is contained in:
Matthew Waters 2014-06-03 13:59:51 +10:00
parent e72f0eadd8
commit 59088f5a90

View file

@ -65,6 +65,7 @@ struct _GstGLUploadPrivate
GstVideoGLTextureUploadMeta *meta;
GstBuffer *outbuf;
gboolean released;
};
GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
@ -161,6 +162,8 @@ gst_gl_upload_reset (GstGLUpload * upload)
upload->in_tex[i] = NULL;
}
}
gst_gl_upload_release_buffer (upload);
}
static void
@ -241,6 +244,8 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
g_return_val_if_fail (tex_id != NULL, FALSE);
g_return_val_if_fail (gst_buffer_n_memory (buffer) > 0, FALSE);
gst_gl_upload_release_buffer (upload);
/* GstGLMemory */
mem = gst_buffer_peek_memory (buffer, 0);
@ -330,6 +335,8 @@ gst_gl_upload_release_buffer (GstGLUpload * upload)
gst_buffer_unref (upload->priv->outbuf);
upload->priv->outbuf = NULL;
}
upload->priv->released = TRUE;
}
/*
@ -539,6 +546,7 @@ _upload_memory (GstGLUpload * upload)
upload->out_tex->tex_id = *(guint *) out_frame.data[0];
gst_video_frame_unmap (&out_frame);
upload->priv->released = FALSE;
return TRUE;
}