diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-08-06 18:04:41 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-08-06 18:04:41 -0400 |
commit | 7d6fd42726a9e1f2705ee21bbc756cdd16460750 (patch) | |
tree | fcd86000f05ee85e5d71ee2604ab2d8f2ad5a9c5 /gst/bayer | |
parent | be1e9daff585fd0d297231797b2719a56b8b4891 (diff) |
bayer2rgb: Protect against failing map
Diffstat (limited to 'gst/bayer')
-rw-r--r-- | gst/bayer/gstbayer2rgb.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gst/bayer/gstbayer2rgb.c b/gst/bayer/gstbayer2rgb.c index 036ac2a86..edeb6bf26 100644 --- a/gst/bayer/gstbayer2rgb.c +++ b/gst/bayer/gstbayer2rgb.c @@ -462,14 +462,25 @@ gst_bayer2rgb_transform (GstBaseTransform * base, GstBuffer * inbuf, GstVideoFrame frame; GST_DEBUG ("transforming buffer"); - gst_buffer_map (inbuf, &map, GST_MAP_READ); - gst_video_frame_map (&frame, &filter->info, outbuf, GST_MAP_WRITE); + + if (!gst_buffer_map (inbuf, &map, GST_MAP_READ)) + goto map_failed; + + if (!gst_video_frame_map (&frame, &filter->info, outbuf, GST_MAP_WRITE)) { + gst_buffer_unmap (inbuf, &map); + goto map_failed; + } output = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0); gst_bayer2rgb_process (filter, output, filter->width * 4, map.data, filter->width); + gst_video_frame_unmap (&frame); gst_buffer_unmap (inbuf, &map); return GST_FLOW_OK; + +map_failed: + GST_WARNING_OBJECT (base, "Could not map buffer, skipping"); + return GST_FLOW_OK; } |