if (size1 == 0)
return GST_VALUE_EQUAL;
- g_assert (gst_buffer_map (buf1, &info1, GST_MAP_READ));
- g_assert (gst_buffer_map (buf2, &info2, GST_MAP_READ));
+ if (!gst_buffer_map (buf1, &info1, GST_MAP_READ))
+ return GST_VALUE_UNORDERED;
+
+ if (!gst_buffer_map (buf2, &info2, GST_MAP_READ)) {
+ gst_buffer_unmap (buf1, &info2);
+ return GST_VALUE_UNORDERED;
+ }
if (memcmp (info1.data, info2.data, info1.size) == 0)
result = GST_VALUE_EQUAL;
if (buffer == NULL)
return NULL;
- g_assert (gst_buffer_map (buffer, &info, GST_MAP_READ));
+ if (!gst_buffer_map (buffer, &info, GST_MAP_READ))
+ return NULL;
+
data = info.data;
string = g_malloc (info.size * 2 + 1);
goto wrong_length;
buffer = gst_buffer_new_allocate (NULL, len / 2, 0);
- g_assert (gst_buffer_map (buffer, &info, GST_MAP_WRITE));
+ if (!gst_buffer_map (buffer, &info, GST_MAP_WRITE))
+ goto map_failed;
data = info.data;
for (i = 0; i < len / 2; i++) {
{
return FALSE;
}
+map_failed:
+ {
+ return FALSE;
+ }
wrong_char:
{
gst_buffer_unref (buffer);
csize = gst_buffer_get_size (cur);
if (csize >= size + skip) {
- g_assert (gst_buffer_map (cur, &priv->info, GST_MAP_READ));
+ if (!gst_buffer_map (cur, &priv->info, GST_MAP_READ))
+ return FALSE;
+
return (guint8 *) priv->info.data + skip;
}
/* We may be able to efficiently merge buffers in our pool to
bsize = gst_buffer_get_size (buf);
}
/* get the data now */
- g_assert (gst_buffer_map (buf, &info, GST_MAP_READ));
+ if (!gst_buffer_map (buf, &info, GST_MAP_READ))
+ return -1;
bdata = (guint8 *) info.data + skip;
bsize = info.size - skip;
* with subbuffers of the same buffer. Note that because of the FIXME in
* prepare_output_buffer() we have decreased the refcounts of inbuf and
* outbuf to keep them writable */
- g_assert (gst_buffer_map (inbuf, &ininfo, GST_MAP_READ));
- g_assert (gst_buffer_map (*outbuf, &outinfo, GST_MAP_WRITE));
+ if (gst_buffer_map (inbuf, &ininfo, GST_MAP_READ)) {
+ if (gst_buffer_map (*outbuf, &outinfo, GST_MAP_WRITE)) {
- if (ininfo.data != outinfo.data)
- memcpy (outinfo.data, ininfo.data, ininfo.size);
+ if (ininfo.data != outinfo.data)
+ memcpy (outinfo.data, ininfo.data, ininfo.size);
- gst_buffer_unmap (inbuf, &ininfo);
- gst_buffer_unmap (*outbuf, &outinfo);
+ gst_buffer_unmap (*outbuf, &outinfo);
+ }
+ gst_buffer_unmap (inbuf, &ininfo);
+ }
}
ret = bclass->transform_ip (trans, *outbuf);
} else {
if (buf_offset <= offset) {
if ((offset + size) < (buf_offset + buf_size)) {
/* FIXME, unmap after usage */
- g_assert (gst_buffer_map (buf, &info, GST_MAP_READ));
-
+ if (!gst_buffer_map (buf, &info, GST_MAP_READ))
+ return NULL;
return (guint8 *) info.data + (offset - buf_offset);
}
} else if (offset + size >= buf_offset + buf_size) {
}
/* FIXME, unmap */
- g_assert (gst_buffer_map (buffer, &info, GST_MAP_READ));
+ gst_buffer_map (buffer, &info, GST_MAP_READ);
+
return info.data;
error:
g_return_val_if_fail (GST_BUFFER_OFFSET (buf) == 0 ||
GST_BUFFER_OFFSET (buf) == GST_BUFFER_OFFSET_NONE, NULL);
- g_assert (gst_buffer_map (buf, &info, GST_MAP_READ));
+ if (!gst_buffer_map (buf, &info, GST_MAP_READ))
+ return NULL;
result = gst_type_find_helper_for_data (obj, info.data, info.size, prob);
gst_buffer_unmap (buf, &info);