+2007-07-16 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * tests/check/elements/multiqueue.c: (mq_dummypad_chain),
+ (mq_dummypad_event), (run_output_order_test):
+ Use a GStaticMutex to protect all cases where libcheck
+ fail_if/fail_unless macros might be called from multiple threads
+ simultaneously to avoid errors like:
+ "check_pack.c:107: :-1081725400:Bad message type arg"
+
2007-07-16 Jan Schmidt <thaytan@mad.scientist.com>
* tests/check/pipelines/stress.c: (GST_START_TEST):
#include <gst/check/gstcheck.h>
+static GStaticMutex _check_lock = G_STATIC_MUTEX_INIT;
+
static GstElement *
setup_multiqueue (GstElement * pipe, GstElement * inputs[],
GstElement * outputs[], guint num)
struct PadData *pad_data;
pad_data = gst_pad_get_element_private (sinkpad);
- fail_if (pad_data == NULL);
+ g_static_mutex_lock (&_check_lock);
+ fail_if (pad_data == NULL);
/* Read an ID from the first 4 bytes of the buffer data and check it's
* what we expect */
fail_unless (GST_BUFFER_SIZE (buf) >= 4);
+ g_static_mutex_unlock (&_check_lock);
cur_id = GST_READ_UINT32_BE (GST_BUFFER_DATA (buf));
g_mutex_lock (pad_data->mutex);
if (!pad_data->is_linked) {
/* If there are no linked pads, we can't track a max_id for them :) */
if (pad_data->n_linked > 0) {
+ g_static_mutex_lock (&_check_lock);
fail_unless (cur_id <= *(pad_data->max_linked_id_ptr) + 1,
"Got buffer %u on pad %u before buffer %u was seen on a "
"linked pad (max: %u)", cur_id, pad_data->pad_num, cur_id - 1,
*(pad_data->max_linked_id_ptr));
+ g_static_mutex_unlock (&_check_lock);
}
} else {
/* Update the max_id value */
struct PadData *pad_data;
pad_data = gst_pad_get_element_private (sinkpad);
+ g_static_mutex_lock (&_check_lock);
fail_if (pad_data == NULL);
+ g_static_mutex_unlock (&_check_lock);
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
g_mutex_lock (pad_data->mutex);
cur_pad = pad_pattern[i % n];
buf = gst_buffer_new_and_alloc (4);
+ g_static_mutex_lock (&_check_lock);
fail_if (buf == NULL);
+ g_static_mutex_unlock (&_check_lock);
GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf), i);
ret = gst_pad_push (inputpads[cur_pad], buf);
+ g_static_mutex_lock (&_check_lock);
if (pad_data[cur_pad].is_linked) {
fail_unless (ret == GST_FLOW_OK,
"Push on pad %d returned %d when FLOW_OK was expected", cur_pad, ret);
"Push on pad %d returned %d when FLOW_OK or NOT_LINKED was expected",
cur_pad, ret);
}
+ g_static_mutex_unlock (&_check_lock);
}
for (i = 0; i < NPADS; i++) {
gst_pad_push_event (inputpads[i], gst_event_new_eos ());