mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
adapter: remove flush from _unmap
This commit is contained in:
parent
54a9c5d3f8
commit
4b216bf73a
5 changed files with 12 additions and 16 deletions
|
@ -62,7 +62,8 @@
|
|||
* const guint8 *data = gst_adapter_map (adapter, 512);
|
||||
* // use flowreturn as an error value
|
||||
* ret = my_library_foo (data);
|
||||
* gst_adapter_unmap (adapter, 512);
|
||||
* gst_adapter_unmap (adapter);
|
||||
* gst_adapter_flush (adapter, 512);
|
||||
* }
|
||||
*
|
||||
* gst_object_unref (this);
|
||||
|
@ -478,13 +479,11 @@ gst_adapter_map (GstAdapter * adapter, gsize size)
|
|||
/**
|
||||
* gst_adapter_unmap:
|
||||
* @adapter: a #GstAdapter
|
||||
* @flush: the amount of bytes to flush
|
||||
*
|
||||
* Releases the memory obtained with the last gst_adapter_map() and flushes
|
||||
* @size bytes from the adapter.
|
||||
* Releases the memory obtained with the last gst_adapter_map().
|
||||
*/
|
||||
void
|
||||
gst_adapter_unmap (GstAdapter * adapter, gsize flush)
|
||||
gst_adapter_unmap (GstAdapter * adapter)
|
||||
{
|
||||
g_return_if_fail (GST_IS_ADAPTER (adapter));
|
||||
|
||||
|
@ -493,9 +492,6 @@ gst_adapter_unmap (GstAdapter * adapter, gsize flush)
|
|||
gst_buffer_unmap (cur, adapter->priv->cdata, adapter->priv->csize);
|
||||
adapter->priv->cdata = NULL;
|
||||
}
|
||||
|
||||
if (flush)
|
||||
gst_adapter_flush_unchecked (adapter, flush);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,7 +80,7 @@ GstAdapter * gst_adapter_new (void);
|
|||
void gst_adapter_clear (GstAdapter *adapter);
|
||||
void gst_adapter_push (GstAdapter *adapter, GstBuffer* buf);
|
||||
const gpointer gst_adapter_map (GstAdapter *adapter, gsize size);
|
||||
void gst_adapter_unmap (GstAdapter *adapter, gsize flush);
|
||||
void gst_adapter_unmap (GstAdapter *adapter);
|
||||
void gst_adapter_copy (GstAdapter *adapter, gpointer dest,
|
||||
gsize offset, gsize size);
|
||||
void gst_adapter_flush (GstAdapter *adapter, gsize flush);
|
||||
|
|
|
@ -2383,7 +2383,7 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||
skip = -1;
|
||||
gst_base_parse_frame_update (parse, frame, tmpbuf);
|
||||
res = bclass->check_valid_frame (parse, frame, &fsize, &skip);
|
||||
gst_adapter_unmap (parse->priv->adapter, 0);
|
||||
gst_adapter_unmap (parse->priv->adapter);
|
||||
gst_buffer_replace (&frame->buffer, NULL);
|
||||
gst_buffer_remove_memory_range (tmpbuf, 0, -1);
|
||||
if (res) {
|
||||
|
|
|
@ -795,7 +795,7 @@ gst_type_find_element_chain_do_typefinding (GstTypeFindElement * typefind,
|
|||
data = gst_adapter_map (typefind->adapter, avail);
|
||||
caps = gst_type_find_helper_for_data (GST_OBJECT (typefind),
|
||||
data, avail, &probability);
|
||||
gst_adapter_unmap (typefind->adapter, 0);
|
||||
gst_adapter_unmap (typefind->adapter);
|
||||
|
||||
if (caps == NULL && have_max)
|
||||
goto no_type_found;
|
||||
|
|
|
@ -69,13 +69,13 @@ GST_START_TEST (test_peek1)
|
|||
fail_if (data1 == NULL);
|
||||
/* it should point to the buffer data as well */
|
||||
fail_if (data1 != bufdata);
|
||||
gst_adapter_unmap (adapter, 0);
|
||||
gst_adapter_unmap (adapter);
|
||||
|
||||
data2 = gst_adapter_map (adapter, 512);
|
||||
fail_if (data2 == NULL);
|
||||
/* second peek should return the same pointer */
|
||||
fail_if (data2 != data1);
|
||||
gst_adapter_unmap (adapter, 0);
|
||||
gst_adapter_unmap (adapter);
|
||||
|
||||
/* this should fail since we don't have that many bytes */
|
||||
ASSERT_CRITICAL (gst_adapter_flush (adapter, 513));
|
||||
|
@ -99,7 +99,7 @@ GST_START_TEST (test_peek1)
|
|||
/* peek should return the same old pointer + 10 */
|
||||
fail_if (data2 != data1 + 10);
|
||||
fail_if (data2 != bufdata + 10);
|
||||
gst_adapter_unmap (adapter, 0);
|
||||
gst_adapter_unmap (adapter);
|
||||
|
||||
/* flush some more */
|
||||
gst_adapter_flush (adapter, 500);
|
||||
|
@ -114,7 +114,7 @@ GST_START_TEST (test_peek1)
|
|||
fail_if (data2 == NULL);
|
||||
fail_if (data2 != data1 + 510);
|
||||
fail_if (data2 != bufdata + 510);
|
||||
gst_adapter_unmap (adapter, 0);
|
||||
gst_adapter_unmap (adapter);
|
||||
|
||||
/* flush some more */
|
||||
gst_adapter_flush (adapter, 2);
|
||||
|
@ -541,7 +541,7 @@ GST_START_TEST (test_timestamp)
|
|||
/* remove empty buffer, timestamp still visible */
|
||||
cdata = gst_adapter_map (adapter, 50);
|
||||
fail_unless (cdata != NULL);
|
||||
gst_adapter_unmap (adapter, 0);
|
||||
gst_adapter_unmap (adapter);
|
||||
|
||||
data = gst_adapter_take (adapter, 50);
|
||||
fail_unless (data != NULL);
|
||||
|
|
Loading…
Reference in a new issue