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/1659>
This commit is contained in:
Jan Alexander Steffens (heftig) 2020-09-25 19:08:17 +02:00
parent 6b8c4a5f34
commit fda4cfd15e

View file

@ -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");