TestType tc_type; /**< pipeline for testcase type */
tensor_type t_type; /**< tensor type */
guint received; /**< received buffer count */
+ guint mem_blocks; /**< memory blocks in received buffer */
gsize received_size; /**< received buffer size */
gboolean start; /**< stream started */
gboolean end; /**< eos reached */
static void
_new_data_cb (GstElement * element, GstBuffer * buffer, gpointer user_data)
{
+ gsize buf_size = gst_buffer_get_size (buffer);
+ guint mem_blocks = gst_buffer_n_memory (buffer);
+
+ if (g_test_data.received > 0) {
+ if (g_test_data.mem_blocks != mem_blocks) {
+ _print_log ("invalid memory, old[%d] new[%d]", g_test_data.mem_blocks,
+ mem_blocks);
+ g_assert (0);
+ }
+
+ if (g_test_data.received_size != buf_size) {
+ _print_log ("invalid size, old[%d] new[%d]", g_test_data.received_size,
+ buf_size);
+ g_assert (0);
+ }
+ }
+
g_test_data.received++;
- g_test_data.received_size = gst_buffer_get_size (buffer);
+ g_test_data.received_size = buf_size;
+ g_test_data.mem_blocks = mem_blocks;
_print_log ("new data callback [%d] size [%zd]",
g_test_data.received, g_test_data.received_size);
_print_log ("pts %" GST_TIME_FORMAT, GST_TIME_ARGS (pts));
_print_log ("dts %" GST_TIME_FORMAT, GST_TIME_ARGS (dts));
- _print_log ("number of memory blocks %d", gst_buffer_n_memory (buffer));
}
if (g_test_data.caps_name == NULL) {
if (!gst_tensor_config_from_structure (&g_test_data.tensor_config,
structure)) {
_print_log ("failed to get tensor config from caps");
+ g_assert (0);
}
} else if (g_str_equal (g_test_data.caps_name, "other/tensors")) {
if (!gst_tensors_config_from_structure (&g_test_data.tensors_config,
structure)) {
_print_log ("failed to get tensors config from caps");
+ g_assert (0);
}
}
g_test_data.status = TEST_START;
g_test_data.received = 0;
+ g_test_data.mem_blocks = 0;
g_test_data.received_size = 0;
g_test_data.start = FALSE;
g_test_data.end = FALSE;
/** check caps name */
EXPECT_TRUE (g_str_equal (g_test_data.caps_name, "other/tensor"));
+ /** check caps and config for tensor */
+ {
+ GstCaps *caps;
+ GstStructure *structure;
+ GstTensorConfig config;
+
+ caps = gst_tensor_caps_from_config (&g_test_data.tensor_config);
+ structure = gst_caps_get_structure (caps, 0);
+
+ EXPECT_TRUE (gst_tensor_config_from_structure (&config, structure));
+ EXPECT_TRUE (gst_tensor_config_is_equal (&config,
+ &g_test_data.tensor_config));
+
+ gst_caps_unref (caps);
+ }
+
_free_test_data ();
}
/** check caps name */
EXPECT_TRUE (g_str_equal (g_test_data.caps_name, "other/tensor"));
+ /** check caps and config for tensor */
+ {
+ GstCaps *caps;
+ GstStructure *structure;
+ GstTensorConfig config;
+
+ caps = gst_tensor_caps_from_config (&g_test_data.tensor_config);
+ structure = gst_caps_get_structure (caps, 0);
+
+ EXPECT_TRUE (gst_tensor_config_from_structure (&config, structure));
+ EXPECT_TRUE (gst_tensor_config_is_equal (&config,
+ &g_test_data.tensor_config));
+
+ gst_caps_unref (caps);
+ }
+
_free_test_data ();
}
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 2);
EXPECT_EQ (g_test_data.received_size, 115200);
/** check caps name */
EXPECT_EQ (g_test_data.tensors_config.rate_n, 30);
EXPECT_EQ (g_test_data.tensors_config.rate_d, 1);
+ /** check caps and config for tensors */
+ {
+ GstCaps *caps;
+ GstStructure *structure;
+ GstTensorsConfig config;
+
+ caps = gst_tensors_caps_from_config (&g_test_data.tensors_config);
+ structure = gst_caps_get_structure (caps, 0);
+
+ EXPECT_TRUE (gst_tensors_config_from_structure (&config, structure));
+ EXPECT_TRUE (gst_tensors_config_is_equal (&config,
+ &g_test_data.tensors_config));
+
+ gst_caps_unref (caps);
+ }
+
_free_test_data ();
}
/** check received buffers and signals */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 57600);
/** check caps name */
/** check received buffers and signals */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 58320);
/** check caps name */
/** check received buffers and signals */
EXPECT_EQ (g_test_data.received, num_buffers / 3);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 57600 * 3);
/** check caps name */
/** check received buffers and signals */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 76800);
/** check caps name */
/** check received buffers and signals */
EXPECT_EQ (g_test_data.received, num_buffers / 2);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 76800 * 2);
/** check caps name */
/** check received buffers and signals */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 19200);
/** check caps name */
/** check received buffers and signals */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 19440);
/** check caps name */
/** check received buffers and signals */
EXPECT_EQ (g_test_data.received, num_buffers / 3);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 19440 * 3);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 500);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers * 5);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 100);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 500 * 2);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers / 2);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 500 * 2 * 2);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers / 3);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * 3);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * t_size);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * t_size);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * t_size);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * t_size);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * t_size);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * t_size);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * t_size);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, GST_TENSOR_STRING_SIZE * t_size);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, (num_buffers - 10) / 5 + 1);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 57600 * 10);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers / 4);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 500 * 2 * 4);
/** check caps name */
/** check received buffers */
EXPECT_EQ (g_test_data.received, num_buffers * 5);
+ EXPECT_EQ (g_test_data.mem_blocks, 1);
EXPECT_EQ (g_test_data.received_size, 500 * 2 / 5);
/** check caps name */