diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com> | 2020-09-25 19:08:17 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2020-10-12 10:03:42 +0300 |
commit | 6ca1b93dcffa82b520c85438f5d53a7f4e094499 (patch) | |
tree | 5ebd10c11cec39b6db56f0000bcd4bd6c2092fd0 | |
parent | 7233744653a9a897082087609506e547e7c863cf (diff) | |
download | gstreamer-plugins-bad-6ca1b93dcffa82b520c85438f5d53a7f4e094499.tar.gz |
srt: Fix use of srt_startup
`srt_startup` can also return 1 if it was successful. Avoid warning in
this case.
Avoid a race when checking whether we need to call it at all.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1685>
-rw-r--r-- | ext/srt/gstsrtobject.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/ext/srt/gstsrtobject.c b/ext/srt/gstsrtobject.c index 762b412d8..f10d84325 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"); |