From 27832606e5fd4e7b19da3bcc6679dc29d4aaba41 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 14 Jan 2013 17:00:46 +0100 Subject: [PATCH] basesrc: handle map failure --- libs/gst/base/gstbasesrc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 70578b4..acc665f 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -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"); -- 2.7.4