basesrc: handle map failure

This commit is contained in:
Wim Taymans 2013-01-14 17:00:46 +01:00
parent bac5ba632e
commit 27832606e5

View file

@ -2376,7 +2376,9 @@ again:
GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, src, "create function didn't "
"fill the provided buffer, copying");
gst_buffer_map (in_buf, &info, GST_MAP_WRITE);
if (!gst_buffer_map (in_buf, &info, GST_MAP_WRITE))
goto map_failed;
copied_size = gst_buffer_extract (res_buf, 0, info.data, info.size);
gst_buffer_unmap (in_buf, &info);
gst_buffer_set_size (in_buf, copied_size);
@ -2460,6 +2462,15 @@ not_ok:
gst_flow_get_name (ret));
return ret;
}
map_failed:
{
GST_ELEMENT_ERROR (src, RESOURCE, BUSY,
(_("Failed to map buffer.")),
("failed to map result buffer in WRITE mode"));
if (*buf == NULL)
gst_buffer_unref (res_buf);
return GST_FLOW_ERROR;
}
not_started:
{
GST_DEBUG_OBJECT (src, "getrange but not started");