diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-06-01 21:24:27 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-06-01 21:25:13 +0200 |
commit | 7709bf5f2a5f8cc363b42be5e652aef3ad850d9d (patch) | |
tree | b28acacbd40fc9f529783af3c05858a8abdcac32 /gst/shapewipe | |
parent | 7f1c2f3a28f69d6768ccdb0432ccbba1e3188655 (diff) | |
download | gst-plugins-bad-7709bf5f2a5f8cc363b42be5e652aef3ad850d9d.tar.gz gst-plugins-bad-7709bf5f2a5f8cc363b42be5e652aef3ad850d9d.tar.bz2 gst-plugins-bad-7709bf5f2a5f8cc363b42be5e652aef3ad850d9d.zip |
shapewipe: Fix some issues that were exposed by the new unit test
Diffstat (limited to 'gst/shapewipe')
-rw-r--r-- | gst/shapewipe/gstshapewipe.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gst/shapewipe/gstshapewipe.c b/gst/shapewipe/gstshapewipe.c index e09d0fcc..c2c4ce2b 100644 --- a/gst/shapewipe/gstshapewipe.c +++ b/gst/shapewipe/gstshapewipe.c @@ -592,7 +592,7 @@ gst_shape_wipe_blend_16 (GstShapeWipe * self, GstBuffer * inbuf, for (i = 0; i < self->height; i++) { for (j = 0; j < self->width; j++) { - gfloat in = *mask / 65535.0f; + gfloat in = *mask / 65536.0f; if (in < low) { output[0] = 0x00; /* A */ @@ -648,7 +648,7 @@ gst_shape_wipe_blend_8 (GstShapeWipe * self, GstBuffer * inbuf, for (i = 0; i < self->height; i++) { for (j = 0; j < self->width; j++) { - gfloat in = *mask / 255.0f; + gfloat in = *mask / 256.0f; if (in < low) { output[0] = 0x00; /* A */ @@ -699,26 +699,26 @@ gst_shape_wipe_video_sink_chain (GstPad * pad, GstBuffer * buffer) GST_TIME_ARGS (timestamp), self->mask_position); g_mutex_lock (self->mask_mutex); - mask = self->mask; - if (self->mask) - gst_buffer_ref (self->mask); - else + if (!self->mask) g_cond_wait (self->mask_cond, self->mask_mutex); if (self->mask == NULL) { g_mutex_unlock (self->mask_mutex); + gst_buffer_unref (buffer); return GST_FLOW_UNEXPECTED; + } else { + mask = gst_buffer_ref (self->mask); } - - mask = gst_buffer_ref (self->mask); - g_mutex_unlock (self->mask_mutex); ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad, GST_BUFFER_OFFSET_NONE, GST_BUFFER_SIZE (buffer), GST_PAD_CAPS (self->srcpad), &outbuf); - if (G_UNLIKELY (ret != GST_FLOW_OK)) + if (G_UNLIKELY (ret != GST_FLOW_OK)) { + gst_buffer_unref (buffer); + gst_buffer_unref (mask); return ret; + } if (self->mask_bpp == 16) ret = gst_shape_wipe_blend_16 (self, buffer, mask, outbuf); @@ -749,6 +749,8 @@ gst_shape_wipe_mask_sink_chain (GstPad * pad, GstBuffer * buffer) g_cond_signal (self->mask_cond); g_mutex_unlock (self->mask_mutex); + gst_buffer_unref (buffer); + return ret; } |