mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
Replace deprecated GStaticMutex with GMutex
https://bugzilla.gnome.org/show_bug.cgi?id=662207
This commit is contained in:
parent
8c832a5e45
commit
2c8c44976f
8 changed files with 90 additions and 90 deletions
|
@ -37,7 +37,7 @@
|
|||
#include "gstformat.h"
|
||||
#include "gstenumtypes.h"
|
||||
|
||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex mutex;
|
||||
static GList *_gst_formats = NULL;
|
||||
static GHashTable *_nick_to_format = NULL;
|
||||
static GHashTable *_format_to_nick = NULL;
|
||||
|
@ -57,7 +57,7 @@ _priv_gst_format_initialize (void)
|
|||
{
|
||||
GstFormatDefinition *standards = standard_definitions;
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
if (_nick_to_format == NULL) {
|
||||
_nick_to_format = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
_format_to_nick = g_hash_table_new (NULL, NULL);
|
||||
|
@ -76,7 +76,7 @@ _priv_gst_format_initialize (void)
|
|||
}
|
||||
/* getting the type registers the enum */
|
||||
g_type_class_ref (gst_format_get_type ());
|
||||
g_static_mutex_unlock (&mutex);
|
||||
g_mutex_unlock (&mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +151,7 @@ gst_format_register (const gchar * nick, const gchar * description)
|
|||
if (query != GST_FORMAT_UNDEFINED)
|
||||
return query;
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
format = g_slice_new (GstFormatDefinition);
|
||||
format->value = (GstFormat) _n_values;
|
||||
format->nick = g_strdup (nick);
|
||||
|
@ -163,7 +163,7 @@ gst_format_register (const gchar * nick, const gchar * description)
|
|||
format);
|
||||
_gst_formats = g_list_append (_gst_formats, format);
|
||||
_n_values++;
|
||||
g_static_mutex_unlock (&mutex);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
return format->value;
|
||||
}
|
||||
|
@ -184,9 +184,9 @@ gst_format_get_by_nick (const gchar * nick)
|
|||
|
||||
g_return_val_if_fail (nick != NULL, GST_FORMAT_UNDEFINED);
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
format = g_hash_table_lookup (_nick_to_format, nick);
|
||||
g_static_mutex_unlock (&mutex);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
if (format != NULL)
|
||||
return format->value;
|
||||
|
@ -234,9 +234,9 @@ gst_format_get_details (GstFormat format)
|
|||
{
|
||||
const GstFormatDefinition *result;
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
result = g_hash_table_lookup (_format_to_nick, GINT_TO_POINTER (format));
|
||||
g_static_mutex_unlock (&mutex);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -254,11 +254,11 @@ gst_format_iterate_definitions (void)
|
|||
{
|
||||
GstIterator *result;
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
/* FIXME: register a boxed type for GstFormatDefinition */
|
||||
result = gst_iterator_new_list (G_TYPE_POINTER,
|
||||
g_static_mutex_get_mutex (&mutex), &_n_values, &_gst_formats, NULL, NULL);
|
||||
g_static_mutex_unlock (&mutex);
|
||||
&mutex, &_n_values, &_gst_formats, NULL, NULL);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ struct _GstDebugMessage
|
|||
};
|
||||
|
||||
/* list of all name/level pairs from --gst-debug and GST_DEBUG */
|
||||
static GStaticMutex __level_name_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex __level_name_mutex;
|
||||
static GSList *__level_name = NULL;
|
||||
typedef struct
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ typedef struct
|
|||
LevelNameEntry;
|
||||
|
||||
/* list of all categories */
|
||||
static GStaticMutex __cat_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex __cat_mutex;
|
||||
static GSList *__categories = NULL;
|
||||
|
||||
/* all registered debug handlers */
|
||||
|
@ -259,7 +259,7 @@ typedef struct
|
|||
gpointer user_data;
|
||||
}
|
||||
LogFuncEntry;
|
||||
static GStaticMutex __log_func_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex __log_func_mutex;
|
||||
static GSList *__log_functions = NULL;
|
||||
|
||||
#define PRETTY_TAGS_DEFAULT TRUE
|
||||
|
@ -977,13 +977,13 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
|||
/* colors, windows. We take a lock to keep colors and content together.
|
||||
* Maybe there is a better way but for now this will do the right
|
||||
* thing. */
|
||||
static GStaticMutex win_print_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex win_print_mutex;
|
||||
const gint clear = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
||||
#define SET_COLOR(c) G_STMT_START { \
|
||||
if (log_file == stderr) \
|
||||
SetConsoleTextAttribute (GetStdHandle (STD_ERROR_HANDLE), (c)); \
|
||||
} G_STMT_END
|
||||
g_static_mutex_lock (&win_print_mutex);
|
||||
g_mutex_lock (&win_print_mutex);
|
||||
/* timestamp */
|
||||
fprintf (log_file, "%" GST_TIME_FORMAT " ", GST_TIME_ARGS (elapsed));
|
||||
fflush (log_file);
|
||||
|
@ -1009,7 +1009,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
|||
SET_COLOR (clear);
|
||||
fprintf (log_file, " %s\n", gst_debug_message_get (message));
|
||||
fflush (log_file);
|
||||
g_static_mutex_unlock (&win_print_mutex);
|
||||
g_mutex_unlock (&win_print_mutex);
|
||||
#endif
|
||||
} else {
|
||||
/* no color, all platforms */
|
||||
|
@ -1087,10 +1087,10 @@ gst_debug_add_log_function (GstLogFunction func, gpointer data)
|
|||
* It'd probably be clever to use some kind of RCU here, but I don't know
|
||||
* anything about that.
|
||||
*/
|
||||
g_static_mutex_lock (&__log_func_mutex);
|
||||
g_mutex_lock (&__log_func_mutex);
|
||||
list = g_slist_copy (__log_functions);
|
||||
__log_functions = g_slist_prepend (list, entry);
|
||||
g_static_mutex_unlock (&__log_func_mutex);
|
||||
g_mutex_unlock (&__log_func_mutex);
|
||||
|
||||
GST_DEBUG ("prepended log function %p (user data %p) to log functions",
|
||||
func, data);
|
||||
|
@ -1119,7 +1119,7 @@ gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
|
|||
GSList *new;
|
||||
guint removals = 0;
|
||||
|
||||
g_static_mutex_lock (&__log_func_mutex);
|
||||
g_mutex_lock (&__log_func_mutex);
|
||||
new = __log_functions;
|
||||
while ((found = g_slist_find_custom (new, data, func))) {
|
||||
if (new == __log_functions) {
|
||||
|
@ -1134,7 +1134,7 @@ gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
|
|||
}
|
||||
/* FIXME: We leak the old list here. See _add_log_function for why. */
|
||||
__log_functions = new;
|
||||
g_static_mutex_unlock (&__log_func_mutex);
|
||||
g_mutex_unlock (&__log_func_mutex);
|
||||
|
||||
return removals;
|
||||
}
|
||||
|
@ -1282,7 +1282,7 @@ gst_debug_reset_threshold (gpointer category, gpointer unused)
|
|||
GstDebugCategory *cat = (GstDebugCategory *) category;
|
||||
GSList *walk;
|
||||
|
||||
g_static_mutex_lock (&__level_name_mutex);
|
||||
g_mutex_lock (&__level_name_mutex);
|
||||
walk = __level_name;
|
||||
while (walk) {
|
||||
LevelNameEntry *entry = walk->data;
|
||||
|
@ -1298,15 +1298,15 @@ gst_debug_reset_threshold (gpointer category, gpointer unused)
|
|||
gst_debug_category_set_threshold (cat, gst_debug_get_default_threshold ());
|
||||
|
||||
exit:
|
||||
g_static_mutex_unlock (&__level_name_mutex);
|
||||
g_mutex_unlock (&__level_name_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_debug_reset_all_thresholds (void)
|
||||
{
|
||||
g_static_mutex_lock (&__cat_mutex);
|
||||
g_mutex_lock (&__cat_mutex);
|
||||
g_slist_foreach (__categories, gst_debug_reset_threshold, NULL);
|
||||
g_static_mutex_unlock (&__cat_mutex);
|
||||
g_mutex_unlock (&__cat_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1342,12 +1342,12 @@ gst_debug_set_threshold_for_name (const gchar * name, GstDebugLevel level)
|
|||
entry = g_slice_new (LevelNameEntry);
|
||||
entry->pat = pat;
|
||||
entry->level = level;
|
||||
g_static_mutex_lock (&__level_name_mutex);
|
||||
g_mutex_lock (&__level_name_mutex);
|
||||
__level_name = g_slist_prepend (__level_name, entry);
|
||||
g_static_mutex_unlock (&__level_name_mutex);
|
||||
g_static_mutex_lock (&__cat_mutex);
|
||||
g_mutex_unlock (&__level_name_mutex);
|
||||
g_mutex_lock (&__cat_mutex);
|
||||
g_slist_foreach (__categories, for_each_threshold_by_entry, entry);
|
||||
g_static_mutex_unlock (&__cat_mutex);
|
||||
g_mutex_unlock (&__cat_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1365,7 +1365,7 @@ gst_debug_unset_threshold_for_name (const gchar * name)
|
|||
g_return_if_fail (name != NULL);
|
||||
|
||||
pat = g_pattern_spec_new (name);
|
||||
g_static_mutex_lock (&__level_name_mutex);
|
||||
g_mutex_lock (&__level_name_mutex);
|
||||
walk = __level_name;
|
||||
/* improve this if you want, it's mighty slow */
|
||||
while (walk) {
|
||||
|
@ -1379,7 +1379,7 @@ gst_debug_unset_threshold_for_name (const gchar * name)
|
|||
walk = __level_name;
|
||||
}
|
||||
}
|
||||
g_static_mutex_unlock (&__level_name_mutex);
|
||||
g_mutex_unlock (&__level_name_mutex);
|
||||
g_pattern_spec_free (pat);
|
||||
gst_debug_reset_all_thresholds ();
|
||||
}
|
||||
|
@ -1404,9 +1404,9 @@ _gst_debug_category_new (const gchar * name, guint color,
|
|||
gst_debug_reset_threshold (cat, NULL);
|
||||
|
||||
/* add to category list */
|
||||
g_static_mutex_lock (&__cat_mutex);
|
||||
g_mutex_lock (&__cat_mutex);
|
||||
__categories = g_slist_prepend (__categories, cat);
|
||||
g_static_mutex_unlock (&__cat_mutex);
|
||||
g_mutex_unlock (&__cat_mutex);
|
||||
|
||||
return cat;
|
||||
}
|
||||
|
@ -1424,9 +1424,9 @@ gst_debug_category_free (GstDebugCategory * category)
|
|||
return;
|
||||
|
||||
/* remove from category list */
|
||||
g_static_mutex_lock (&__cat_mutex);
|
||||
g_mutex_lock (&__cat_mutex);
|
||||
__categories = g_slist_remove (__categories, category);
|
||||
g_static_mutex_unlock (&__cat_mutex);
|
||||
g_mutex_unlock (&__cat_mutex);
|
||||
|
||||
g_free ((gpointer) category->name);
|
||||
g_free ((gpointer) category->description);
|
||||
|
@ -1549,9 +1549,9 @@ gst_debug_get_all_categories (void)
|
|||
{
|
||||
GSList *ret;
|
||||
|
||||
g_static_mutex_lock (&__cat_mutex);
|
||||
g_mutex_lock (&__cat_mutex);
|
||||
ret = g_slist_copy (__categories);
|
||||
g_static_mutex_unlock (&__cat_mutex);
|
||||
g_mutex_unlock (&__cat_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1574,7 +1574,7 @@ _gst_debug_get_category (const gchar * name)
|
|||
/*** FUNCTION POINTERS ********************************************************/
|
||||
|
||||
static GHashTable *__gst_function_pointers; /* NULL */
|
||||
static GStaticMutex __dbg_functions_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex __dbg_functions_mutex;
|
||||
|
||||
/* This function MUST NOT return NULL */
|
||||
const gchar *
|
||||
|
@ -1589,14 +1589,14 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr func)
|
|||
if (G_UNLIKELY (func == NULL))
|
||||
return "(NULL)";
|
||||
|
||||
g_static_mutex_lock (&__dbg_functions_mutex);
|
||||
g_mutex_lock (&__dbg_functions_mutex);
|
||||
if (G_LIKELY (__gst_function_pointers)) {
|
||||
ptrname = g_hash_table_lookup (__gst_function_pointers, (gpointer) func);
|
||||
g_static_mutex_unlock (&__dbg_functions_mutex);
|
||||
g_mutex_unlock (&__dbg_functions_mutex);
|
||||
if (G_LIKELY (ptrname))
|
||||
return ptrname;
|
||||
} else {
|
||||
g_static_mutex_unlock (&__dbg_functions_mutex);
|
||||
g_mutex_unlock (&__dbg_functions_mutex);
|
||||
}
|
||||
/* we need to create an entry in the hash table for this one so we don't leak
|
||||
* the name */
|
||||
|
@ -1621,14 +1621,14 @@ _gst_debug_register_funcptr (GstDebugFuncPtr func, const gchar * ptrname)
|
|||
{
|
||||
gpointer ptr = (gpointer) func;
|
||||
|
||||
g_static_mutex_lock (&__dbg_functions_mutex);
|
||||
g_mutex_lock (&__dbg_functions_mutex);
|
||||
|
||||
if (!__gst_function_pointers)
|
||||
__gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
if (!g_hash_table_lookup (__gst_function_pointers, ptr))
|
||||
g_hash_table_insert (__gst_function_pointers, ptr, (gpointer) ptrname);
|
||||
|
||||
g_static_mutex_unlock (&__dbg_functions_mutex);
|
||||
g_mutex_unlock (&__dbg_functions_mutex);
|
||||
}
|
||||
|
||||
/*** PRINTF EXTENSIONS ********************************************************/
|
||||
|
|
|
@ -659,7 +659,7 @@ check_release_datetime (const gchar * date_time)
|
|||
return (*date_time == '\0');
|
||||
}
|
||||
|
||||
static GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex gst_plugin_loading_mutex;
|
||||
|
||||
#define CHECK_PLUGIN_DESC_FIELD(desc,field,fn) \
|
||||
if (G_UNLIKELY ((desc)->field == NULL)) { \
|
||||
|
@ -692,13 +692,13 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
|||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
registry = gst_registry_get ();
|
||||
g_static_mutex_lock (&gst_plugin_loading_mutex);
|
||||
g_mutex_lock (&gst_plugin_loading_mutex);
|
||||
|
||||
plugin = gst_registry_lookup (registry, filename);
|
||||
if (plugin) {
|
||||
if (plugin->module) {
|
||||
/* already loaded */
|
||||
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
||||
g_mutex_unlock (&gst_plugin_loading_mutex);
|
||||
return plugin;
|
||||
} else {
|
||||
/* load plugin and update fields */
|
||||
|
@ -836,14 +836,14 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
|||
gst_registry_add_plugin (gst_registry_get (), plugin);
|
||||
}
|
||||
|
||||
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
||||
g_mutex_unlock (&gst_plugin_loading_mutex);
|
||||
return plugin;
|
||||
|
||||
return_error:
|
||||
{
|
||||
if (plugin)
|
||||
gst_object_unref (plugin);
|
||||
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
||||
g_mutex_unlock (&gst_plugin_loading_mutex);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ typedef struct
|
|||
|
||||
#define GST_QUERY_STRUCTURE(q) (((GstQueryImpl *)(q))->structure)
|
||||
|
||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex mutex;
|
||||
static GList *_gst_queries = NULL;
|
||||
static GHashTable *_nick_to_query = NULL;
|
||||
static GHashTable *_query_type_to_nick = NULL;
|
||||
|
@ -121,7 +121,7 @@ _priv_gst_query_initialize (void)
|
|||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_query_debug, "query", 0, "query system");
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
if (_nick_to_query == NULL) {
|
||||
_nick_to_query = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
_query_type_to_nick = g_hash_table_new (NULL, NULL);
|
||||
|
@ -137,7 +137,7 @@ _priv_gst_query_initialize (void)
|
|||
standards++;
|
||||
_n_values++;
|
||||
}
|
||||
g_static_mutex_unlock (&mutex);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
_gst_query_type = gst_query_get_type ();
|
||||
}
|
||||
|
@ -210,13 +210,13 @@ gst_query_type_register (const gchar * nick, const gchar * description)
|
|||
query->description = g_strdup (description);
|
||||
query->quark = g_quark_from_static_string (query->nick);
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
g_hash_table_insert (_nick_to_query, (gpointer) query->nick, query);
|
||||
g_hash_table_insert (_query_type_to_nick, GINT_TO_POINTER (query->value),
|
||||
query);
|
||||
_gst_queries = g_list_append (_gst_queries, query);
|
||||
_n_values++;
|
||||
g_static_mutex_unlock (&mutex);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
return query->value;
|
||||
}
|
||||
|
@ -237,9 +237,9 @@ gst_query_type_get_by_nick (const gchar * nick)
|
|||
|
||||
g_return_val_if_fail (nick != NULL, GST_QUERY_NONE);
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
query = g_hash_table_lookup (_nick_to_query, nick);
|
||||
g_static_mutex_unlock (&mutex);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
if (query != NULL)
|
||||
return query->value;
|
||||
|
@ -285,9 +285,9 @@ gst_query_type_get_details (GstQueryType type)
|
|||
{
|
||||
const GstQueryTypeDefinition *result;
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
result = g_hash_table_lookup (_query_type_to_nick, GINT_TO_POINTER (type));
|
||||
g_static_mutex_unlock (&mutex);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -307,11 +307,11 @@ gst_query_type_iterate_definitions (void)
|
|||
{
|
||||
GstIterator *result;
|
||||
|
||||
g_static_mutex_lock (&mutex);
|
||||
g_mutex_lock (&mutex);
|
||||
/* FIXME: register a boxed type for GstQueryTypeDefinition */
|
||||
result = gst_iterator_new_list (G_TYPE_POINTER,
|
||||
g_static_mutex_get_mutex (&mutex), &_n_values, &_gst_queries, NULL, NULL);
|
||||
g_static_mutex_unlock (&mutex);
|
||||
&mutex, &_n_values, &_gst_queries, NULL, NULL);
|
||||
g_mutex_unlock (&mutex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ struct _GstRegistryPrivate
|
|||
|
||||
/* the one instance of the default registry and the mutex protecting the
|
||||
* variable. */
|
||||
static GStaticMutex _gst_registry_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex _gst_registry_mutex;
|
||||
static GstRegistry *_gst_registry_default = NULL;
|
||||
|
||||
/* defaults */
|
||||
|
@ -330,13 +330,13 @@ gst_registry_get (void)
|
|||
{
|
||||
GstRegistry *registry;
|
||||
|
||||
g_static_mutex_lock (&_gst_registry_mutex);
|
||||
g_mutex_lock (&_gst_registry_mutex);
|
||||
if (G_UNLIKELY (!_gst_registry_default)) {
|
||||
_gst_registry_default = g_object_newv (GST_TYPE_REGISTRY, 0, NULL);
|
||||
gst_object_ref_sink (GST_OBJECT_CAST (_gst_registry_default));
|
||||
}
|
||||
registry = _gst_registry_default;
|
||||
g_static_mutex_unlock (&_gst_registry_mutex);
|
||||
g_mutex_unlock (&_gst_registry_mutex);
|
||||
|
||||
return registry;
|
||||
}
|
||||
|
@ -1388,11 +1388,11 @@ _priv_gst_registry_cleanup (void)
|
|||
{
|
||||
GstRegistry *registry;
|
||||
|
||||
g_static_mutex_lock (&_gst_registry_mutex);
|
||||
g_mutex_lock (&_gst_registry_mutex);
|
||||
if ((registry = _gst_registry_default) != NULL) {
|
||||
_gst_registry_default = NULL;
|
||||
}
|
||||
g_static_mutex_unlock (&_gst_registry_mutex);
|
||||
g_mutex_unlock (&_gst_registry_mutex);
|
||||
|
||||
/* unref outside of the lock because we can. */
|
||||
if (registry)
|
||||
|
|
|
@ -121,7 +121,7 @@ static void gst_system_clock_async_thread (GstClock * clock);
|
|||
static gboolean gst_system_clock_start_async (GstSystemClock * clock);
|
||||
static void gst_system_clock_add_wakeup (GstSystemClock * sysclock);
|
||||
|
||||
static GStaticMutex _gst_sysclock_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GMutex _gst_sysclock_mutex;
|
||||
|
||||
/* static guint gst_system_clock_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
|
@ -276,7 +276,7 @@ gst_system_clock_obtain (void)
|
|||
{
|
||||
GstClock *clock;
|
||||
|
||||
g_static_mutex_lock (&_gst_sysclock_mutex);
|
||||
g_mutex_lock (&_gst_sysclock_mutex);
|
||||
clock = _the_system_clock;
|
||||
|
||||
if (clock == NULL) {
|
||||
|
@ -289,9 +289,9 @@ gst_system_clock_obtain (void)
|
|||
gst_object_ref_sink (clock);
|
||||
|
||||
_the_system_clock = clock;
|
||||
g_static_mutex_unlock (&_gst_sysclock_mutex);
|
||||
g_mutex_unlock (&_gst_sysclock_mutex);
|
||||
} else {
|
||||
g_static_mutex_unlock (&_gst_sysclock_mutex);
|
||||
g_mutex_unlock (&_gst_sysclock_mutex);
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "returning static system clock");
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ static void gst_task_finalize (GObject * object);
|
|||
|
||||
static void gst_task_func (GstTask * task);
|
||||
|
||||
static GStaticMutex pool_lock = G_STATIC_MUTEX_INIT;
|
||||
static GMutex pool_lock;
|
||||
|
||||
#define _do_init \
|
||||
{ \
|
||||
|
@ -153,14 +153,14 @@ G_DEFINE_TYPE_WITH_CODE (GstTask, gst_task, GST_TYPE_OBJECT, _do_init);
|
|||
static void
|
||||
init_klass_pool (GstTaskClass * klass)
|
||||
{
|
||||
g_static_mutex_lock (&pool_lock);
|
||||
g_mutex_lock (&pool_lock);
|
||||
if (klass->pool) {
|
||||
gst_task_pool_cleanup (klass->pool);
|
||||
gst_object_unref (klass->pool);
|
||||
}
|
||||
klass->pool = gst_task_pool_new ();
|
||||
gst_task_pool_prepare (klass->pool, NULL);
|
||||
g_static_mutex_unlock (&pool_lock);
|
||||
g_mutex_unlock (&pool_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -194,9 +194,9 @@ gst_task_init (GstTask * task)
|
|||
|
||||
/* use the default klass pool for this task, users can
|
||||
* override this later */
|
||||
g_static_mutex_lock (&pool_lock);
|
||||
g_mutex_lock (&pool_lock);
|
||||
task->priv->pool = gst_object_ref (klass->pool);
|
||||
g_static_mutex_unlock (&pool_lock);
|
||||
g_mutex_unlock (&pool_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
||||
static GStaticMutex _check_lock = G_STATIC_MUTEX_INIT;
|
||||
static GMutex _check_lock;
|
||||
|
||||
static GstElement *
|
||||
setup_multiqueue (GstElement * pipe, GstElement * inputs[],
|
||||
|
@ -335,13 +335,13 @@ mq_dummypad_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buf)
|
|||
|
||||
pad_data = gst_pad_get_element_private (sinkpad);
|
||||
|
||||
g_static_mutex_lock (&_check_lock);
|
||||
g_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 */
|
||||
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||
fail_unless (size >= 4);
|
||||
g_static_mutex_unlock (&_check_lock);
|
||||
g_mutex_unlock (&_check_lock);
|
||||
cur_id = GST_READ_UINT32_BE (data);
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
|
||||
|
@ -353,12 +353,12 @@ mq_dummypad_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buf)
|
|||
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 && !pad_data->first_buf) {
|
||||
g_static_mutex_lock (&_check_lock);
|
||||
g_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);
|
||||
g_mutex_unlock (&_check_lock);
|
||||
}
|
||||
} else {
|
||||
/* Update the max_id value */
|
||||
|
@ -382,9 +382,9 @@ mq_dummypad_event (GstPad * sinkpad, GstObject * parent, GstEvent * event)
|
|||
struct PadData *pad_data;
|
||||
|
||||
pad_data = gst_pad_get_element_private (sinkpad);
|
||||
g_static_mutex_lock (&_check_lock);
|
||||
g_mutex_lock (&_check_lock);
|
||||
fail_if (pad_data == NULL);
|
||||
g_static_mutex_unlock (&_check_lock);
|
||||
g_mutex_unlock (&_check_lock);
|
||||
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||
g_mutex_lock (pad_data->mutex);
|
||||
|
@ -501,9 +501,9 @@ run_output_order_test (gint n_linked)
|
|||
cur_pad = pad_pattern[i % n];
|
||||
|
||||
buf = gst_buffer_new_and_alloc (4);
|
||||
g_static_mutex_lock (&_check_lock);
|
||||
g_mutex_lock (&_check_lock);
|
||||
fail_if (buf == NULL);
|
||||
g_static_mutex_unlock (&_check_lock);
|
||||
g_mutex_unlock (&_check_lock);
|
||||
|
||||
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||
GST_WRITE_UINT32_BE (data, i + 1);
|
||||
|
@ -511,7 +511,7 @@ run_output_order_test (gint n_linked)
|
|||
GST_BUFFER_TIMESTAMP (buf) = (i + 1) * GST_SECOND;
|
||||
|
||||
ret = gst_pad_push (inputpads[cur_pad], buf);
|
||||
g_static_mutex_lock (&_check_lock);
|
||||
g_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);
|
||||
|
@ -521,7 +521,7 @@ run_output_order_test (gint n_linked)
|
|||
"Push on pad %d returned %d when FLOW_OK or NOT_LINKED was expected",
|
||||
cur_pad, ret);
|
||||
}
|
||||
g_static_mutex_unlock (&_check_lock);
|
||||
g_mutex_unlock (&_check_lock);
|
||||
}
|
||||
for (i = 0; i < NPADS; i++) {
|
||||
gst_pad_push_event (inputpads[i], gst_event_new_eos ());
|
||||
|
@ -660,9 +660,9 @@ GST_START_TEST (test_sparse_stream)
|
|||
ts = gst_util_uint64_scale_int (GST_SECOND, i, 10);
|
||||
|
||||
buf = gst_buffer_new_and_alloc (4);
|
||||
g_static_mutex_lock (&_check_lock);
|
||||
g_mutex_lock (&_check_lock);
|
||||
fail_if (buf == NULL);
|
||||
g_static_mutex_unlock (&_check_lock);
|
||||
g_mutex_unlock (&_check_lock);
|
||||
|
||||
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||
GST_WRITE_UINT32_BE (data, i + 1);
|
||||
|
@ -675,10 +675,10 @@ GST_START_TEST (test_sparse_stream)
|
|||
ret = gst_pad_push (inputpads[1], gst_buffer_ref (buf));
|
||||
|
||||
ret = gst_pad_push (inputpads[0], buf);
|
||||
g_static_mutex_lock (&_check_lock);
|
||||
g_mutex_lock (&_check_lock);
|
||||
fail_unless (ret == GST_FLOW_OK,
|
||||
"Push on pad %d returned %d when FLOW_OK was expected", 0, ret);
|
||||
g_static_mutex_unlock (&_check_lock);
|
||||
g_mutex_unlock (&_check_lock);
|
||||
|
||||
/* Push a new segment update on the 2nd pad */
|
||||
gst_segment_init (&segment, GST_FORMAT_TIME);
|
||||
|
|
Loading…
Reference in a new issue