summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2012-09-25 15:08:26 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2012-09-25 16:23:53 -0400
commitdfcbd4cbcf111d6cfe6c174c4fdb5a9235062cf9 (patch)
tree168f70df15e0f7cf7d5d51ebbae320c8be5d9f1a /tests
parent224a49a5c784efbe6bc4b9e8c7632332efcf7456 (diff)
downloadfarstream-dfcbd4cbcf111d6cfe6c174c4fdb5a9235062cf9.tar.gz
Port to GLib 2.32
Diffstat (limited to 'tests')
-rw-r--r--tests/check/rtp/recvcodecs.c30
-rw-r--r--tests/check/transmitter/nice.c107
-rw-r--r--tests/check/transmitter/shm.c36
3 files changed, 81 insertions, 92 deletions
diff --git a/tests/check/rtp/recvcodecs.c b/tests/check/rtp/recvcodecs.c
index 3cdad875..7cb6bda5 100644
--- a/tests/check/rtp/recvcodecs.c
+++ b/tests/check/rtp/recvcodecs.c
@@ -33,8 +33,8 @@
#define SEND_BUFFER_COUNT 100
#define BUFFER_COUNT 20
-GMutex *count_mutex;
-GCond *count_cond;
+GMutex count_mutex;
+GCond count_cond;
guint buffer_count = 0;
@@ -42,15 +42,15 @@ static void
handoff_handler (GstElement *fakesink, GstBuffer *buffer, GstPad *pad,
gpointer user_data)
{
- g_mutex_lock (count_mutex);
+ g_mutex_lock (&count_mutex);
buffer_count ++;
GST_LOG ("buffer %d", buffer_count);
if (buffer_count == BUFFER_COUNT)
- g_cond_broadcast (count_cond);
+ g_cond_broadcast (&count_cond);
ts_fail_unless (buffer_count <= SEND_BUFFER_COUNT);
- g_mutex_unlock (count_mutex);
+ g_mutex_unlock (&count_mutex);
}
static void
@@ -180,8 +180,8 @@ GST_START_TEST (test_rtprecv_inband_config_data)
GstElement *pay;
FsElementAddedNotifier *notif;
- count_mutex = g_mutex_new ();
- count_cond = g_cond_new ();
+ g_mutex_init (&count_mutex);
+ g_cond_init (&count_cond);
buffer_count = 0;
decoder_count = 0;
@@ -319,11 +319,11 @@ GST_START_TEST (test_rtprecv_inband_config_data)
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_mutex_lock (count_mutex);
+ g_mutex_lock (&count_mutex);
while (buffer_count < BUFFER_COUNT)
- g_cond_wait (count_cond, count_mutex);
+ g_cond_wait (&count_cond, &count_mutex);
buffer_count = 0;
- g_mutex_unlock (count_mutex);
+ g_mutex_unlock (&count_mutex);
gst_element_set_state (pipeline, GST_STATE_NULL);
@@ -333,11 +333,11 @@ GST_START_TEST (test_rtprecv_inband_config_data)
gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_mutex_lock (count_mutex);
+ g_mutex_lock (&count_mutex);
while (buffer_count < BUFFER_COUNT)
- g_cond_wait (count_cond, count_mutex);
+ g_cond_wait (&count_cond, &count_mutex);
buffer_count = 0;
- g_mutex_unlock (count_mutex);
+ g_mutex_unlock (&count_mutex);
gst_element_set_state (pipeline, GST_STATE_NULL);
@@ -368,8 +368,8 @@ GST_START_TEST (test_rtprecv_inband_config_data)
gst_object_unref (fspipeline);
- g_mutex_free (count_mutex);
- g_cond_free (count_cond);
+ g_mutex_clear (&count_mutex);
+ g_cond_clear (&count_cond);
}
GST_END_TEST;
diff --git a/tests/check/transmitter/nice.c b/tests/check/transmitter/nice.c
index 931ad711..2d2ac76d 100644
--- a/tests/check/transmitter/nice.c
+++ b/tests/check/transmitter/nice.c
@@ -643,9 +643,7 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
GError *error = NULL;
guint comps = 0;
GParameter params[1];
- GValueArray *va;
- GstStructure *s;
- GValue val = {0};
+ GPtrArray *relay_info;
FsCandidate *cand;
GList *list;
@@ -733,19 +731,17 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
g_value_unset (&params[0].value);
params[0].name = "relay-info";
- g_value_init (&params[0].value, G_TYPE_VALUE_ARRAY);
+ g_value_init (&params[0].value, G_TYPE_PTR_ARRAY);
/* no IP */
- va = g_value_array_new (1);
- s = gst_structure_new ("aa",
- "port", G_TYPE_UINT, 7654,
- "username", G_TYPE_STRING, "blah",
- "password", G_TYPE_STRING, "blah2",
- NULL);
- g_value_init (&val, GST_TYPE_STRUCTURE);
- g_value_take_boxed (&val, s);
- g_value_array_append (va, &val);
- g_value_take_boxed (&params[0].value, va);
+ relay_info = g_ptr_array_new_full (1, (GDestroyNotify)gst_structure_free);
+ g_ptr_array_add (relay_info,
+ gst_structure_new ("aa",
+ "port", G_TYPE_UINT, 7654,
+ "username", G_TYPE_STRING, "blah",
+ "password", G_TYPE_STRING, "blah2",
+ NULL));
+ g_value_take_boxed (&params[0].value, relay_info);
st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
ts_fail_unless (st == NULL);
ts_fail_unless (error &&
@@ -754,15 +750,13 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
g_clear_error (&error);
/* no port */
- va = g_value_array_new (1);
- s = gst_structure_new ("aa",
- "ip", G_TYPE_STRING, "127.0.0.1",
- "username", G_TYPE_STRING, "blah",
- "password", G_TYPE_STRING, "blah2",
- NULL);
- g_value_take_boxed (&val, s);
- g_value_array_append (va, &val);
- g_value_take_boxed (&params[0].value, va);
+ relay_info = g_ptr_array_new_full (1, (GDestroyNotify) gst_structure_free);
+ g_ptr_array_add (relay_info,
+ gst_structure_new ("aa",
+ "ip", G_TYPE_STRING, "127.0.0.1",
+ "username", G_TYPE_STRING, "blah",
+ "pasasword", G_TYPE_STRING, "blah2",
+ NULL));
st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
ts_fail_unless (st == NULL);
ts_fail_unless (error &&
@@ -772,16 +766,15 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
/* invalid port */
- va = g_value_array_new (1);
- s = gst_structure_new ("aa",
- "ip", G_TYPE_STRING, "127.0.0.1",
- "port", G_TYPE_UINT, 65536,
- "username", G_TYPE_STRING, "blah",
- "password", G_TYPE_STRING, "blah2",
- NULL);
- g_value_take_boxed (&val, s);
- g_value_array_append (va, &val);
- g_value_take_boxed (&params[0].value, va);
+ relay_info = g_ptr_array_new_full (1, (GDestroyNotify) gst_structure_free);
+ g_ptr_array_add (relay_info,
+ gst_structure_new ("aa",
+ "ip", G_TYPE_STRING, "127.0.0.1",
+ "port", G_TYPE_UINT, 65536,
+ "username", G_TYPE_STRING, "blah",
+ "password", G_TYPE_STRING, "blah2",
+ NULL));
+ g_value_take_boxed (&params[0].value, relay_info);
st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
ts_fail_unless (st == NULL);
ts_fail_unless (error &&
@@ -790,15 +783,14 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
g_clear_error (&error);
/* no username */
- va = g_value_array_new (1);
- s = gst_structure_new ("aa",
- "ip", G_TYPE_STRING, "127.0.0.1",
- "port", G_TYPE_UINT, 7654,
- "password", G_TYPE_STRING, "blah2",
- NULL);
- g_value_take_boxed (&val, s);
- g_value_array_append (va, &val);
- g_value_take_boxed (&params[0].value, va);
+ relay_info = g_ptr_array_new_full (1, (GDestroyNotify) gst_structure_free);
+ g_ptr_array_add (relay_info,
+ gst_structure_new ("aa",
+ "ip", G_TYPE_STRING, "127.0.0.1",
+ "port", G_TYPE_UINT, 7654,
+ "password", G_TYPE_STRING, "blah2",
+ NULL));
+ g_value_take_boxed (&params[0].value, relay_info);
st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
ts_fail_unless (st == NULL);
ts_fail_unless (error &&
@@ -807,15 +799,14 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
g_clear_error (&error);
/* no password */
- va = g_value_array_new (1);
- s = gst_structure_new ("aa",
+ relay_info = g_ptr_array_new_full (1, (GDestroyNotify) gst_structure_free);
+ g_ptr_array_add (relay_info,
+ gst_structure_new ("aa",
"ip", G_TYPE_STRING, "127.0.0.1",
"port", G_TYPE_UINT, 7654,
"username", G_TYPE_STRING, "blah",
- NULL);
- g_value_take_boxed (&val, s);
- g_value_array_append (va, &val);
- g_value_take_boxed (&params[0].value, va);
+ NULL));
+ g_value_take_boxed (&params[0].value, relay_info);
st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
ts_fail_unless (st == NULL);
ts_fail_unless (error &&
@@ -824,20 +815,18 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments)
g_clear_error (&error);
/* valid */
- va = g_value_array_new (1);
- s = gst_structure_new ("aa",
- "ip", G_TYPE_STRING, "127.0.0.1",
- "port", G_TYPE_UINT, 7654,
- "username", G_TYPE_STRING, "blah",
- "password", G_TYPE_STRING, "blah2",
- NULL);
- g_value_take_boxed (&val, s);
- g_value_array_append (va, &val);
- g_value_take_boxed (&params[0].value, va);
+ relay_info = g_ptr_array_new_full (1, (GDestroyNotify) gst_structure_free);
+ g_ptr_array_add (relay_info,
+ gst_structure_new ("aa",
+ "ip", G_TYPE_STRING, "127.0.0.1",
+ "port", G_TYPE_UINT, 7654,
+ "username", G_TYPE_STRING, "blah",
+ "password", G_TYPE_STRING, "blah2",
+ NULL));
+ g_value_take_boxed (&params[0].value, relay_info);
st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error);
ts_fail_if (st == NULL);
ts_fail_unless (error == NULL);
- g_value_unset (&val);
g_value_unset (&params[0].value);
/* Valid candidate, port 0 */
diff --git a/tests/check/transmitter/shm.c b/tests/check/transmitter/shm.c
index 498e62a4..72d6d466 100644
--- a/tests/check/transmitter/shm.c
+++ b/tests/check/transmitter/shm.c
@@ -43,8 +43,8 @@ gboolean src_setup[2] = {FALSE, FALSE};
guint received_known[2] = {0, 0};
gboolean associate_on_source = TRUE;
-GMutex *test_mutex;
-GCond *cond;
+GMutex test_mutex;
+GCond cond;
gboolean done = FALSE;
guint connected_count;
@@ -119,10 +119,10 @@ static void
_state_changed (FsStreamTransmitter *st, guint component_id,
FsStreamState state, gpointer user_data)
{
- g_mutex_lock (test_mutex);
+ g_mutex_lock (&test_mutex);
connected_count++;
- g_mutex_unlock (test_mutex);
- g_cond_signal (cond);
+ g_mutex_unlock (&test_mutex);
+ g_cond_signal (&cond);
}
static void
@@ -157,10 +157,10 @@ _handoff_handler (GstElement *element, GstBuffer *buffer, GstPad *pad,
ts_fail_unless (received_known[0] == 0 && received_known[1] == 0,
"Got a known-source-packet-received signal when we shouldn't have");
- g_mutex_lock (test_mutex);
+ g_mutex_lock (&test_mutex);
done = TRUE;
- g_mutex_unlock (test_mutex);
- g_cond_signal (cond);
+ g_mutex_unlock (&test_mutex);
+ g_cond_signal (&cond);
}
}
@@ -219,8 +219,8 @@ run_shm_transmitter_test (gint flags)
done = FALSE;
connected_count = 0;
- cond = g_cond_new ();
- test_mutex = g_mutex_new ();
+ g_cond_init (&cond);
+ g_mutex_init (&test_mutex);
buffer_count[0] = 0;
buffer_count[1] = 0;
@@ -368,18 +368,18 @@ run_shm_transmitter_test (gint flags)
ts_fail_unless (ret == TRUE, "No detailed error from add_remote_candidate");
g_clear_error (&error);
- g_mutex_lock (test_mutex);
+ g_mutex_lock (&test_mutex);
while (connected_count < 2)
- g_cond_wait (cond, test_mutex);
- g_mutex_unlock (test_mutex);
+ g_cond_wait (&cond, &test_mutex);
+ g_mutex_unlock (&test_mutex);
setup_fakesrc (trans, pipeline, 1);
setup_fakesrc (trans, pipeline, 2);
- g_mutex_lock (test_mutex);
+ g_mutex_lock (&test_mutex);
while (!done)
- g_cond_wait (cond, test_mutex);
- g_mutex_unlock (test_mutex);
+ g_cond_wait (&cond, &test_mutex);
+ g_mutex_unlock (&test_mutex);
fail_unless (got_prepared[0] == TRUE);
fail_unless (got_prepared[1] == TRUE);
@@ -398,8 +398,8 @@ run_shm_transmitter_test (gint flags)
gst_object_unref (pipeline);
- g_cond_free (cond);
- g_mutex_free (test_mutex);
+ g_cond_clear (&cond);
+ g_mutex_clear (&test_mutex);
}
GST_START_TEST (test_shmtransmitter_run_basic)