summaryrefslogtreecommitdiff
path: root/gst/bayer
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2015-08-06 18:11:53 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2015-08-06 18:11:53 -0400
commit97a0d9d72dfd39bf123d4d82604fee3bd0c03a8e (patch)
treeecf5688b5c0cad278d5b12454b3af3d3ca78813c /gst/bayer
parent6bd93bd7e5b68294bcb305cd01355477f804b316 (diff)
downloadgstreamer-plugins-bad-97a0d9d72dfd39bf123d4d82604fee3bd0c03a8e.tar.gz
rgb2bayer: Protect against failing map
Diffstat (limited to 'gst/bayer')
-rw-r--r--gst/bayer/gstrgb2bayer.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gst/bayer/gstrgb2bayer.c b/gst/bayer/gstrgb2bayer.c
index 5da9b4784..f42a641a3 100644
--- a/gst/bayer/gstrgb2bayer.c
+++ b/gst/bayer/gstrgb2bayer.c
@@ -243,9 +243,14 @@ gst_rgb2bayer_transform (GstBaseTransform * trans, GstBuffer * inbuf,
int width = rgb2bayer->width;
GstVideoFrame frame;
- gst_video_frame_map (&frame, &rgb2bayer->info, inbuf, GST_MAP_READ);
+ if (!gst_video_frame_map (&frame, &rgb2bayer->info, inbuf, GST_MAP_READ))
+ goto map_failed;
+
+ if (!gst_buffer_map (outbuf, &map, GST_MAP_READ)) {
+ gst_video_frame_unmap (&frame);
+ goto map_failed;
+ }
- gst_buffer_map (outbuf, &map, GST_MAP_READ);
dest = map.data;
src = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
@@ -264,8 +269,13 @@ gst_rgb2bayer_transform (GstBaseTransform * trans, GstBuffer * inbuf,
}
}
}
+
gst_buffer_unmap (outbuf, &map);
gst_video_frame_unmap (&frame);
return GST_FLOW_OK;
+
+map_failed:
+ GST_WARNING_OBJECT (trans, "Could not map buffer, skipping");
+ return GST_FLOW_OK;
}