mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
srtobject: distinguish authentication error messages
Use GST_RESOURCE_ERROR_NOT_AUTHORIZED code in posted error messages related to SRT authentication (e.g. incorrect or missing password) so that the application can recognize them more easily. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1943>
This commit is contained in:
parent
ef118f3d0a
commit
6c35222973
1 changed files with 14 additions and 2 deletions
|
@ -1538,12 +1538,20 @@ gst_srt_object_read (GstSRTObject * srtobject,
|
|||
if (wsocklen == 1 && rsocklen == 1) {
|
||||
/* Socket reported in wsock AND rsock signifies an error. */
|
||||
gint reason = srt_getrejectreason (wsock);
|
||||
gboolean is_auth_error = (reason == SRT_REJ_BADSECRET
|
||||
|| reason == SRT_REJ_UNSECURE);
|
||||
|
||||
if (is_auth_error) {
|
||||
ELEMENT_WARNING_SRTSOCK_ERROR (NOT_AUTHORIZED, reason);
|
||||
}
|
||||
|
||||
if (connection_mode == GST_SRT_CONNECTION_MODE_LISTENER) {
|
||||
/* Caller has disappeared. */
|
||||
return 0;
|
||||
} else {
|
||||
ELEMENT_WARNING_SRTSOCK_ERROR (READ, reason);
|
||||
if (!is_auth_error) {
|
||||
ELEMENT_WARNING_SRTSOCK_ERROR (READ, reason);
|
||||
}
|
||||
|
||||
gst_srt_object_close (srtobject);
|
||||
if (!gst_srt_object_open_internal (srtobject, cancellable, error)) {
|
||||
|
@ -1767,7 +1775,11 @@ gst_srt_object_write_one (GstSRTObject * srtobject,
|
|||
/* Socket reported in wsock AND rsock signifies an error. */
|
||||
gint reason = srt_getrejectreason (wsock);
|
||||
|
||||
ELEMENT_WARNING_SRTSOCK_ERROR (WRITE, reason);
|
||||
if (reason == SRT_REJ_BADSECRET || reason == SRT_REJ_UNSECURE) {
|
||||
ELEMENT_WARNING_SRTSOCK_ERROR (NOT_AUTHORIZED, reason);
|
||||
} else {
|
||||
ELEMENT_WARNING_SRTSOCK_ERROR (WRITE, reason);
|
||||
}
|
||||
|
||||
gst_srt_object_close (srtobject);
|
||||
if (!gst_srt_object_open_internal (srtobject, cancellable, error)) {
|
||||
|
|
Loading…
Reference in a new issue