bayer2rgb: Protect against failing map

This commit is contained in:
Nicolas Dufresne 2015-08-06 18:04:41 -04:00
parent be1e9daff5
commit 7d6fd42726

View file

@ -462,14 +462,25 @@ gst_bayer2rgb_transform (GstBaseTransform * base, GstBuffer * inbuf,
GstVideoFrame frame; GstVideoFrame frame;
GST_DEBUG ("transforming buffer"); 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); output = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
gst_bayer2rgb_process (filter, output, filter->width * 4, gst_bayer2rgb_process (filter, output, filter->width * 4,
map.data, filter->width); map.data, filter->width);
gst_video_frame_unmap (&frame); gst_video_frame_unmap (&frame);
gst_buffer_unmap (inbuf, &map); gst_buffer_unmap (inbuf, &map);
return GST_FLOW_OK; return GST_FLOW_OK;
map_failed:
GST_WARNING_OBJECT (base, "Could not map buffer, skipping");
return GST_FLOW_OK;
} }