mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-14 13:21:28 +00:00
Added some more testcases and rearanged some code (it's still pretty stupid)
Original commit message from CVS: Added some more testcases and rearanged some code (it's still pretty stupid)
This commit is contained in:
parent
aed1e95e9b
commit
d518b7e859
6 changed files with 262 additions and 118 deletions
8
tests/old/testsuite/bytestream/.gitignore
vendored
Normal file
8
tests/old/testsuite/bytestream/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
Makefile
|
||||
Makefile.in
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
.deps
|
||||
.libs
|
||||
test1
|
|
@ -41,6 +41,14 @@ typedef enum
|
|||
}
|
||||
GstBsTestSizeType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BSTEST_ACCESSTYPE_READ = 1,
|
||||
BSTEST_ACCESSTYPE_PEEK_READ,
|
||||
BSTEST_ACCESSTYPE_PEEK_READRAND,
|
||||
}
|
||||
GstBsTestAccessType;
|
||||
|
||||
struct _GstBsTest
|
||||
{
|
||||
GstElement element;
|
||||
|
@ -50,6 +58,7 @@ struct _GstBsTest
|
|||
|
||||
GstByteStream *bs;
|
||||
GstBsTestSizeType sizetype;
|
||||
GstBsTestAccessType accesstype;
|
||||
guint sizemin;
|
||||
guint sizemax;
|
||||
gint count;
|
||||
|
@ -87,6 +96,7 @@ enum
|
|||
ARG_SIZETYPE,
|
||||
ARG_SIZEMIN,
|
||||
ARG_SIZEMAX,
|
||||
ARG_ACCESSTYPE,
|
||||
ARG_COUNT,
|
||||
ARG_SILENT,
|
||||
};
|
||||
|
@ -124,6 +134,23 @@ gst_bstest_sizetype_get_type (void)
|
|||
return bstest_sizetype_type;
|
||||
}
|
||||
|
||||
#define GST_TYPE_BSTEST_ACCESSTYPE (gst_bstest_accesstype_get_type())
|
||||
static GType
|
||||
gst_bstest_accesstype_get_type (void)
|
||||
{
|
||||
static GType bstest_accesstype_type = 0;
|
||||
static GEnumValue bstest_accesstype[] = {
|
||||
{BSTEST_ACCESSTYPE_READ, "1", "Read data"},
|
||||
{BSTEST_ACCESSTYPE_PEEK_READ, "2", "Peek data, read data (same size)"},
|
||||
{BSTEST_ACCESSTYPE_PEEK_READRAND, "3", "Peek data, read data (different size)"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!bstest_accesstype_type) {
|
||||
bstest_accesstype_type = g_enum_register_static ("GstBsTestAccessType", bstest_accesstype);
|
||||
}
|
||||
return bstest_accesstype_type;
|
||||
}
|
||||
GType
|
||||
gst_bstest_get_type (void)
|
||||
{
|
||||
|
@ -167,6 +194,10 @@ gst_bstest_class_init (GstBsTestClass * klass)
|
|||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX,
|
||||
g_param_spec_int ("sizemax", "sizemax", "sizemax", 0, G_MAXINT,
|
||||
384, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACCESSTYPE,
|
||||
g_param_spec_enum ("accesstype", "accesstype", "accesstype",
|
||||
GST_TYPE_BSTEST_ACCESSTYPE,
|
||||
BSTEST_ACCESSTYPE_READ, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COUNT,
|
||||
g_param_spec_uint ("count", "count", "count",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
|
@ -217,6 +248,7 @@ gst_bstest_init (GstBsTest * bstest)
|
|||
bstest->sizetype = BSTEST_SIZETYPE_FIXED;
|
||||
bstest->sizemin = 0;
|
||||
bstest->sizemax = 384;
|
||||
bstest->accesstype = BSTEST_ACCESSTYPE_READ;
|
||||
bstest->count = 5;
|
||||
bstest->silent = FALSE;
|
||||
bstest->bs = NULL;
|
||||
|
@ -239,7 +271,7 @@ static void
|
|||
gst_bstest_loop (GstElement * element)
|
||||
{
|
||||
GstBsTest *bstest;
|
||||
GstBuffer *buf;
|
||||
GstBuffer *buf = NULL;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (element != NULL);
|
||||
|
@ -258,15 +290,33 @@ gst_bstest_loop (GstElement * element)
|
|||
}
|
||||
else {
|
||||
|
||||
if (!bstest->silent) {
|
||||
g_print ("bstest: ***** getting %d bytes\n", size);
|
||||
}
|
||||
//data = gst_bytestream_peek_bytes (bstest->bs, size);
|
||||
buf = gst_bytestream_read (bstest->bs, size);
|
||||
switch (bstest->accesstype) {
|
||||
case BSTEST_ACCESSTYPE_PEEK_READ:
|
||||
if (!bstest->silent) g_print ("bstest: ***** peek %d bytes\n", size);
|
||||
gst_bytestream_peek_bytes (bstest->bs, size);
|
||||
// fall though
|
||||
case BSTEST_ACCESSTYPE_READ:
|
||||
if (!bstest->silent) g_print ("bstest: ***** read %d bytes\n", size);
|
||||
buf = gst_bytestream_read (bstest->bs, size);
|
||||
break;
|
||||
case BSTEST_ACCESSTYPE_PEEK_READRAND:
|
||||
if (!bstest->silent) g_print ("bstest: ***** peek %d bytes\n", size);
|
||||
gst_bytestream_peek_bytes (bstest->bs, size);
|
||||
size = gst_bstest_get_size (bstest);
|
||||
if (!bstest->silent) g_print ("bstest: ***** read %d bytes\n", size);
|
||||
if (size == 0) {
|
||||
buf = gst_buffer_new ();
|
||||
}
|
||||
else {
|
||||
buf = gst_bytestream_read (bstest->bs, size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!buf)
|
||||
g_print ("BUFFER IS BOGUS\n");
|
||||
gst_pad_push (bstest->srcpad, buf);
|
||||
else
|
||||
gst_pad_push (bstest->srcpad, buf);
|
||||
}
|
||||
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
|
||||
}
|
||||
|
@ -291,6 +341,9 @@ gst_bstest_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
case ARG_SIZEMAX:
|
||||
bstest->sizemax = g_value_get_int (value);
|
||||
break;
|
||||
case ARG_ACCESSTYPE:
|
||||
bstest->accesstype = g_value_get_int (value);
|
||||
break;
|
||||
case ARG_COUNT:
|
||||
bstest->count = g_value_get_uint (value);
|
||||
break;
|
||||
|
@ -323,6 +376,9 @@ gst_bstest_get_property (GObject * object, guint prop_id, GValue * value, GParam
|
|||
case ARG_SIZEMAX:
|
||||
g_value_set_int (value, bstest->sizemax);
|
||||
break;
|
||||
case ARG_ACCESSTYPE:
|
||||
g_value_set_int (value, bstest->accesstype);
|
||||
break;
|
||||
case ARG_COUNT:
|
||||
g_value_set_uint (value, bstest->count);
|
||||
break;
|
||||
|
|
|
@ -3,6 +3,50 @@
|
|||
|
||||
#define VM_THRES 1000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *desc;
|
||||
gint src_data;
|
||||
gint src_sizetype;
|
||||
gint src_filltype;
|
||||
gboolean src_silent;
|
||||
|
||||
gint bs_sizetype;
|
||||
gint bs_accesstype;
|
||||
gboolean bs_silent;
|
||||
|
||||
gboolean sink_dump;
|
||||
gboolean sink_silent;
|
||||
} TestParam;
|
||||
|
||||
static TestParam params[] = {
|
||||
{"fixed size src, fixed size _read", 1, 2, 5, TRUE, 1, 1, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, random size _read", 1, 2, 5, TRUE, 2, 1, TRUE, FALSE, TRUE },
|
||||
{"random size src, fixed size _read", 1, 3, 5, TRUE, 1, 1, TRUE, FALSE, TRUE },
|
||||
{"random size src, random size _read", 1, 3, 5, TRUE, 2, 1, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, fixed size _read", 2, 2, 5, TRUE, 1, 1, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, random size _read", 2, 2, 5, TRUE, 2, 1, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, fixed size _read", 2, 3, 5, TRUE, 1, 1, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, random size _read", 2, 3, 5, TRUE, 2, 1, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, fixed size _peek_read", 1, 2, 5, TRUE, 1, 2, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, random size _peek_read", 1, 2, 5, TRUE, 2, 2, TRUE, FALSE, TRUE },
|
||||
{"random size src, fixed size _peek_read", 1, 3, 5, TRUE, 1, 2, TRUE, FALSE, TRUE },
|
||||
{"random size src, random size _peek_read", 1, 3, 5, TRUE, 2, 2, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, fixed size _peek_read", 2, 2, 5, TRUE, 1, 2, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, random size _peek_read", 2, 2, 5, TRUE, 2, 2, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, fixed size _peek_read", 2, 3, 5, TRUE, 1, 2, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, random size _peek_read", 2, 3, 5, TRUE, 2, 2, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, fixed size _peek_readrand", 1, 2, 5, TRUE, 1, 3, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, random size _peek_readrand", 1, 2, 5, TRUE, 2, 3, TRUE, FALSE, TRUE },
|
||||
{"random size src, fixed size _peek_readrand", 1, 3, 5, TRUE, 1, 3, TRUE, FALSE, TRUE },
|
||||
{"random size src, random size _peek_readrand", 1, 3, 5, TRUE, 2, 3, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, fixed size _peek_readrand", 2, 2, 5, TRUE, 1, 3, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, random size _peek_readrand", 2, 2, 5, TRUE, 2, 3, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, fixed size _peek_readrand", 2, 3, 5, TRUE, 1, 3, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, random size _peek_readrand", 2, 3, 5, TRUE, 2, 3, TRUE, FALSE, TRUE },
|
||||
{NULL, 2, 3, 5, TRUE, 2, 2, TRUE, FALSE, TRUE }
|
||||
};
|
||||
|
||||
static guint8 count;
|
||||
|
||||
static void
|
||||
|
@ -59,7 +103,7 @@ main (int argc, char *argv[])
|
|||
GstElement *sink;
|
||||
GstElement *bs;
|
||||
GstElement *pipeline;
|
||||
gint testnum = 1;
|
||||
gint testnum = 0;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -83,62 +127,26 @@ main (int argc, char *argv[])
|
|||
gst_bin_add (GST_BIN (pipeline), bs);
|
||||
gst_bin_add (GST_BIN (pipeline), sink);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("fixed size src, fixed size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 1, "sizetype", 2, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 1, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
while (params[testnum].desc) {
|
||||
g_print ("\n\nrunning test %d:\n", testnum+1);
|
||||
g_print ("%s\n", params[testnum].desc);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("fixed size src, random size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 1, "sizetype", 2, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 2, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
g_object_set (G_OBJECT (src), "data", params[testnum].src_data,
|
||||
"sizetype", params[testnum].src_sizetype,
|
||||
"filltype", params[testnum].src_filltype,
|
||||
"silent", params[testnum].src_silent, NULL);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("random size src, fixed size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 1, "sizetype", 3, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 1, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", params[testnum].bs_sizetype,
|
||||
"accesstype", params[testnum].bs_accesstype,
|
||||
"silent", TRUE, NULL);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("random size src, random size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 1, "sizetype", 3, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 2, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
g_object_set (G_OBJECT (sink), "dump", params[testnum].sink_dump,
|
||||
"silent", params[testnum].sink_silent, NULL);
|
||||
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("fixed size src as subbuffer, fixed size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 2, "sizetype", 2, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 1, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("fixed size src as subbuffer, random size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 2, "sizetype", 2, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 2, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("random size src as subbuffer, fixed size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 2, "sizetype", 3, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 1, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("random size src as subbuffer, random size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 2, "sizetype", 3, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 2, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
testnum++;
|
||||
}
|
||||
|
||||
g_print ("\n\ndone\n");
|
||||
|
||||
|
|
8
testsuite/bytestream/.gitignore
vendored
Normal file
8
testsuite/bytestream/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
Makefile
|
||||
Makefile.in
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
.deps
|
||||
.libs
|
||||
test1
|
|
@ -41,6 +41,14 @@ typedef enum
|
|||
}
|
||||
GstBsTestSizeType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BSTEST_ACCESSTYPE_READ = 1,
|
||||
BSTEST_ACCESSTYPE_PEEK_READ,
|
||||
BSTEST_ACCESSTYPE_PEEK_READRAND,
|
||||
}
|
||||
GstBsTestAccessType;
|
||||
|
||||
struct _GstBsTest
|
||||
{
|
||||
GstElement element;
|
||||
|
@ -50,6 +58,7 @@ struct _GstBsTest
|
|||
|
||||
GstByteStream *bs;
|
||||
GstBsTestSizeType sizetype;
|
||||
GstBsTestAccessType accesstype;
|
||||
guint sizemin;
|
||||
guint sizemax;
|
||||
gint count;
|
||||
|
@ -87,6 +96,7 @@ enum
|
|||
ARG_SIZETYPE,
|
||||
ARG_SIZEMIN,
|
||||
ARG_SIZEMAX,
|
||||
ARG_ACCESSTYPE,
|
||||
ARG_COUNT,
|
||||
ARG_SILENT,
|
||||
};
|
||||
|
@ -124,6 +134,23 @@ gst_bstest_sizetype_get_type (void)
|
|||
return bstest_sizetype_type;
|
||||
}
|
||||
|
||||
#define GST_TYPE_BSTEST_ACCESSTYPE (gst_bstest_accesstype_get_type())
|
||||
static GType
|
||||
gst_bstest_accesstype_get_type (void)
|
||||
{
|
||||
static GType bstest_accesstype_type = 0;
|
||||
static GEnumValue bstest_accesstype[] = {
|
||||
{BSTEST_ACCESSTYPE_READ, "1", "Read data"},
|
||||
{BSTEST_ACCESSTYPE_PEEK_READ, "2", "Peek data, read data (same size)"},
|
||||
{BSTEST_ACCESSTYPE_PEEK_READRAND, "3", "Peek data, read data (different size)"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!bstest_accesstype_type) {
|
||||
bstest_accesstype_type = g_enum_register_static ("GstBsTestAccessType", bstest_accesstype);
|
||||
}
|
||||
return bstest_accesstype_type;
|
||||
}
|
||||
GType
|
||||
gst_bstest_get_type (void)
|
||||
{
|
||||
|
@ -167,6 +194,10 @@ gst_bstest_class_init (GstBsTestClass * klass)
|
|||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIZEMAX,
|
||||
g_param_spec_int ("sizemax", "sizemax", "sizemax", 0, G_MAXINT,
|
||||
384, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACCESSTYPE,
|
||||
g_param_spec_enum ("accesstype", "accesstype", "accesstype",
|
||||
GST_TYPE_BSTEST_ACCESSTYPE,
|
||||
BSTEST_ACCESSTYPE_READ, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COUNT,
|
||||
g_param_spec_uint ("count", "count", "count",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE));
|
||||
|
@ -217,6 +248,7 @@ gst_bstest_init (GstBsTest * bstest)
|
|||
bstest->sizetype = BSTEST_SIZETYPE_FIXED;
|
||||
bstest->sizemin = 0;
|
||||
bstest->sizemax = 384;
|
||||
bstest->accesstype = BSTEST_ACCESSTYPE_READ;
|
||||
bstest->count = 5;
|
||||
bstest->silent = FALSE;
|
||||
bstest->bs = NULL;
|
||||
|
@ -239,7 +271,7 @@ static void
|
|||
gst_bstest_loop (GstElement * element)
|
||||
{
|
||||
GstBsTest *bstest;
|
||||
GstBuffer *buf;
|
||||
GstBuffer *buf = NULL;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (element != NULL);
|
||||
|
@ -258,15 +290,33 @@ gst_bstest_loop (GstElement * element)
|
|||
}
|
||||
else {
|
||||
|
||||
if (!bstest->silent) {
|
||||
g_print ("bstest: ***** getting %d bytes\n", size);
|
||||
}
|
||||
//data = gst_bytestream_peek_bytes (bstest->bs, size);
|
||||
buf = gst_bytestream_read (bstest->bs, size);
|
||||
switch (bstest->accesstype) {
|
||||
case BSTEST_ACCESSTYPE_PEEK_READ:
|
||||
if (!bstest->silent) g_print ("bstest: ***** peek %d bytes\n", size);
|
||||
gst_bytestream_peek_bytes (bstest->bs, size);
|
||||
// fall though
|
||||
case BSTEST_ACCESSTYPE_READ:
|
||||
if (!bstest->silent) g_print ("bstest: ***** read %d bytes\n", size);
|
||||
buf = gst_bytestream_read (bstest->bs, size);
|
||||
break;
|
||||
case BSTEST_ACCESSTYPE_PEEK_READRAND:
|
||||
if (!bstest->silent) g_print ("bstest: ***** peek %d bytes\n", size);
|
||||
gst_bytestream_peek_bytes (bstest->bs, size);
|
||||
size = gst_bstest_get_size (bstest);
|
||||
if (!bstest->silent) g_print ("bstest: ***** read %d bytes\n", size);
|
||||
if (size == 0) {
|
||||
buf = gst_buffer_new ();
|
||||
}
|
||||
else {
|
||||
buf = gst_bytestream_read (bstest->bs, size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!buf)
|
||||
g_print ("BUFFER IS BOGUS\n");
|
||||
gst_pad_push (bstest->srcpad, buf);
|
||||
else
|
||||
gst_pad_push (bstest->srcpad, buf);
|
||||
}
|
||||
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING (element));
|
||||
}
|
||||
|
@ -291,6 +341,9 @@ gst_bstest_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
case ARG_SIZEMAX:
|
||||
bstest->sizemax = g_value_get_int (value);
|
||||
break;
|
||||
case ARG_ACCESSTYPE:
|
||||
bstest->accesstype = g_value_get_int (value);
|
||||
break;
|
||||
case ARG_COUNT:
|
||||
bstest->count = g_value_get_uint (value);
|
||||
break;
|
||||
|
@ -323,6 +376,9 @@ gst_bstest_get_property (GObject * object, guint prop_id, GValue * value, GParam
|
|||
case ARG_SIZEMAX:
|
||||
g_value_set_int (value, bstest->sizemax);
|
||||
break;
|
||||
case ARG_ACCESSTYPE:
|
||||
g_value_set_int (value, bstest->accesstype);
|
||||
break;
|
||||
case ARG_COUNT:
|
||||
g_value_set_uint (value, bstest->count);
|
||||
break;
|
||||
|
|
|
@ -3,6 +3,50 @@
|
|||
|
||||
#define VM_THRES 1000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *desc;
|
||||
gint src_data;
|
||||
gint src_sizetype;
|
||||
gint src_filltype;
|
||||
gboolean src_silent;
|
||||
|
||||
gint bs_sizetype;
|
||||
gint bs_accesstype;
|
||||
gboolean bs_silent;
|
||||
|
||||
gboolean sink_dump;
|
||||
gboolean sink_silent;
|
||||
} TestParam;
|
||||
|
||||
static TestParam params[] = {
|
||||
{"fixed size src, fixed size _read", 1, 2, 5, TRUE, 1, 1, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, random size _read", 1, 2, 5, TRUE, 2, 1, TRUE, FALSE, TRUE },
|
||||
{"random size src, fixed size _read", 1, 3, 5, TRUE, 1, 1, TRUE, FALSE, TRUE },
|
||||
{"random size src, random size _read", 1, 3, 5, TRUE, 2, 1, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, fixed size _read", 2, 2, 5, TRUE, 1, 1, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, random size _read", 2, 2, 5, TRUE, 2, 1, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, fixed size _read", 2, 3, 5, TRUE, 1, 1, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, random size _read", 2, 3, 5, TRUE, 2, 1, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, fixed size _peek_read", 1, 2, 5, TRUE, 1, 2, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, random size _peek_read", 1, 2, 5, TRUE, 2, 2, TRUE, FALSE, TRUE },
|
||||
{"random size src, fixed size _peek_read", 1, 3, 5, TRUE, 1, 2, TRUE, FALSE, TRUE },
|
||||
{"random size src, random size _peek_read", 1, 3, 5, TRUE, 2, 2, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, fixed size _peek_read", 2, 2, 5, TRUE, 1, 2, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, random size _peek_read", 2, 2, 5, TRUE, 2, 2, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, fixed size _peek_read", 2, 3, 5, TRUE, 1, 2, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, random size _peek_read", 2, 3, 5, TRUE, 2, 2, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, fixed size _peek_readrand", 1, 2, 5, TRUE, 1, 3, TRUE, FALSE, TRUE },
|
||||
{"fixed size src, random size _peek_readrand", 1, 2, 5, TRUE, 2, 3, TRUE, FALSE, TRUE },
|
||||
{"random size src, fixed size _peek_readrand", 1, 3, 5, TRUE, 1, 3, TRUE, FALSE, TRUE },
|
||||
{"random size src, random size _peek_readrand", 1, 3, 5, TRUE, 2, 3, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, fixed size _peek_readrand", 2, 2, 5, TRUE, 1, 3, TRUE, FALSE, TRUE },
|
||||
{"fixed size subbuffer, random size _peek_readrand", 2, 2, 5, TRUE, 2, 3, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, fixed size _peek_readrand", 2, 3, 5, TRUE, 1, 3, TRUE, FALSE, TRUE },
|
||||
{"random size subbuffer, random size _peek_readrand", 2, 3, 5, TRUE, 2, 3, TRUE, FALSE, TRUE },
|
||||
{NULL, 2, 3, 5, TRUE, 2, 2, TRUE, FALSE, TRUE }
|
||||
};
|
||||
|
||||
static guint8 count;
|
||||
|
||||
static void
|
||||
|
@ -59,7 +103,7 @@ main (int argc, char *argv[])
|
|||
GstElement *sink;
|
||||
GstElement *bs;
|
||||
GstElement *pipeline;
|
||||
gint testnum = 1;
|
||||
gint testnum = 0;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -83,62 +127,26 @@ main (int argc, char *argv[])
|
|||
gst_bin_add (GST_BIN (pipeline), bs);
|
||||
gst_bin_add (GST_BIN (pipeline), sink);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("fixed size src, fixed size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 1, "sizetype", 2, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 1, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
while (params[testnum].desc) {
|
||||
g_print ("\n\nrunning test %d:\n", testnum+1);
|
||||
g_print ("%s\n", params[testnum].desc);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("fixed size src, random size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 1, "sizetype", 2, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 2, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
g_object_set (G_OBJECT (src), "data", params[testnum].src_data,
|
||||
"sizetype", params[testnum].src_sizetype,
|
||||
"filltype", params[testnum].src_filltype,
|
||||
"silent", params[testnum].src_silent, NULL);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("random size src, fixed size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 1, "sizetype", 3, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 1, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", params[testnum].bs_sizetype,
|
||||
"accesstype", params[testnum].bs_accesstype,
|
||||
"silent", TRUE, NULL);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("random size src, random size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 1, "sizetype", 3, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 2, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
g_object_set (G_OBJECT (sink), "dump", params[testnum].sink_dump,
|
||||
"silent", params[testnum].sink_silent, NULL);
|
||||
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("fixed size src as subbuffer, fixed size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 2, "sizetype", 2, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 1, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("fixed size src as subbuffer, random size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 2, "sizetype", 2, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 2, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("random size src as subbuffer, fixed size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 2, "sizetype", 3, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 1, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
|
||||
g_print ("\n\nrunning test %d:\n", testnum++);
|
||||
g_print ("random size src as subbuffer, random size _read:\n");
|
||||
g_object_set (G_OBJECT (src), "data", 2, "sizetype", 3, "filltype", 5, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (bs), "sizetype", 2, "silent", TRUE, NULL);
|
||||
g_object_set (G_OBJECT (sink), "dump", FALSE, "silent", TRUE, NULL);
|
||||
run_test (GST_BIN (pipeline), 50000);
|
||||
testnum++;
|
||||
}
|
||||
|
||||
g_print ("\n\ndone\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue