summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2017-10-14 18:18:44 +0200
committerStefan Sauer <ensonic@users.sf.net>2017-10-14 18:20:30 +0200
commit17dfaf83dc6f99466b064fa141acce2df81a2221 (patch)
tree2b963764c7bd948390cae4d328d36704573c0526 /tests
parent9c1b85115c8fb73d9a091ad41dbcc3851ab8b9e2 (diff)
aggregator: add two more tests for a sequence of data
This verifies that we handle events and queries at the head of the queue and then buffers.
Diffstat (limited to 'tests')
-rw-r--r--tests/check/libs/aggregator.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/check/libs/aggregator.c b/tests/check/libs/aggregator.c
index 24d7a9594..28a0c46fe 100644
--- a/tests/check/libs/aggregator.c
+++ b/tests/check/libs/aggregator.c
@@ -317,6 +317,7 @@ _quit (GMainLoop * ml)
static GstPadProbeReturn
_aggregated_cb (GstPad * pad, GstPadProbeInfo * info, GMainLoop * ml)
{
+ GST_DEBUG ("Received data %" GST_PTR_FORMAT, info->data);
GST_DEBUG ("Should quit ML");
g_idle_add ((GSourceFunc) _quit, ml);
@@ -538,6 +539,69 @@ GST_START_TEST (test_aggregate_gap)
GST_END_TEST;
+GST_START_TEST (test_aggregate_handle_events)
+{
+ GThread *thread1, *thread2;
+ ChainData data1 = { 0, };
+ ChainData data2 = { 0, };
+ TestData test = { 0, };
+
+ _test_data_init (&test, FALSE);
+ _chain_data_init (&data1, test.aggregator,
+ gst_event_new_tag (gst_tag_list_new_empty ()), gst_buffer_new (), NULL);
+ _chain_data_init (&data2, test.aggregator, gst_buffer_new (), NULL);
+
+ thread1 = g_thread_try_new ("gst-check", push_data, &data1, NULL);
+ thread2 = g_thread_try_new ("gst-check", push_data, &data2, NULL);
+
+ g_main_loop_run (test.ml);
+ g_source_remove (test.timeout_id);
+
+ /* these will return immediately as when the data is popped the threads are
+ * unlocked and will terminate */
+ g_thread_join (thread1);
+ g_thread_join (thread2);
+
+ _chain_data_clear (&data1);
+ _chain_data_clear (&data2);
+ _test_data_clear (&test);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_aggregate_handle_queries)
+{
+ GThread *thread1, *thread2;
+ ChainData data1 = { 0, };
+ ChainData data2 = { 0, };
+ TestData test = { 0, };
+
+ _test_data_init (&test, FALSE);
+ _chain_data_init (&data1, test.aggregator,
+ gst_query_new_allocation (gst_caps_new_empty_simple ("foo/x-bar"), FALSE),
+ gst_buffer_new (), NULL);
+ _chain_data_init (&data2, test.aggregator, gst_buffer_new (), NULL);
+
+ thread1 = g_thread_try_new ("gst-check", push_data, &data1, NULL);
+ thread2 = g_thread_try_new ("gst-check", push_data, &data2, NULL);
+
+ g_main_loop_run (test.ml);
+ g_source_remove (test.timeout_id);
+
+ /* these will return immediately as when the data is popped the threads are
+ * unlocked and will terminate */
+ g_thread_join (thread1);
+ g_thread_join (thread2);
+
+ // FIXME: need to make sure all data was aggregated
+
+ _chain_data_clear (&data1);
+ _chain_data_clear (&data2);
+ _test_data_clear (&test);
+}
+
+GST_END_TEST;
+
#define NUM_BUFFERS 3
static void
handoff (GstElement * fakesink, GstBuffer * buf, GstPad * pad, guint * count)
@@ -1190,6 +1254,8 @@ gst_aggregator_suite (void)
tcase_add_test (general, test_aggregate);
tcase_add_test (general, test_aggregate_eos);
tcase_add_test (general, test_aggregate_gap);
+ tcase_add_test (general, test_aggregate_handle_events);
+ tcase_add_test (general, test_aggregate_handle_queries);
tcase_add_test (general, test_flushing_seek);
tcase_add_test (general, test_infinite_seek);
tcase_add_test (general, test_infinite_seek_50_src);