mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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:
parent
ebdb3447ce
commit
8e9f8c7f2c
1 changed files with 8 additions and 4 deletions
|
@ -1218,20 +1218,24 @@ gst_srt_object_wait_caller (GstSRTObject * srtobject,
|
||||||
|
|
||||||
while (!g_cancellable_is_cancelled (cancellable)) {
|
while (!g_cancellable_is_cancelled (cancellable)) {
|
||||||
ret = (srtobject->callers != NULL);
|
ret = (srtobject->callers != NULL);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
GST_DEBUG_OBJECT (srtobject->element, "Got a connection");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
g_cond_wait (&srtobject->sock_cond, &srtobject->sock_lock);
|
g_cond_wait (&srtobject->sock_cond, &srtobject->sock_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (srtobject->element, "Got %s connection",
|
|
||||||
ret ? "a" : "no");
|
|
||||||
} else {
|
} else {
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_mutex_unlock (&srtobject->sock_lock);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue