2006-05-04 14:19:53 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* unit test for adapter
|
|
|
|
*
|
|
|
|
* Copyright (C) <2005> Wim Taymans <wim at fluendo dot com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2006-05-04 14:19:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gst/check/gstcheck.h>
|
|
|
|
|
|
|
|
#include <gst/base/gstadapter.h>
|
|
|
|
|
|
|
|
/* does some implementation dependent checking that should
|
|
|
|
* also be optimal
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Start peeking on an adapter with 1 buffer pushed.
|
|
|
|
*/
|
|
|
|
GST_START_TEST (test_peek1)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
guint avail;
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info;
|
2012-01-27 11:50:24 +00:00
|
|
|
const guint8 *data1, *data2, *idata;
|
2006-05-04 14:19:53 +00:00
|
|
|
|
|
|
|
adapter = gst_adapter_new ();
|
|
|
|
fail_if (adapter == NULL);
|
|
|
|
|
|
|
|
/* push single buffer in adapter */
|
|
|
|
buffer = gst_buffer_new_and_alloc (512);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_READ));
|
2012-01-27 11:50:24 +00:00
|
|
|
idata = info.data;
|
|
|
|
gst_buffer_unmap (buffer, &info);
|
2006-05-04 14:19:53 +00:00
|
|
|
|
|
|
|
fail_if (buffer == NULL);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
/* available and available_fast should return the size of the
|
|
|
|
* buffer */
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_if (avail != 512);
|
|
|
|
avail = gst_adapter_available_fast (adapter);
|
|
|
|
fail_if (avail != 512);
|
|
|
|
|
|
|
|
/* should g_critical with NULL as result */
|
2011-03-22 19:51:06 +00:00
|
|
|
ASSERT_CRITICAL (data1 = gst_adapter_map (adapter, 0));
|
2006-05-04 14:19:53 +00:00
|
|
|
fail_if (data1 != NULL);
|
|
|
|
|
|
|
|
/* should return NULL as result */
|
2011-03-22 19:51:06 +00:00
|
|
|
data1 = gst_adapter_map (adapter, 513);
|
2006-05-04 14:19:53 +00:00
|
|
|
fail_if (data1 != NULL);
|
|
|
|
|
|
|
|
/* this should work */
|
2011-03-22 19:51:06 +00:00
|
|
|
data1 = gst_adapter_map (adapter, 512);
|
2006-05-04 14:19:53 +00:00
|
|
|
fail_if (data1 == NULL);
|
|
|
|
/* it should point to the buffer data as well */
|
2012-01-27 11:50:24 +00:00
|
|
|
fail_if (data1 != idata);
|
2011-11-10 17:18:24 +00:00
|
|
|
gst_adapter_unmap (adapter);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
|
|
|
data2 = gst_adapter_map (adapter, 512);
|
2006-05-04 14:19:53 +00:00
|
|
|
fail_if (data2 == NULL);
|
|
|
|
/* second peek should return the same pointer */
|
|
|
|
fail_if (data2 != data1);
|
2011-11-10 17:18:24 +00:00
|
|
|
gst_adapter_unmap (adapter);
|
2006-05-04 14:19:53 +00:00
|
|
|
|
|
|
|
/* this should fail since we don't have that many bytes */
|
|
|
|
ASSERT_CRITICAL (gst_adapter_flush (adapter, 513));
|
|
|
|
|
|
|
|
/* this should work fine */
|
|
|
|
gst_adapter_flush (adapter, 10);
|
|
|
|
|
|
|
|
/* see if we have 10 bytes less available */
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_if (avail != 502);
|
|
|
|
avail = gst_adapter_available_fast (adapter);
|
|
|
|
fail_if (avail != 502);
|
|
|
|
|
|
|
|
/* should return NULL as result */
|
2011-03-22 19:51:06 +00:00
|
|
|
data2 = gst_adapter_map (adapter, 503);
|
2006-05-04 14:19:53 +00:00
|
|
|
fail_if (data2 != NULL);
|
|
|
|
|
|
|
|
/* should work fine */
|
2011-03-22 19:51:06 +00:00
|
|
|
data2 = gst_adapter_map (adapter, 502);
|
2006-05-04 14:19:53 +00:00
|
|
|
fail_if (data2 == NULL);
|
|
|
|
/* peek should return the same old pointer + 10 */
|
|
|
|
fail_if (data2 != data1 + 10);
|
2012-01-27 11:50:24 +00:00
|
|
|
fail_if (data2 != (guint8 *) idata + 10);
|
2011-11-10 17:18:24 +00:00
|
|
|
gst_adapter_unmap (adapter);
|
2006-05-04 14:19:53 +00:00
|
|
|
|
|
|
|
/* flush some more */
|
|
|
|
gst_adapter_flush (adapter, 500);
|
|
|
|
|
|
|
|
/* see if we have 2 bytes available */
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_if (avail != 2);
|
|
|
|
avail = gst_adapter_available_fast (adapter);
|
|
|
|
fail_if (avail != 2);
|
|
|
|
|
2011-03-22 19:51:06 +00:00
|
|
|
data2 = gst_adapter_map (adapter, 2);
|
2006-05-04 14:19:53 +00:00
|
|
|
fail_if (data2 == NULL);
|
|
|
|
fail_if (data2 != data1 + 510);
|
2012-01-27 11:50:24 +00:00
|
|
|
fail_if (data2 != (guint8 *) idata + 510);
|
2011-11-10 17:18:24 +00:00
|
|
|
gst_adapter_unmap (adapter);
|
2006-05-04 14:19:53 +00:00
|
|
|
|
|
|
|
/* flush some more */
|
|
|
|
gst_adapter_flush (adapter, 2);
|
|
|
|
|
|
|
|
/* see if we have 0 bytes available */
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_if (avail != 0);
|
|
|
|
avail = gst_adapter_available_fast (adapter);
|
|
|
|
fail_if (avail != 0);
|
|
|
|
|
|
|
|
/* silly clear just for fun */
|
|
|
|
gst_adapter_clear (adapter);
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* Start peeking on an adapter with 2 non-mergeable buffers
|
|
|
|
* pushed.
|
|
|
|
*/
|
|
|
|
GST_START_TEST (test_peek2)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* Start peeking on an adapter with 2 mergeable buffers
|
|
|
|
* pushed.
|
|
|
|
*/
|
|
|
|
GST_START_TEST (test_peek3)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* take data from an adapter with 1 buffer pushed.
|
|
|
|
*/
|
|
|
|
GST_START_TEST (test_take1)
|
|
|
|
{
|
2009-04-27 08:13:01 +00:00
|
|
|
GstAdapter *adapter;
|
|
|
|
GstBuffer *buffer, *buffer2;
|
|
|
|
guint avail;
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info, info2;
|
2009-04-27 08:13:01 +00:00
|
|
|
|
|
|
|
adapter = gst_adapter_new ();
|
|
|
|
fail_unless (adapter != NULL);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
|
|
|
fail_unless (buffer != NULL);
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_READ));
|
|
|
|
fail_unless (info.data != NULL);
|
|
|
|
fail_unless (info.size == 100);
|
2009-04-27 08:13:01 +00:00
|
|
|
|
|
|
|
/* push in the adapter */
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 100);
|
|
|
|
|
|
|
|
/* take out buffer */
|
|
|
|
buffer2 = gst_adapter_take_buffer (adapter, 100);
|
|
|
|
fail_unless (buffer2 != NULL);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buffer2, &info2, GST_MAP_READ));
|
|
|
|
fail_unless (info2.data != NULL);
|
|
|
|
fail_unless (info2.size == 100);
|
2009-04-27 08:13:01 +00:00
|
|
|
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 0);
|
|
|
|
|
|
|
|
/* the buffer should be the same */
|
|
|
|
fail_unless (buffer == buffer2);
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (info.data == info2.data);
|
2009-04-27 08:13:01 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buffer, &info);
|
|
|
|
gst_buffer_unmap (buffer2, &info2);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2009-04-27 08:13:01 +00:00
|
|
|
gst_buffer_unref (buffer2);
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
2006-05-04 14:19:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* take data from an adapter with 2 non-mergeable buffers
|
|
|
|
* pushed.
|
|
|
|
*/
|
|
|
|
GST_START_TEST (test_take2)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* take data from an adapter with 2 mergeable buffers
|
|
|
|
* pushed.
|
|
|
|
*/
|
|
|
|
GST_START_TEST (test_take3)
|
|
|
|
{
|
2010-05-27 13:10:34 +00:00
|
|
|
GstAdapter *adapter;
|
|
|
|
GstBuffer *buffer, *buffer2;
|
|
|
|
guint avail;
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info, info2;
|
2010-05-27 13:10:34 +00:00
|
|
|
|
|
|
|
adapter = gst_adapter_new ();
|
|
|
|
fail_unless (adapter != NULL);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
|
|
|
fail_unless (buffer != NULL);
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_READ));
|
|
|
|
fail_unless (info.data != NULL);
|
|
|
|
fail_unless (info.size == 100);
|
2012-01-27 11:50:24 +00:00
|
|
|
gst_buffer_unmap (buffer, &info);
|
2010-05-27 13:10:34 +00:00
|
|
|
|
|
|
|
/* set up and push subbuffers */
|
2011-03-30 14:47:55 +00:00
|
|
|
buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 0, 25);
|
2010-05-27 13:10:34 +00:00
|
|
|
gst_adapter_push (adapter, buffer2);
|
2011-03-30 14:47:55 +00:00
|
|
|
buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 25, 25);
|
2010-05-27 13:10:34 +00:00
|
|
|
gst_adapter_push (adapter, buffer2);
|
2011-03-30 14:47:55 +00:00
|
|
|
buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 50, 25);
|
2010-05-27 13:10:34 +00:00
|
|
|
gst_adapter_push (adapter, buffer2);
|
2011-03-30 14:47:55 +00:00
|
|
|
buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 75, 25);
|
2010-05-27 13:10:34 +00:00
|
|
|
gst_adapter_push (adapter, buffer2);
|
|
|
|
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 100);
|
|
|
|
|
|
|
|
/* take out buffer */
|
|
|
|
buffer2 = gst_adapter_take_buffer (adapter, 100);
|
|
|
|
fail_unless (buffer2 != NULL);
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buffer2, &info2, GST_MAP_READ));
|
|
|
|
fail_unless (info2.data != NULL);
|
|
|
|
fail_unless (info2.size == 100);
|
2010-05-27 13:10:34 +00:00
|
|
|
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 0);
|
|
|
|
|
2012-05-01 08:50:32 +00:00
|
|
|
#if 0
|
|
|
|
/* the data should be the same FIXME, implement span in adapter again. */
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (info.data == info2.data);
|
2012-05-01 08:50:32 +00:00
|
|
|
#endif
|
2010-05-27 13:10:34 +00:00
|
|
|
|
2012-01-27 11:50:24 +00:00
|
|
|
gst_buffer_unmap (buffer2, &info2);
|
2010-05-27 13:10:34 +00:00
|
|
|
gst_buffer_unref (buffer2);
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
2006-05-04 14:19:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
static GstAdapter *
|
2008-02-29 13:59:24 +00:00
|
|
|
create_and_fill_adapter (void)
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
gint i, j;
|
|
|
|
|
|
|
|
adapter = gst_adapter_new ();
|
|
|
|
fail_unless (adapter != NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < 10000; i += 4) {
|
2011-03-22 19:51:06 +00:00
|
|
|
GstBuffer *buf;
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info;
|
|
|
|
guint8 *ptr;
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
|
2011-03-22 19:51:06 +00:00
|
|
|
buf = gst_buffer_new_and_alloc (sizeof (guint32) * 4);
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
fail_unless (buf != NULL);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buf, &info, GST_MAP_WRITE));
|
|
|
|
ptr = info.data;
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
|
|
|
|
for (j = 0; j < 4; j++) {
|
2011-03-24 10:49:46 +00:00
|
|
|
GST_WRITE_UINT32_LE (ptr, i + j);
|
|
|
|
ptr += sizeof (guint32);
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
}
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buf, &info);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
gst_adapter_push (adapter, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return adapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fill a buffer with a sequence of 32 bit ints and read them back out,
|
|
|
|
* checking that they're still in the right order */
|
|
|
|
GST_START_TEST (test_take_order)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
adapter = create_and_fill_adapter ();
|
|
|
|
while (gst_adapter_available (adapter) >= sizeof (guint32)) {
|
|
|
|
guint8 *data = gst_adapter_take (adapter, sizeof (guint32));
|
2011-03-24 20:18:52 +00:00
|
|
|
guint32 val = GST_READ_UINT32_LE (data);
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
|
2011-03-24 20:18:52 +00:00
|
|
|
GST_DEBUG ("val %8u", val);
|
|
|
|
fail_unless (val == i);
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
i++;
|
|
|
|
g_free (data);
|
|
|
|
}
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 0,
|
|
|
|
"Data was left in the adapter");
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
/* Fill a buffer with a sequence of 32 bit ints and read them back out
|
|
|
|
* using take_buffer, checking that they're still in the right order */
|
|
|
|
GST_START_TEST (test_take_buf_order)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
adapter = create_and_fill_adapter ();
|
|
|
|
while (gst_adapter_available (adapter) >= sizeof (guint32)) {
|
|
|
|
GstBuffer *buf = gst_adapter_take_buffer (adapter, sizeof (guint32));
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info;
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buf, &info, GST_MAP_READ));
|
|
|
|
fail_unless (GST_READ_UINT32_LE (info.data) == i);
|
|
|
|
gst_buffer_unmap (buf, &info);
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 0,
|
|
|
|
"Data was left in the adapter");
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2009-05-13 14:48:38 +00:00
|
|
|
GST_START_TEST (test_timestamp)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
guint avail;
|
|
|
|
GstClockTime timestamp;
|
|
|
|
guint64 dist;
|
2010-09-17 10:40:12 +00:00
|
|
|
guint8 *data;
|
|
|
|
const guint8 *cdata;
|
2009-05-13 14:48:38 +00:00
|
|
|
|
|
|
|
adapter = gst_adapter_new ();
|
|
|
|
fail_unless (adapter != NULL);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
|
|
|
|
|
|
|
/* push in the adapter */
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 100);
|
|
|
|
|
|
|
|
/* timestamp is now undefined */
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == GST_CLOCK_TIME_NONE);
|
|
|
|
fail_unless (dist == 0);
|
|
|
|
|
|
|
|
gst_adapter_flush (adapter, 50);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 50);
|
|
|
|
|
|
|
|
/* still undefined, dist changed, though */
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == GST_CLOCK_TIME_NONE);
|
|
|
|
fail_unless (dist == 50);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = 1 * GST_SECOND;
|
|
|
|
|
|
|
|
/* push in the adapter */
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 150);
|
|
|
|
|
|
|
|
/* timestamp is still undefined */
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == GST_CLOCK_TIME_NONE);
|
|
|
|
fail_unless (dist == 50);
|
|
|
|
|
|
|
|
/* flush out first buffer we are now at the second buffer timestamp */
|
|
|
|
gst_adapter_flush (adapter, 50);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 100);
|
|
|
|
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == 1 * GST_SECOND);
|
|
|
|
fail_unless (dist == 0);
|
|
|
|
|
|
|
|
/* move some more, still the same timestamp but further away */
|
|
|
|
gst_adapter_flush (adapter, 50);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 50);
|
|
|
|
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == 1 * GST_SECOND);
|
|
|
|
fail_unless (dist == 50);
|
|
|
|
|
|
|
|
/* push a buffer without timestamp in the adapter */
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 150);
|
|
|
|
/* push a buffer with timestamp in the adapter */
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND;
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 250);
|
|
|
|
|
|
|
|
/* timestamp still as it was before the push */
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == 1 * GST_SECOND);
|
|
|
|
fail_unless (dist == 50);
|
|
|
|
|
|
|
|
/* flush away buffer with the timestamp */
|
|
|
|
gst_adapter_flush (adapter, 50);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 200);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == 1 * GST_SECOND);
|
|
|
|
fail_unless (dist == 100);
|
|
|
|
|
|
|
|
/* move into the second buffer */
|
|
|
|
gst_adapter_flush (adapter, 50);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 150);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == 1 * GST_SECOND);
|
|
|
|
fail_unless (dist == 150);
|
|
|
|
|
|
|
|
/* move to third buffer we move to the new timestamp */
|
|
|
|
gst_adapter_flush (adapter, 50);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 100);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == 2 * GST_SECOND);
|
|
|
|
fail_unless (dist == 0);
|
|
|
|
|
|
|
|
/* move everything out */
|
|
|
|
gst_adapter_flush (adapter, 100);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 0);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 14:48:38 +00:00
|
|
|
fail_unless (timestamp == 2 * GST_SECOND);
|
|
|
|
fail_unless (dist == 100);
|
|
|
|
|
2009-05-13 15:09:32 +00:00
|
|
|
/* clear everything */
|
|
|
|
gst_adapter_clear (adapter);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 0);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2009-05-13 15:09:32 +00:00
|
|
|
fail_unless (timestamp == GST_CLOCK_TIME_NONE);
|
|
|
|
fail_unless (dist == 0);
|
|
|
|
|
2010-09-17 10:40:12 +00:00
|
|
|
/* push an empty buffer with timestamp in the adapter */
|
|
|
|
buffer = gst_buffer_new ();
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = 2 * GST_SECOND;
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 0);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (timestamp == 2 * GST_SECOND);
|
|
|
|
fail_unless (dist == 0);
|
|
|
|
|
|
|
|
/* push another empty buffer */
|
|
|
|
buffer = gst_buffer_new ();
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = 3 * GST_SECOND;
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 0);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (timestamp == 2 * GST_SECOND);
|
|
|
|
fail_unless (dist == 0);
|
|
|
|
|
|
|
|
/* push a buffer with timestamp in the adapter */
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = 4 * GST_SECOND;
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 100);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (timestamp == 2 * GST_SECOND);
|
|
|
|
fail_unless (dist == 0);
|
|
|
|
|
|
|
|
gst_adapter_flush (adapter, 1);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 99);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (timestamp == 4 * GST_SECOND);
|
|
|
|
fail_unless (dist == 1);
|
|
|
|
|
|
|
|
/* push an empty buffer with timestamp in the adapter */
|
|
|
|
buffer = gst_buffer_new ();
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = 5 * GST_SECOND;
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 99);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (timestamp == 4 * GST_SECOND);
|
|
|
|
fail_unless (dist == 1);
|
|
|
|
|
|
|
|
/* push buffer without timestamp */
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 199);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (timestamp == 4 * GST_SECOND);
|
|
|
|
fail_unless (dist == 1);
|
|
|
|
|
|
|
|
/* remove first buffer, timestamp of empty buffer is visible */
|
|
|
|
buffer = gst_adapter_take_buffer (adapter, 99);
|
|
|
|
fail_unless (buffer != NULL);
|
2011-03-22 19:51:06 +00:00
|
|
|
fail_unless (gst_buffer_get_size (buffer) == 99);
|
2010-09-17 10:40:12 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 100);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (timestamp == 5 * GST_SECOND);
|
|
|
|
fail_unless (dist == 0);
|
|
|
|
|
|
|
|
/* remove empty buffer, timestamp still visible */
|
2011-03-22 19:51:06 +00:00
|
|
|
cdata = gst_adapter_map (adapter, 50);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (cdata != NULL);
|
2011-11-10 17:18:24 +00:00
|
|
|
gst_adapter_unmap (adapter);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2010-09-17 10:40:12 +00:00
|
|
|
data = gst_adapter_take (adapter, 50);
|
|
|
|
fail_unless (data != NULL);
|
|
|
|
g_free (data);
|
|
|
|
avail = gst_adapter_available (adapter);
|
|
|
|
fail_unless (avail == 50);
|
2012-11-13 23:11:34 +00:00
|
|
|
timestamp = gst_adapter_prev_pts (adapter, &dist);
|
2010-09-17 10:40:12 +00:00
|
|
|
fail_unless (timestamp == 5 * GST_SECOND);
|
|
|
|
fail_unless (dist == 50);
|
|
|
|
|
2009-05-13 14:48:38 +00:00
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2009-05-19 22:37:53 +00:00
|
|
|
GST_START_TEST (test_scan)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
GstBuffer *buffer;
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info;
|
2009-05-19 22:37:53 +00:00
|
|
|
guint offset;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
adapter = gst_adapter_new ();
|
|
|
|
fail_unless (adapter != NULL);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_WRITE));
|
2009-05-19 22:37:53 +00:00
|
|
|
/* fill with pattern */
|
|
|
|
for (i = 0; i < 100; i++)
|
2012-01-20 13:23:57 +00:00
|
|
|
((guint8 *) info.data)[i] = i;
|
|
|
|
gst_buffer_unmap (buffer, &info);
|
2009-05-19 22:37:53 +00:00
|
|
|
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
/* find first bytes */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x00010203, 0, 100);
|
|
|
|
fail_unless (offset == 0);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 0, 100);
|
|
|
|
fail_unless (offset == 1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 1, 99);
|
|
|
|
fail_unless (offset == 1);
|
|
|
|
/* offset is past the pattern start */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x01020304, 2, 98);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
/* not enough bytes to find the pattern */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x02030405, 2, 3);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x02030405, 2, 4);
|
|
|
|
fail_unless (offset == 2);
|
|
|
|
/* size does not include the last scanned byte */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 0, 0x41);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 0, 0x43);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 0, 0x44);
|
|
|
|
fail_unless (offset == 0x40);
|
|
|
|
/* past the start */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 65, 10);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x40414243, 64, 5);
|
|
|
|
fail_unless (offset == 64);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 65, 35);
|
|
|
|
fail_unless (offset == 0x60);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 0x60, 4);
|
|
|
|
fail_unless (offset == 0x60);
|
|
|
|
/* past the start */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 0x61, 3);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
|
2009-05-20 08:28:08 +00:00
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 99, 1);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
|
2009-05-19 22:37:53 +00:00
|
|
|
/* add another buffer */
|
|
|
|
buffer = gst_buffer_new_and_alloc (100);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_WRITE));
|
2009-05-19 22:37:53 +00:00
|
|
|
/* fill with pattern */
|
|
|
|
for (i = 0; i < 100; i++)
|
2012-01-20 13:23:57 +00:00
|
|
|
((guint8 *) info.data)[i] = i + 100;
|
|
|
|
gst_buffer_unmap (buffer, &info);
|
2009-05-19 22:37:53 +00:00
|
|
|
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
/* past the start */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x60616263, 0x61, 6);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
/* this should work */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x61626364, 0x61, 4);
|
|
|
|
fail_unless (offset == 0x61);
|
|
|
|
/* not enough data */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x62636465, 0x61, 4);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x62636465, 0x61, 5);
|
|
|
|
fail_unless (offset == 0x62);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x62636465, 0, 120);
|
|
|
|
fail_unless (offset == 0x62);
|
|
|
|
|
|
|
|
/* border conditions */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x62636465, 0, 200);
|
|
|
|
fail_unless (offset == 0x62);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x63646566, 0, 200);
|
|
|
|
fail_unless (offset == 0x63);
|
|
|
|
/* we completely searched the first list */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0, 200);
|
|
|
|
fail_unless (offset == 0x64);
|
|
|
|
/* skip first buffer */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0x64,
|
|
|
|
100);
|
|
|
|
fail_unless (offset == 0x64);
|
|
|
|
/* past the start */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0x65,
|
|
|
|
10);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
/* not enough data to scan */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0x63, 4);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x64656667, 0x63, 5);
|
|
|
|
fail_unless (offset == 0x64);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0, 199);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0x62,
|
|
|
|
102);
|
|
|
|
fail_unless (offset == 0xc4);
|
|
|
|
/* different masks */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0x00ffffff, 0x00656667, 0x64,
|
|
|
|
100);
|
|
|
|
fail_unless (offset == 0x64);
|
2009-05-28 20:02:21 +00:00
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0x000000ff, 0x00000000, 0, 100);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0x000000ff, 0x00000003, 0, 100);
|
|
|
|
fail_unless (offset == 0);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0x000000ff, 0x00000061, 0x61,
|
|
|
|
100);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xff000000, 0x61000000, 0, 0x62);
|
|
|
|
fail_unless (offset == -1);
|
2009-05-19 22:37:53 +00:00
|
|
|
/* does not even exist */
|
2010-09-19 14:10:16 +00:00
|
|
|
ASSERT_CRITICAL (offset =
|
2009-05-19 22:37:53 +00:00
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0x00ffffff, 0xffffffff, 0x65,
|
2010-09-19 14:10:16 +00:00
|
|
|
99));
|
2009-05-19 22:37:53 +00:00
|
|
|
fail_unless (offset == -1);
|
|
|
|
|
|
|
|
/* flush some bytes */
|
|
|
|
gst_adapter_flush (adapter, 0x20);
|
|
|
|
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x20212223, 0, 100);
|
|
|
|
fail_unless (offset == 0);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0x20212223, 0, 4);
|
|
|
|
fail_unless (offset == 0);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0x62,
|
|
|
|
70);
|
|
|
|
fail_unless (offset == 0xa4);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0, 168);
|
|
|
|
fail_unless (offset == 0xa4);
|
|
|
|
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 164, 4);
|
|
|
|
fail_unless (offset == 0xa4);
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0x44,
|
|
|
|
100);
|
|
|
|
fail_unless (offset == 0xa4);
|
|
|
|
/* not enough bytes */
|
|
|
|
offset =
|
|
|
|
gst_adapter_masked_scan_uint32 (adapter, 0xffffffff, 0xc4c5c6c7, 0x44,
|
|
|
|
99);
|
|
|
|
fail_unless (offset == -1);
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2010-09-17 13:51:08 +00:00
|
|
|
/* Fill a buffer with a sequence of 32 bit ints and read them back out
|
|
|
|
* using take_buffer, checking that they're still in the right order */
|
|
|
|
GST_START_TEST (test_take_list)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
adapter = create_and_fill_adapter ();
|
|
|
|
while (gst_adapter_available (adapter) >= sizeof (guint32)) {
|
|
|
|
GList *list, *walk;
|
|
|
|
GstBuffer *buf;
|
2012-01-20 13:23:57 +00:00
|
|
|
gsize left;
|
|
|
|
GstMapInfo info;
|
|
|
|
guint8 *ptr;
|
2010-09-17 13:51:08 +00:00
|
|
|
|
|
|
|
list = gst_adapter_take_list (adapter, sizeof (guint32) * 5);
|
|
|
|
fail_unless (list != NULL);
|
|
|
|
|
|
|
|
for (walk = list; walk; walk = g_list_next (walk)) {
|
|
|
|
buf = walk->data;
|
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (gst_buffer_map (buf, &info, GST_MAP_READ));
|
|
|
|
|
|
|
|
ptr = info.data;
|
|
|
|
left = info.size;
|
2011-03-22 19:51:06 +00:00
|
|
|
|
|
|
|
while (left > 0) {
|
|
|
|
fail_unless (GST_READ_UINT32_LE (ptr) == i);
|
2010-09-17 13:51:08 +00:00
|
|
|
i++;
|
2011-03-22 19:51:06 +00:00
|
|
|
ptr += sizeof (guint32);
|
|
|
|
left -= sizeof (guint32);
|
2010-09-17 13:51:08 +00:00
|
|
|
}
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buf, &info);
|
2011-03-22 19:51:06 +00:00
|
|
|
|
2010-09-17 13:51:08 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
g_list_free (list);
|
|
|
|
}
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 0,
|
|
|
|
"Data was left in the adapter");
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2015-07-08 11:06:27 +00:00
|
|
|
/* Fill a buffer with a sequence of 32 bit ints and read a couple of front
|
|
|
|
* buffers using get_buffer, checking that they're still in the right order */
|
|
|
|
GST_START_TEST (test_get_list)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
int i = 0;
|
|
|
|
gsize size = 0;
|
|
|
|
GList *list, *walk;
|
|
|
|
GstBuffer *buf;
|
|
|
|
gsize left;
|
|
|
|
GstMapInfo info;
|
|
|
|
guint8 *ptr;
|
|
|
|
|
|
|
|
adapter = create_and_fill_adapter ();
|
|
|
|
size = gst_adapter_available (adapter);
|
|
|
|
|
|
|
|
list = gst_adapter_get_list (adapter, sizeof (guint32) * 5);
|
|
|
|
fail_unless (list != NULL);
|
|
|
|
|
|
|
|
for (walk = list; walk; walk = g_list_next (walk)) {
|
|
|
|
buf = walk->data;
|
|
|
|
|
|
|
|
fail_unless (gst_buffer_map (buf, &info, GST_MAP_READ));
|
|
|
|
|
|
|
|
ptr = info.data;
|
|
|
|
left = info.size;
|
|
|
|
|
|
|
|
while (left > 0) {
|
|
|
|
fail_unless (GST_READ_UINT32_LE (ptr) == i);
|
|
|
|
i++;
|
|
|
|
ptr += sizeof (guint32);
|
|
|
|
left -= sizeof (guint32);
|
|
|
|
}
|
|
|
|
gst_buffer_unmap (buf, &info);
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
g_list_free (list);
|
|
|
|
|
|
|
|
fail_unless (gst_adapter_available (adapter) == size,
|
|
|
|
"All data should remain in the adapter");
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2015-03-14 17:23:03 +00:00
|
|
|
/* Fill a buffer with a sequence of 32 bit ints and read them back out
|
|
|
|
* using take_buffer, checking that they're still in the right order */
|
|
|
|
GST_START_TEST (test_take_buffer_list)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
adapter = create_and_fill_adapter ();
|
|
|
|
while (gst_adapter_available (adapter) >= sizeof (guint32)) {
|
|
|
|
GstBufferList *buffer_list;
|
|
|
|
GstBuffer *buf;
|
|
|
|
gsize left;
|
|
|
|
GstMapInfo info;
|
|
|
|
guint8 *ptr;
|
|
|
|
guint n, num;
|
|
|
|
|
|
|
|
buffer_list = gst_adapter_take_buffer_list (adapter, sizeof (guint32) * 5);
|
|
|
|
fail_unless (buffer_list != NULL);
|
|
|
|
num = gst_buffer_list_length (buffer_list);
|
|
|
|
fail_unless (num > 0);
|
|
|
|
|
|
|
|
for (n = 0; n < num; ++n) {
|
|
|
|
buf = gst_buffer_list_get (buffer_list, n);
|
|
|
|
|
|
|
|
fail_unless (gst_buffer_map (buf, &info, GST_MAP_READ));
|
|
|
|
|
|
|
|
ptr = info.data;
|
|
|
|
left = info.size;
|
|
|
|
|
|
|
|
while (left > 0) {
|
|
|
|
fail_unless (GST_READ_UINT32_LE (ptr) == i);
|
|
|
|
i++;
|
|
|
|
ptr += sizeof (guint32);
|
|
|
|
left -= sizeof (guint32);
|
|
|
|
}
|
|
|
|
gst_buffer_unmap (buf, &info);
|
|
|
|
}
|
|
|
|
gst_buffer_list_unref (buffer_list);
|
|
|
|
}
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 0,
|
|
|
|
"Data was left in the adapter");
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2015-07-08 11:06:27 +00:00
|
|
|
/* Fill a buffer with a sequence of 32 bit ints and read a couple of front
|
|
|
|
* buffers using get_buffer, checking that they're still in the right order */
|
|
|
|
GST_START_TEST (test_get_buffer_list)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
int i = 0;
|
|
|
|
gsize size = 0;
|
|
|
|
GstBufferList *buffer_list;
|
|
|
|
GstBuffer *buf;
|
|
|
|
gsize left;
|
|
|
|
GstMapInfo info;
|
|
|
|
guint8 *ptr;
|
|
|
|
guint n, num;
|
|
|
|
|
|
|
|
adapter = create_and_fill_adapter ();
|
|
|
|
size = gst_adapter_available (adapter);
|
|
|
|
|
|
|
|
buffer_list = gst_adapter_get_buffer_list (adapter, sizeof (guint32) * 5);
|
|
|
|
fail_unless (buffer_list != NULL);
|
|
|
|
|
|
|
|
num = gst_buffer_list_length (buffer_list);
|
|
|
|
fail_unless (num > 0);
|
|
|
|
|
|
|
|
for (n = 0; n < num; ++n) {
|
|
|
|
buf = gst_buffer_list_get (buffer_list, n);
|
|
|
|
|
|
|
|
fail_unless (gst_buffer_map (buf, &info, GST_MAP_READ));
|
|
|
|
|
|
|
|
ptr = info.data;
|
|
|
|
left = info.size;
|
|
|
|
|
|
|
|
while (left > 0) {
|
|
|
|
fail_unless (GST_READ_UINT32_LE (ptr) == i);
|
|
|
|
i++;
|
|
|
|
ptr += sizeof (guint32);
|
|
|
|
left -= sizeof (guint32);
|
|
|
|
}
|
|
|
|
gst_buffer_unmap (buf, &info);
|
|
|
|
}
|
|
|
|
gst_buffer_list_unref (buffer_list);
|
|
|
|
|
|
|
|
fail_unless (gst_adapter_available (adapter) == size,
|
|
|
|
"All data should remain in the adapter");
|
|
|
|
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2012-04-14 08:24:38 +00:00
|
|
|
GST_START_TEST (test_merge)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
adapter = gst_adapter_new ();
|
|
|
|
fail_if (adapter == NULL);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (10);
|
|
|
|
fail_if (buffer == NULL);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
for (i = 0; i < 1000; i++) {
|
|
|
|
buffer = gst_buffer_new_and_alloc (10);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
fail_unless (gst_adapter_map (adapter, 20) != NULL);
|
|
|
|
gst_adapter_unmap (adapter);
|
|
|
|
|
|
|
|
gst_adapter_flush (adapter, 10);
|
|
|
|
}
|
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2013-07-15 19:41:44 +00:00
|
|
|
GST_START_TEST (test_take_buffer_fast)
|
|
|
|
{
|
|
|
|
GstAdapter *adapter;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
adapter = gst_adapter_new ();
|
|
|
|
fail_if (adapter == NULL);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (5);
|
|
|
|
fail_if (buffer == NULL);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (10);
|
|
|
|
fail_if (buffer == NULL);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (15);
|
|
|
|
fail_if (buffer == NULL);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 30);
|
|
|
|
|
|
|
|
buffer = gst_adapter_take_buffer_fast (adapter, 30);
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 0);
|
|
|
|
fail_unless (gst_buffer_n_memory (buffer) == 3);
|
|
|
|
fail_unless (gst_buffer_get_sizes_range (buffer, 0, 1, NULL, NULL) == 5);
|
|
|
|
fail_unless (gst_buffer_get_sizes_range (buffer, 1, 1, NULL, NULL) == 10);
|
|
|
|
fail_unless (gst_buffer_get_sizes_range (buffer, 2, 1, NULL, NULL) == 15);
|
2013-07-16 19:35:08 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 0);
|
|
|
|
|
|
|
|
buffer = gst_buffer_new_and_alloc (10);
|
|
|
|
fail_if (buffer == NULL);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
2013-07-15 19:41:44 +00:00
|
|
|
|
2013-07-16 19:35:08 +00:00
|
|
|
buffer = gst_buffer_new_and_alloc (20);
|
|
|
|
fail_if (buffer == NULL);
|
|
|
|
gst_adapter_push (adapter, buffer);
|
|
|
|
|
|
|
|
gst_adapter_flush (adapter, 2);
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 28);
|
|
|
|
|
|
|
|
buffer = gst_adapter_take_buffer_fast (adapter, 10);
|
|
|
|
fail_unless (gst_buffer_n_memory (buffer) == 2);
|
|
|
|
fail_unless (gst_buffer_get_sizes_range (buffer, 0, 1, NULL, NULL) == 8);
|
|
|
|
fail_unless (gst_buffer_get_sizes_range (buffer, 1, 1, NULL, NULL) == 2);
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 18);
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
buffer = gst_adapter_take_buffer_fast (adapter, 8);
|
|
|
|
fail_unless (gst_buffer_n_memory (buffer) == 1);
|
|
|
|
fail_unless (gst_buffer_get_size (buffer) == 8);
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 10);
|
2013-07-15 19:41:44 +00:00
|
|
|
gst_buffer_unref (buffer);
|
2013-07-16 19:35:08 +00:00
|
|
|
|
|
|
|
gst_adapter_clear (adapter);
|
|
|
|
fail_unless (gst_adapter_available (adapter) == 0);
|
|
|
|
|
2013-07-15 19:41:44 +00:00
|
|
|
g_object_unref (adapter);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2008-02-29 13:59:24 +00:00
|
|
|
static Suite *
|
2006-05-04 14:19:53 +00:00
|
|
|
gst_adapter_suite (void)
|
|
|
|
{
|
|
|
|
Suite *s = suite_create ("adapter");
|
|
|
|
TCase *tc_chain = tcase_create ("general");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
|
|
|
tcase_add_test (tc_chain, test_peek1);
|
|
|
|
tcase_add_test (tc_chain, test_peek2);
|
|
|
|
tcase_add_test (tc_chain, test_peek3);
|
|
|
|
tcase_add_test (tc_chain, test_take1);
|
|
|
|
tcase_add_test (tc_chain, test_take2);
|
|
|
|
tcase_add_test (tc_chain, test_take3);
|
Do some optimisation work in GstAdapter to avoid copies in more cases.
Original commit message from CVS:
* Makefile.am:
* configure.ac:
* libs/gst/base/gstadapter.c: (gst_adapter_clear),
(gst_adapter_push), (gst_adapter_peek_into), (gst_adapter_peek),
(gst_adapter_flush), (gst_adapter_take), (gst_adapter_take_buffer):
* libs/gst/base/gstadapter.h:
* tests/check/libs/adapter.c: (create_and_fill_adapter),
(GST_START_TEST), (gst_adapter_suite):
* tests/examples/Makefile.am:
Do some optimisation work in GstAdapter to avoid copies in more cases.
It could still do slightly better by merging buffers when
gst_buffer_is_span_fast is true, but is already faster.
Also, avoid traversing a single-linked list to append each incoming
buffer inside the adapter.
Add simple test app that times the adapter behaviour in different
situations, and extend the unit test to check that bytes enter and
exit the adapter in their original order.
2006-11-09 14:37:38 +00:00
|
|
|
tcase_add_test (tc_chain, test_take_order);
|
|
|
|
tcase_add_test (tc_chain, test_take_buf_order);
|
2009-05-13 14:48:38 +00:00
|
|
|
tcase_add_test (tc_chain, test_timestamp);
|
2009-05-19 22:37:53 +00:00
|
|
|
tcase_add_test (tc_chain, test_scan);
|
2010-09-17 13:51:08 +00:00
|
|
|
tcase_add_test (tc_chain, test_take_list);
|
2015-07-08 11:06:27 +00:00
|
|
|
tcase_add_test (tc_chain, test_get_list);
|
2015-03-14 17:23:03 +00:00
|
|
|
tcase_add_test (tc_chain, test_take_buffer_list);
|
2015-07-08 11:06:27 +00:00
|
|
|
tcase_add_test (tc_chain, test_get_buffer_list);
|
2012-04-14 08:24:38 +00:00
|
|
|
tcase_add_test (tc_chain, test_merge);
|
2013-07-15 19:41:44 +00:00
|
|
|
tcase_add_test (tc_chain, test_take_buffer_fast);
|
2006-05-04 14:19:53 +00:00
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2006-07-01 20:56:56 +00:00
|
|
|
GST_CHECK_MAIN (gst_adapter);
|