diff --git a/ext/srt/gstsrtobject.c b/ext/srt/gstsrtobject.c index de22dabb77..4c9ae37cb1 100644 --- a/ext/srt/gstsrtobject.c +++ b/ext/srt/gstsrtobject.c @@ -262,16 +262,14 @@ gst_srt_object_new (GstElement * element) { GstSRTObject *srtobject; - if (g_atomic_int_get (&srt_init_refcount) == 0) { + if (g_atomic_int_add (&srt_init_refcount, 1) == 0) { GST_DEBUG_OBJECT (element, "Starting up SRT"); - if (srt_startup () != 0) { + if (srt_startup () < 0) { g_warning ("Failed to initialize SRT (reason: %s)", srt_getlasterror_str ()); } } - g_atomic_int_inc (&srt_init_refcount); - srtobject = g_new0 (GstSRTObject, 1); srtobject->element = element; srtobject->parameters = gst_structure_new_empty ("application/x-srt-params");