srtobject: set error when canceled waiting for a caller

To propagate error, this commit sets a reason. Otherwise, the function
caller should check if `error` is NULL when the return value is not normal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1522>
This commit is contained in:
J. Kim 2020-08-19 11:46:31 +00:00
parent ebdb3447ce
commit 8e9f8c7f2c

View file

@ -1218,20 +1218,24 @@ gst_srt_object_wait_caller (GstSRTObject * srtobject,
while (!g_cancellable_is_cancelled (cancellable)) {
ret = (srtobject->callers != NULL);
if (ret)
if (ret) {
GST_DEBUG_OBJECT (srtobject->element, "Got a connection");
break;
}
g_cond_wait (&srtobject->sock_cond, &srtobject->sock_lock);
}
GST_DEBUG_OBJECT (srtobject->element, "Got %s connection",
ret ? "a" : "no");
} else {
ret = TRUE;
}
g_mutex_unlock (&srtobject->sock_lock);
if (!ret) {
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
"Canceled waiting for a connection.");
}
return ret;
}