summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2014-01-10 20:44:00 +0000
committerRobert Bragg <robert@linux.intel.com>2014-02-20 18:15:11 +0000
commitbd6d2b1e559e4b1940ade80e37d39cb940de73f8 (patch)
tree78616e89d75a5b5db019c112c6775c23f9a1e499
parent55c82476a93366a3e7d1a2537fccc3a7aab87c66 (diff)
downloadcogl-bd6d2b1e559e4b1940ade80e37d39cb940de73f8.tar.gz
cogl-gst: allocate textures synchronously
This makes sure video textures being uploaded via video_texture_new_from_data are allocated before the function returns. This function create a CoglBitmap to wrap the data from gstreamer and by allowing cogl to allocate the texture lazily it's possible that the data being pointed to by the bitmap won't remain valid until we actually come to allocate the texture.
-rw-r--r--cogl-gst/cogl-gst-video-sink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 9a8eaceb..5db660f1 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -455,7 +455,8 @@ video_texture_new_from_data (CoglContext *ctx,
cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC))
{
tex = cogl_texture_2d_new_from_bitmap (bitmap);
- if (!tex)
+
+ if (!cogl_texture_allocate (tex, &internal_error))
{
cogl_error_free (internal_error);
internal_error = NULL;
@@ -469,6 +470,7 @@ video_texture_new_from_data (CoglContext *ctx,
/* Otherwise create a sliced texture */
tex = cogl_texture_2d_sliced_new_from_bitmap (bitmap,
-1); /* no maximum waste */
+ cogl_texture_allocate (tex, NULL);
}
cogl_object_unref (bitmap);