mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
don't do logic in g_assert...
This commit is contained in:
parent
4deaf9b8be
commit
39c5f0b28a
4 changed files with 35 additions and 16 deletions
|
@ -1883,8 +1883,13 @@ gst_value_compare_buffer (const GValue * value1, const GValue * value2)
|
|||
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;
|
||||
|
@ -1908,7 +1913,9 @@ gst_value_serialize_buffer (const GValue * value)
|
|||
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);
|
||||
|
@ -1937,7 +1944,8 @@ gst_value_deserialize_buffer (GValue * dest, const gchar * s)
|
|||
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++) {
|
||||
|
@ -1961,6 +1969,10 @@ wrong_length:
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
map_failed:
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
wrong_char:
|
||||
{
|
||||
gst_buffer_unref (buffer);
|
||||
|
|
|
@ -446,7 +446,9 @@ gst_adapter_map (GstAdapter * adapter, gsize size)
|
|||
|
||||
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
|
||||
|
@ -998,7 +1000,8 @@ gst_adapter_masked_scan_uint32_peek (GstAdapter * adapter, guint32 mask,
|
|||
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;
|
||||
|
|
|
@ -1888,14 +1888,16 @@ no_qos:
|
|||
* 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 {
|
||||
|
|
|
@ -115,8 +115,8 @@ helper_find_peek (gpointer data, gint64 offset, guint size)
|
|||
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) {
|
||||
|
@ -180,7 +180,8 @@ helper_find_peek (gpointer data, gint64 offset, guint 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:
|
||||
|
@ -570,7 +571,8 @@ gst_type_find_helper_for_buffer (GstObject * obj, GstBuffer * buf,
|
|||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue