mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
rgb2bayer: Protect against failing map
This commit is contained in:
parent
6bd93bd7e5
commit
97a0d9d72d
1 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue