Use recent GLib API unconditionally now that we depend on the latest GLib
diff --git a/gst/glib-compat-private.h b/gst/glib-compat-private.h
index 3f46b62..9a92993 100644
--- a/gst/glib-compat-private.h
+++ b/gst/glib-compat-private.h
@@ -27,40 +27,6 @@
G_BEGIN_DECLS
-#if !GLIB_CHECK_VERSION(2,25,0)
-
-#if defined (_MSC_VER) && !defined(_WIN64)
-typedef struct _stat32 GStatBuf;
-#else
-typedef struct stat GStatBuf;
-#endif
-
-#endif
-
-#if GLIB_CHECK_VERSION(2,26,0)
-#define GLIB_HAS_GDATETIME
-#endif
-
-/* See bug #651514 */
-#if GLIB_CHECK_VERSION(2,29,5)
-#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
- g_atomic_pointer_compare_and_exchange ((a),(b),(c))
-#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
- g_atomic_int_compare_and_exchange ((a),(b),(c))
-#else
-#define G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE(a,b,c) \
- g_atomic_pointer_compare_and_exchange ((volatile gpointer *)(a),(b),(c))
-#define G_ATOMIC_INT_COMPARE_AND_EXCHANGE(a,b,c) \
- g_atomic_int_compare_and_exchange ((volatile int *)(a),(b),(c))
-#endif
-
-/* See bug #651514 */
-#if GLIB_CHECK_VERSION(2,29,5)
-#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_add ((a),(b))
-#else
-#define G_ATOMIC_INT_ADD(a,b) g_atomic_int_exchange_and_add ((a),(b))
-#endif
-
/* copies */
/* adaptations */
diff --git a/gst/gst.c b/gst/gst.c
index faaeabd..d1ccd69 100644
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -360,32 +360,6 @@
{NULL}
};
-/* Since GLib 2.31.0 threading is always enabled and g_thread_init()
- * is not needed any longer and deprecated */
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- /* Since GLib 2.23.2 calling g_thread_init() 'late' is allowed and is
- * automatically done as part of g_type_init() */
- if (glib_check_version (2, 23, 3)) {
- /* The GLib threading system must be initialised before calling any other
- * GLib function according to the documentation; if the application hasn't
- * called gst_init() yet or initialised the threading system otherwise, we
- * better issue a warning here (since chances are high that the application
- * has already called other GLib functions such as g_option_context_new() */
- if (!g_thread_get_initialized ()) {
- g_warning ("The GStreamer function gst_init_get_option_group() was\n"
- "\tcalled, but the GLib threading system has not been initialised\n"
- "\tyet, something that must happen before any other GLib function\n"
- "\tis called. The application needs to be fixed so that it calls\n"
- "\t if (!g_thread_get_initialized ()) g_thread_init(NULL);\n"
- "\tas very first thing in its main() function. Please file a bug\n"
- "\tagainst this application.");
- g_thread_init (NULL);
- }
- } else {
- /* GLib >= 2.23.2 */
- }
-#endif
-
group = g_option_group_new ("gst", _("GStreamer Options"),
_("Show GStreamer Options"), NULL, NULL);
g_option_group_set_parse_hooks (group, (GOptionParseFunc) init_pre,
@@ -428,11 +402,6 @@
#endif
gboolean res;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_get_initialized ())
- g_thread_init (NULL);
-#endif
-
if (gst_initialized) {
GST_DEBUG ("already initialized gst");
return TRUE;
@@ -580,11 +549,6 @@
g_type_init ();
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- /* we need threading to be enabled right here */
- g_assert (g_thread_get_initialized ());
-#endif
-
#ifndef GST_DISABLE_GST_DEBUG
_priv_gst_debug_init ();
#endif
diff --git a/gst/gstatomicqueue.c b/gst/gstatomicqueue.c
index 5b21be6..dc75c89 100644
--- a/gst/gstatomicqueue.c
+++ b/gst/gstatomicqueue.c
@@ -113,7 +113,7 @@
{
do {
mem->free = g_atomic_pointer_get (&queue->free_list);
- } while (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->free_list,
+ } while (!g_atomic_pointer_compare_and_exchange (&queue->free_list,
mem->free, mem));
}
@@ -127,7 +127,7 @@
free_list = g_atomic_pointer_get (&queue->free_list);
if (free_list == NULL)
return;
- } while (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->free_list, free_list,
+ } while (!g_atomic_pointer_compare_and_exchange (&queue->free_list, free_list,
NULL));
while (free_list) {
@@ -248,7 +248,7 @@
/* now we try to move the next array as the head memory. If we fail to do that,
* some other reader managed to do it first and we retry */
- if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->head_mem, head_mem,
+ if (!g_atomic_pointer_compare_and_exchange (&queue->head_mem, head_mem,
next))
continue;
@@ -305,7 +305,7 @@
/* now we try to move the next array as the head memory. If we fail to do that,
* some other reader managed to do it first and we retry */
- if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->head_mem, head_mem,
+ if (!g_atomic_pointer_compare_and_exchange (&queue->head_mem, head_mem,
next))
continue;
@@ -363,7 +363,7 @@
mem = new_queue_mem ((size << 1) + 1, tail);
/* try to make our new array visible to other writers */
- if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&queue->tail_mem, tail_mem,
+ if (!g_atomic_pointer_compare_and_exchange (&queue->tail_mem, tail_mem,
mem)) {
/* we tried to swap the new writer array but something changed. This is
* because some other writer beat us to it, we free our memory and try
diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c
index 2bcd5d9..0978848 100644
--- a/gst/gstbufferpool.c
+++ b/gst/gstbufferpool.c
@@ -964,7 +964,7 @@
/* check that the buffer is ours, all buffers returned to the pool have the
* pool member set to NULL and the pool refcount decreased */
- if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&buffer->pool, pool, NULL))
+ if (!g_atomic_pointer_compare_and_exchange (&buffer->pool, pool, NULL))
return;
pclass = GST_BUFFER_POOL_GET_CLASS (pool);
diff --git a/gst/gstbus.c b/gst/gstbus.c
index fb09439..efb5269 100644
--- a/gst/gstbus.c
+++ b/gst/gstbus.c
@@ -799,9 +799,7 @@
source = (GstBusSource *) g_source_new (&gst_bus_source_funcs,
sizeof (GstBusSource));
-#if GLIB_CHECK_VERSION(2,26,0)
g_source_set_name ((GSource *) source, "GStreamer message bus watch");
-#endif
source->bus = gst_object_ref (bus);
g_source_add_poll ((GSource *) source, &bus->priv->pollfd);
diff --git a/gst/gstdatetime.c b/gst/gstdatetime.c
index 60f709f..7f6ba43 100644
--- a/gst/gstdatetime.c
+++ b/gst/gstdatetime.c
@@ -257,11 +257,14 @@
#define GST_DATE_TIME_USEC_PER_SECOND (G_GINT64_CONSTANT (1000000))
#define GST_DATE_TIME_USEC_PER_MILLISECOND (G_GINT64_CONSTANT (1000))
+/* FIXME: this bug was resolved NOTGNOME */
/* Jan 5th 2011 (Edward) : GLib's GDateTime is broken in regards to gmt offset
* on macosx. Re-enable it once the following bug is fixed:
* https://bugzilla.gnome.org/show_bug.cgi?id=638666 */
#ifdef HAVE_OSX
#undef GLIB_HAS_GDATETIME
+#else
+#define GLIB_HAS_GDATETIME
#endif
diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c
index b405f71..e18d0f3 100644
--- a/gst/gstelementfactory.c
+++ b/gst/gstelementfactory.c
@@ -381,7 +381,7 @@
* an element at the same moment
*/
oclass = GST_ELEMENT_GET_CLASS (element);
- if (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (&oclass->elementfactory, NULL,
+ if (!g_atomic_pointer_compare_and_exchange (&oclass->elementfactory, NULL,
factory))
gst_object_unref (factory);
diff --git a/gst/gsterror.c b/gst/gsterror.c
index f3f2d22..d415fcd 100644
--- a/gst/gsterror.c
+++ b/gst/gsterror.c
@@ -123,19 +123,11 @@
return quark; }
/* FIXME: Deprecate when we depend on GLib 2.26 */
+/* FIXME 0.11: remove gst_g_error_get_type() */
GType
gst_g_error_get_type (void)
{
-#if GLIB_CHECK_VERSION(2,25,2)
return g_error_get_type ();
-#else
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- type = g_boxed_type_register_static ("GstGError",
- (GBoxedCopyFunc) g_error_copy, (GBoxedFreeFunc) g_error_free);
- return type;
-#endif
}
#define FILE_A_BUG " Please file a bug at " PACKAGE_BUGREPORT "."
diff --git a/gst/gstpoll.c b/gst/gstpoll.c
index 3236085..e68b14a 100644
--- a/gst/gstpoll.c
+++ b/gst/gstpoll.c
@@ -160,8 +160,8 @@
#define IS_FLUSHING(s) (g_atomic_int_get(&(s)->flushing))
#define SET_FLUSHING(s,val) (g_atomic_int_set(&(s)->flushing, (val)))
-#define INC_WAITING(s) (G_ATOMIC_INT_ADD(&(s)->waiting, 1))
-#define DEC_WAITING(s) (G_ATOMIC_INT_ADD(&(s)->waiting, -1))
+#define INC_WAITING(s) (g_atomic_int_add(&(s)->waiting, 1))
+#define DEC_WAITING(s) (g_atomic_int_add(&(s)->waiting, -1))
#define GET_WAITING(s) (g_atomic_int_get(&(s)->waiting))
#define TEST_REBUILD(s) (g_atomic_int_compare_and_exchange(&(s)->rebuild, 1, 0))
@@ -182,7 +182,7 @@
{
gboolean result = TRUE;
- if (G_ATOMIC_INT_ADD (&set->control_pending, 1) == 0) {
+ if (g_atomic_int_add (&set->control_pending, 1) == 0) {
/* raise when nothing pending */
GST_LOG ("%p: raise", set);
result = WAKE_EVENT (set);
@@ -222,7 +222,7 @@
break;
else
/* retry again until we read it successfully */
- G_ATOMIC_INT_ADD (&set->control_pending, 1);
+ g_atomic_int_add (&set->control_pending, 1);
}
}
return old;
diff --git a/gst/gstsystemclock.c b/gst/gstsystemclock.c
index 504cd01..7da9b88 100644
--- a/gst/gstsystemclock.c
+++ b/gst/gstsystemclock.c
@@ -57,7 +57,7 @@
#define GET_ENTRY_STATUS(e) ((GstClockReturn) g_atomic_int_get(&GST_CLOCK_ENTRY_STATUS(e)))
#define SET_ENTRY_STATUS(e,val) (g_atomic_int_set(&GST_CLOCK_ENTRY_STATUS(e),(val)))
-#define CAS_ENTRY_STATUS(e,old,val) (G_ATOMIC_INT_COMPARE_AND_EXCHANGE(\
+#define CAS_ENTRY_STATUS(e,old,val) (g_atomic_int_compare_and_exchange(\
(&GST_CLOCK_ENTRY_STATUS(e)), (old), (val)))
/* Define this to get some extra debug about jitter from each clock_wait */
@@ -732,13 +732,8 @@
if (G_LIKELY (clock->thread != NULL))
return TRUE; /* Thread already running. Nothing to do */
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- clock->thread = g_thread_create ((GThreadFunc) gst_system_clock_async_thread,
- clock, TRUE, &error);
-#else
clock->thread = g_thread_try_new ("GstSystemClock",
(GThreadFunc) gst_system_clock_async_thread, clock, &error);
-#endif
if (G_UNLIKELY (error))
goto no_thread;
diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c
index 219244b..7e3de44 100644
--- a/gst/gsttaglist.c
+++ b/gst/gsttaglist.c
@@ -73,19 +73,11 @@
}
GstTagInfo;
-#if GLIB_CHECK_VERSION (2, 31, 0)
#define g_value_get_char g_value_get_schar
-#endif
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-static GMutex *__tag_mutex;
-#define TAG_LOCK g_mutex_lock (__tag_mutex)
-#define TAG_UNLOCK g_mutex_unlock (__tag_mutex)
-#else
static GMutex __tag_mutex;
#define TAG_LOCK g_mutex_lock (&__tag_mutex)
#define TAG_UNLOCK g_mutex_unlock (&__tag_mutex)
-#endif
/* tags hash table: maps tag name string => GstTagInfo */
static GHashTable *__tags;
@@ -111,11 +103,8 @@
void
_priv_gst_tag_initialize (void)
{
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- __tag_mutex = g_mutex_new ();
-#else
g_mutex_init (&__tag_mutex);
-#endif
+
__tags = g_hash_table_new (g_str_hash, g_str_equal);
gst_tag_register (GST_TAG_TITLE, GST_TAG_FLAG_META,
G_TYPE_STRING,
diff --git a/gst/gsttagsetter.c b/gst/gsttagsetter.c
index 7619495..2ed099d 100644
--- a/gst/gsttagsetter.c
+++ b/gst/gsttagsetter.c
@@ -83,20 +83,11 @@
{
GstTagMergeMode mode;
GstTagList *list;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- GStaticMutex lock;
-#else
GMutex lock;
-#endif
} GstTagData;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-#define GST_TAG_DATA_LOCK(data) g_static_mutex_lock(&data->lock)
-#define GST_TAG_DATA_UNLOCK(data) g_static_mutex_unlock(&data->lock)
-#else
#define GST_TAG_DATA_LOCK(data) g_mutex_lock(&data->lock)
#define GST_TAG_DATA_UNLOCK(data) g_mutex_unlock(&data->lock)
-#endif
GType
gst_tag_setter_get_type (void)
@@ -137,11 +128,7 @@
if (data->list)
gst_tag_list_free (data->list);
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_free (&data->lock);
-#else
g_mutex_clear (&data->lock);
-#endif
g_slice_free (GstTagData, data);
}
@@ -154,34 +141,21 @@
data = g_object_get_qdata (G_OBJECT (setter), gst_tag_key);
if (!data) {
/* make sure no other thread is creating a GstTagData at the same time */
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- static GStaticMutex create_mutex = G_STATIC_MUTEX_INIT;
-
- g_static_mutex_lock (&create_mutex);
-#else
static GMutex create_mutex; /* no initialisation required */
g_mutex_lock (&create_mutex);
-#endif
data = g_object_get_qdata (G_OBJECT (setter), gst_tag_key);
if (!data) {
data = g_slice_new (GstTagData);
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_init (&data->lock);
-#else
g_mutex_init (&data->lock);
-#endif
data->list = NULL;
data->mode = GST_TAG_MERGE_KEEP;
g_object_set_qdata_full (G_OBJECT (setter), gst_tag_key, data,
gst_tag_data_free);
}
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_unlock (&create_mutex);
-#else
+
g_mutex_unlock (&create_mutex);
-#endif
}
return data;
diff --git a/gst/gsttask.c b/gst/gsttask.c
index 444b292..2e5ce2b 100644
--- a/gst/gsttask.c
+++ b/gst/gsttask.c
@@ -277,11 +277,7 @@
task->thread = tself;
/* only update the priority when it was changed */
if (priv->prio_set) {
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_thread_set_priority (tself, priv->priority);
-#else
GST_INFO_OBJECT (task, "Thread priorities no longer have any effect");
-#endif
}
GST_OBJECT_UNLOCK (task);
@@ -330,12 +326,6 @@
GST_OBJECT_UNLOCK (task);
priv->thr_callbacks.leave_thread (task, tself, priv->thr_user_data);
GST_OBJECT_LOCK (task);
- } else {
- /* restore normal priority when releasing back into the pool, we will not
- * touch the priority when a custom callback has been installed. */
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_thread_set_priority (tself, G_THREAD_PRIORITY_NORMAL);
-#endif
}
/* now we allow messing with the lock again by setting the running flag to
* FALSE. Together with the SIGNAL this is the sign for the _join() to
@@ -460,6 +450,7 @@
*
* Since: 0.10.24
*/
+/* FIXME 0.11: remove gst_task_set_priority() */
void
gst_task_set_priority (GstTask * task, GThreadPriority priority)
{
@@ -477,11 +468,7 @@
if (thread != NULL) {
/* if this task already has a thread, we can configure the priority right
* away, else we do that when we assign a thread to the task. */
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_thread_set_priority (thread, priority);
-#else
GST_INFO_OBJECT (task, "Thread priorities no longer have any effect");
-#endif
}
GST_OBJECT_UNLOCK (task);
}
diff --git a/gst/gstutils.c b/gst/gstutils.c
index f6a3474..52c0a86 100644
--- a/gst/gstutils.c
+++ b/gst/gstutils.c
@@ -704,7 +704,7 @@
gst_util_seqnum_next (void)
{
static gint counter = 0;
- return G_ATOMIC_INT_ADD (&counter, 1);
+ return g_atomic_int_add (&counter, 1);
}
/**
diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c
index 5370281..82c8127 100644
--- a/libs/gst/base/gstbaseparse.c
+++ b/libs/gst/base/gstbaseparse.c
@@ -289,11 +289,7 @@
GstIndex *index;
gint index_id;
gboolean own_index;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- GStaticMutex index_lock;
-#else
GMutex index_lock;
-#endif
/* seek table entries only maintained if upstream is BYTE seekable */
gboolean upstream_seekable;
@@ -342,17 +338,10 @@
GstClockTime start_ts;
} GstBaseParseSeek;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-#define GST_BASE_PARSE_INDEX_LOCK(parse) \
- g_static_mutex_lock (&parse->priv->index_lock);
-#define GST_BASE_PARSE_INDEX_UNLOCK(parse) \
- g_static_mutex_unlock (&parse->priv->index_lock);
-#else
#define GST_BASE_PARSE_INDEX_LOCK(parse) \
g_mutex_lock (&parse->priv->index_lock);
#define GST_BASE_PARSE_INDEX_UNLOCK(parse) \
g_mutex_unlock (&parse->priv->index_lock);
-#endif
static GstElementClass *parent_class = NULL;
@@ -500,11 +489,7 @@
gst_object_unref (parse->priv->index);
parse->priv->index = NULL;
}
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_free (&parse->priv->index_lock);
-#else
g_mutex_clear (&parse->priv->index_lock);
-#endif
gst_base_parse_clear_queues (parse);
@@ -586,11 +571,7 @@
parse->priv->pad_mode = GST_PAD_MODE_NONE;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_static_mutex_init (&parse->priv->index_lock);
-#else
g_mutex_init (&parse->priv->index_lock);
-#endif
/* init state */
gst_base_parse_reset (parse);
diff --git a/libs/gst/helpers/gst-plugin-scanner.c b/libs/gst/helpers/gst-plugin-scanner.c
index d54c656..09cb852 100644
--- a/libs/gst/helpers/gst-plugin-scanner.c
+++ b/libs/gst/helpers/gst-plugin-scanner.c
@@ -41,11 +41,6 @@
if (argc != 2 || strcmp (argv[1], "-l"))
return 1;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- if (!g_thread_supported ())
- g_thread_init (NULL);
-#endif
-
my_argc = 2;
my_argv = g_malloc (my_argc * sizeof (char *));
my_argv[0] = argv[0];
diff --git a/libs/gst/net/gstnetclientclock.c b/libs/gst/net/gstnetclientclock.c
index 1121051..59b24a9 100644
--- a/libs/gst/net/gstnetclientclock.c
+++ b/libs/gst/net/gstnetclientclock.c
@@ -465,13 +465,8 @@
self->priv->socket = socket;
self->priv->servaddr = G_SOCKET_ADDRESS (servaddr);
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- self->priv->thread = g_thread_create (gst_net_client_clock_thread, self, TRUE,
- &error);
-#else
self->priv->thread = g_thread_try_new ("GstNetClientClock",
gst_net_client_clock_thread, self, &error);
-#endif
if (error != NULL)
goto no_thread;
diff --git a/libs/gst/net/gstnettimeprovider.c b/libs/gst/net/gstnettimeprovider.c
index 3683b24..f008c00 100644
--- a/libs/gst/net/gstnettimeprovider.c
+++ b/libs/gst/net/gstnettimeprovider.c
@@ -319,13 +319,8 @@
self->priv->socket = socket;
self->priv->cancel = g_cancellable_new ();
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- self->priv->thread =
- g_thread_create (gst_net_time_provider_thread, self, TRUE, &err);
-#else
self->priv->thread = g_thread_try_new ("GstNetTimeProvider",
gst_net_time_provider_thread, self, &err);
-#endif
if (err != NULL)
goto no_thread;
diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c
index b08e63a..09c213c 100644
--- a/plugins/elements/gstfakesink.c
+++ b/plugins/elements/gstfakesink.c
@@ -271,9 +271,6 @@
fakesink->state_error = DEFAULT_STATE_ERROR;
fakesink->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
fakesink->num_buffers = DEFAULT_NUM_BUFFERS;
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_static_rec_mutex_init (&fakesink->notify_lock);
-#endif
gst_base_sink_set_sync (GST_BASE_SINK (fakesink), DEFAULT_SYNC);
}
@@ -281,12 +278,6 @@
static void
gst_fake_sink_finalize (GObject * obj)
{
-#if !GLIB_CHECK_VERSION(2,26,0)
- GstFakeSink *sink = GST_FAKE_SINK (obj);
-
- g_static_rec_mutex_free (&sink->notify_lock);
-#endif
-
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
@@ -370,19 +361,7 @@
static void
gst_fake_sink_notify_last_message (GstFakeSink * sink)
{
- /* FIXME: this hacks around a bug in GLib/GObject: doing concurrent
- * g_object_notify() on the same object might lead to crashes, see
- * http://bugzilla.gnome.org/show_bug.cgi?id=166020#c60 and follow-ups.
- * So we really don't want to do a g_object_notify() here for out-of-band
- * events with the streaming thread possibly also doing a g_object_notify()
- * for an in-band buffer or event. This is fixed in GLib >= 2.26 */
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_static_rec_mutex_lock (&sink->notify_lock);
- g_object_notify ((GObject *) sink, "last-message");
- g_static_rec_mutex_unlock (&sink->notify_lock);
-#else
g_object_notify_by_pspec ((GObject *) sink, pspec_last_message);
-#endif
}
static gboolean
diff --git a/plugins/elements/gstfakesink.h b/plugins/elements/gstfakesink.h
index b1165af..2db98b9 100644
--- a/plugins/elements/gstfakesink.h
+++ b/plugins/elements/gstfakesink.h
@@ -82,9 +82,6 @@
gchar *last_message;
gint num_buffers;
gint num_buffers_left;
-#if !GLIB_CHECK_VERSION(2,26,0)
- GStaticRecMutex notify_lock;
-#endif
};
struct _GstFakeSinkClass {
diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c
index 4dee64a..4cca62c 100644
--- a/plugins/elements/gstfakesrc.c
+++ b/plugins/elements/gstfakesrc.c
@@ -446,11 +446,7 @@
g_free (sstr);
GST_OBJECT_UNLOCK (src);
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_object_notify ((GObject *) src, "last-message");
-#else
g_object_notify_by_pspec ((GObject *) src, pspec_last_message);
-#endif
}
return GST_BASE_SRC_CLASS (parent_class)->event (basesrc, event);
@@ -881,11 +877,7 @@
GST_MINI_OBJECT_CAST (buf)->flags, flag_str, buf);
GST_OBJECT_UNLOCK (src);
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_object_notify ((GObject *) src, "last-message");
-#else
g_object_notify_by_pspec ((GObject *) src, pspec_last_message);
-#endif
}
if (src->signal_handoffs) {
diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c
index 2a3350d..aa4873e 100644
--- a/plugins/elements/gstidentity.c
+++ b/plugins/elements/gstidentity.c
@@ -128,10 +128,6 @@
g_free (identity->last_message);
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_static_rec_mutex_free (&identity->notify_lock);
-#endif
-
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -298,29 +294,13 @@
identity->last_message = NULL;
identity->signal_handoffs = DEFAULT_SIGNAL_HANDOFFS;
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_static_rec_mutex_init (&identity->notify_lock);
-#endif
-
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM_CAST (identity), TRUE);
}
static void
gst_identity_notify_last_message (GstIdentity * identity)
{
- /* FIXME: this hacks around a bug in GLib/GObject: doing concurrent
- * g_object_notify() on the same object might lead to crashes, see
- * http://bugzilla.gnome.org/show_bug.cgi?id=166020#c60 and follow-ups.
- * So we really don't want to do a g_object_notify() here for out-of-band
- * events with the streaming thread possibly also doing a g_object_notify()
- * for an in-band buffer or event. This is fixed in GLib >= 2.26 */
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_static_rec_mutex_lock (&identity->notify_lock);
- g_object_notify ((GObject *) identity, "last-message");
- g_static_rec_mutex_unlock (&identity->notify_lock);
-#else
g_object_notify_by_pspec ((GObject *) identity, pspec_last_message);
-#endif
}
static gboolean
diff --git a/plugins/elements/gstidentity.h b/plugins/elements/gstidentity.h
index a608d2b..fabc667 100644
--- a/plugins/elements/gstidentity.h
+++ b/plugins/elements/gstidentity.h
@@ -73,10 +73,6 @@
gchar *last_message;
guint64 offset;
gboolean signal_handoffs;
-
-#if !GLIB_CHECK_VERSION(2,26,0)
- GStaticRecMutex notify_lock;
-#endif
};
struct _GstIdentityClass {
diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c
index 5f70f6e..3bd4f22 100644
--- a/plugins/elements/gstinputselector.c
+++ b/plugins/elements/gstinputselector.c
@@ -64,15 +64,6 @@
GST_DEBUG_CATEGORY_STATIC (input_selector_debug);
#define GST_CAT_DEFAULT input_selector_debug
-#if GLIB_CHECK_VERSION(2, 26, 0)
-#define NOTIFY_MUTEX_LOCK()
-#define NOTIFY_MUTEX_UNLOCK()
-#else
-static GStaticRecMutex notify_mutex = G_STATIC_REC_MUTEX_INIT;
-#define NOTIFY_MUTEX_LOCK() g_rec_mutex_lock (¬ify_mutex)
-#define NOTIFY_MUTEX_UNLOCK() g_rec_mutex_unlock (¬ify_mutex)
-#endif
-
static GstStaticPadTemplate gst_input_selector_sink_factory =
GST_STATIC_PAD_TEMPLATE ("sink_%u",
GST_PAD_SINK,
@@ -370,9 +361,7 @@
GST_INPUT_SELECTOR_UNLOCK (sel);
if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) {
- NOTIFY_MUTEX_LOCK ();
g_object_notify (G_OBJECT (sel), "active-pad");
- NOTIFY_MUTEX_UNLOCK ();
}
switch (GST_EVENT_TYPE (event)) {
@@ -683,9 +672,7 @@
GST_INPUT_SELECTOR_UNLOCK (sel);
if (prev_active_sinkpad != active_sinkpad && pad == active_sinkpad) {
- NOTIFY_MUTEX_LOCK ();
g_object_notify (G_OBJECT (sel), "active-pad");
- NOTIFY_MUTEX_UNLOCK ();
}
if (start_event)
diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c
index 1b4f4b9..c5b24e0 100644
--- a/plugins/elements/gstmultiqueue.c
+++ b/plugins/elements/gstmultiqueue.c
@@ -1346,7 +1346,7 @@
goto was_eos;
/* Get a unique incrementing id */
- curid = G_ATOMIC_INT_ADD ((gint *) & mq->counter, 1);
+ curid = g_atomic_int_add ((gint *) & mq->counter, 1);
GST_LOG_OBJECT (mq, "SingleQueue %d : about to enqueue buffer %p with id %d",
sq->id, buffer, curid);
@@ -1462,7 +1462,7 @@
goto was_eos;
/* Get an unique incrementing id. */
- curid = G_ATOMIC_INT_ADD ((gint *) & mq->counter, 1);
+ curid = g_atomic_int_add ((gint *) & mq->counter, 1);
item = gst_multi_queue_event_item_new ((GstMiniObject *) event, curid);
diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c
index 498f858..f4633e8 100644
--- a/plugins/elements/gsttee.c
+++ b/plugins/elements/gsttee.c
@@ -273,11 +273,7 @@
static void
gst_tee_notify_alloc_pad (GstTee * tee)
{
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_object_notify ((GObject *) tee, "alloc-pad");
-#else
g_object_notify_by_pspec ((GObject *) tee, pspec_alloc_pad);
-#endif
}
static gboolean
@@ -529,11 +525,7 @@
}
GST_OBJECT_UNLOCK (tee);
-#if !GLIB_CHECK_VERSION(2,26,0)
- g_object_notify ((GObject *) tee, "last-message");
-#else
g_object_notify_by_pspec ((GObject *) tee, pspec_last_message);
-#endif
}
static GstFlowReturn
diff --git a/tests/benchmarks/gstbufferstress.c b/tests/benchmarks/gstbufferstress.c
index b5c2997..d17191d 100644
--- a/tests/benchmarks/gstbufferstress.c
+++ b/tests/benchmarks/gstbufferstress.c
@@ -96,12 +96,9 @@
for (t = 0; t < num_threads; t++) {
GError *error = NULL;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- threads[t] = g_thread_create (run_test, GINT_TO_POINTER (t), TRUE, &error);
-#else
threads[t] = g_thread_try_new ("bufferstresstest", run_test,
GINT_TO_POINTER (t), &error);
-#endif
+
if (error) {
printf ("ERROR: g_thread_create() %s\n", error->message);
exit (-1);
diff --git a/tests/benchmarks/gstclockstress.c b/tests/benchmarks/gstclockstress.c
index 60895d9..6abd7d9 100644
--- a/tests/benchmarks/gstclockstress.c
+++ b/tests/benchmarks/gstclockstress.c
@@ -35,7 +35,7 @@
while (running) {
gst_clock_get_time (sysclock);
- prev = G_ATOMIC_INT_ADD (&count, 1);
+ prev = g_atomic_int_add (&count, 1);
if (prev == G_MAXINT)
g_warning ("overflow");
}
@@ -65,12 +65,9 @@
for (t = 0; t < num_threads; t++) {
GError *error = NULL;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- threads[t] = g_thread_create (run_test, sysclock, TRUE, &error);
-#else
threads[t] = g_thread_try_new ("clockstresstest", run_test,
sysclock, &error);
-#endif
+
if (error) {
printf ("ERROR: g_thread_create() %s\n", error->message);
exit (-1);
diff --git a/tests/benchmarks/gstpollstress.c b/tests/benchmarks/gstpollstress.c
index 807737d..dfd9caf 100644
--- a/tests/benchmarks/gstpollstress.c
+++ b/tests/benchmarks/gstpollstress.c
@@ -160,12 +160,9 @@
for (t = 0; t < num_threads; t++) {
GError *error = NULL;
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- threads[t] = g_thread_create (run_test, GINT_TO_POINTER (t), TRUE, &error);
-#else
threads[t] = g_thread_try_new ("pollstresstest", run_test,
GINT_TO_POINTER (t), &error);
-#endif
+
if (error) {
printf ("ERROR: g_thread_create() %s\n", error->message);
exit (-1);
diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c
index 37684cf..a2f9393 100644
--- a/tools/gst-inspect.c
+++ b/tools/gst-inspect.c
@@ -1527,10 +1527,6 @@
textdomain (GETTEXT_PACKAGE);
#endif
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_thread_init (NULL);
-#endif
-
gst_tools_set_prgname ("gst-inspect");
#ifndef GST_DISABLE_OPTION_PARSING
diff --git a/tools/gst-launch.c b/tools/gst-launch.c
index 5a54f1c..3ea4fff 100644
--- a/tools/gst-launch.c
+++ b/tools/gst-launch.c
@@ -873,10 +873,6 @@
textdomain (GETTEXT_PACKAGE);
#endif
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_thread_init (NULL);
-#endif
-
gst_tools_set_prgname ("gst-launch");
#ifndef GST_DISABLE_OPTION_PARSING
diff --git a/tools/gst-typefind.c b/tools/gst-typefind.c
index 123f395..a466859 100644
--- a/tools/gst-typefind.c
+++ b/tools/gst-typefind.c
@@ -153,10 +153,6 @@
textdomain (GETTEXT_PACKAGE);
#endif
-#if !GLIB_CHECK_VERSION (2, 31, 0)
- g_thread_init (NULL);
-#endif
-
gst_tools_set_prgname ("gst-typefind");
ctx = g_option_context_new ("FILES");