mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
rtmp2: Improve error messages
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1403>
This commit is contained in:
parent
f2d7b98ea4
commit
b22093be3c
3 changed files with 34 additions and 40 deletions
|
@ -1100,26 +1100,23 @@ send_connect_error (GstRtmp2Sink * self, GError * error)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
||||||
GST_DEBUG_OBJECT (self, "Connection was cancelled (%s)",
|
GST_DEBUG_OBJECT (self, "Connection was cancelled: %s", error->message);
|
||||||
GST_STR_NULL (error->message));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_ERROR_OBJECT (self, "Failed to connect (%s:%d): %s",
|
GST_ERROR_OBJECT (self, "Failed to connect: %s %d %s",
|
||||||
g_quark_to_string (error->domain), error->code,
|
g_quark_to_string (error->domain), error->code, error->message);
|
||||||
GST_STR_NULL (error->message));
|
|
||||||
|
|
||||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED)) {
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED)) {
|
||||||
GST_ELEMENT_ERROR (self, RESOURCE, NOT_AUTHORIZED,
|
GST_ELEMENT_ERROR (self, RESOURCE, NOT_AUTHORIZED,
|
||||||
("Not authorized to connect"), ("%s", GST_STR_NULL (error->message)));
|
("Not authorized to connect: %s", error->message), (NULL));
|
||||||
} else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED)) {
|
} else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED)) {
|
||||||
GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ,
|
||||||
("Could not connect"), ("%s", GST_STR_NULL (error->message)));
|
("Connection refused: %s", error->message), (NULL));
|
||||||
} else {
|
} else {
|
||||||
GST_ELEMENT_ERROR (self, RESOURCE, FAILED,
|
GST_ELEMENT_ERROR (self, RESOURCE, FAILED,
|
||||||
("Failed to connect"),
|
("Failed to connect: %s", error->message),
|
||||||
("error %s:%d: %s", g_quark_to_string (error->domain), error->code,
|
("domain %s, code %d", g_quark_to_string (error->domain), error->code));
|
||||||
GST_STR_NULL (error->message)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -954,26 +954,23 @@ send_connect_error (GstRtmp2Src * self, GError * error)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
||||||
GST_DEBUG_OBJECT (self, "Connection was cancelled (%s)",
|
GST_DEBUG_OBJECT (self, "Connection was cancelled: %s", error->message);
|
||||||
GST_STR_NULL (error->message));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_ERROR_OBJECT (self, "Failed to connect (%s:%d): %s",
|
GST_ERROR_OBJECT (self, "Failed to connect: %s %d %s",
|
||||||
g_quark_to_string (error->domain), error->code,
|
g_quark_to_string (error->domain), error->code, error->message);
|
||||||
GST_STR_NULL (error->message));
|
|
||||||
|
|
||||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED)) {
|
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED)) {
|
||||||
GST_ELEMENT_ERROR (self, RESOURCE, NOT_AUTHORIZED,
|
GST_ELEMENT_ERROR (self, RESOURCE, NOT_AUTHORIZED,
|
||||||
("Not authorized to connect"), ("%s", GST_STR_NULL (error->message)));
|
("Not authorized to connect: %s", error->message), (NULL));
|
||||||
} else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED)) {
|
} else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED)) {
|
||||||
GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (self, RESOURCE, OPEN_READ,
|
||||||
("Could not connect"), ("%s", GST_STR_NULL (error->message)));
|
("Connection refused: %s", error->message), (NULL));
|
||||||
} else {
|
} else {
|
||||||
GST_ELEMENT_ERROR (self, RESOURCE, FAILED,
|
GST_ELEMENT_ERROR (self, RESOURCE, FAILED,
|
||||||
("Failed to connect"),
|
("Failed to connect: %s", error->message),
|
||||||
("error %s:%d: %s", g_quark_to_string (error->domain), error->code,
|
("domain %s, code %d", g_quark_to_string (error->domain), error->code));
|
||||||
GST_STR_NULL (error->message)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -708,14 +708,14 @@ send_connect_done (const gchar * command_name, GPtrArray * args,
|
||||||
|
|
||||||
if (!args) {
|
if (!args) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"connect failed: %s", command_name);
|
"'connect' cmd failed: %s", command_name);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->len < 2) {
|
if (args->len < 2) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"connect failed; not enough return arguments");
|
"'connect' cmd failed; not enough return arguments");
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ send_connect_done (const gchar * command_name, GPtrArray * args,
|
||||||
code = node ? gst_amf_node_peek_string (node, NULL) : NULL;
|
code = node ? gst_amf_node_peek_string (node, NULL) : NULL;
|
||||||
if (!code) {
|
if (!code) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"result code missing from connect cmd result");
|
"'connect' cmd failed; no status code");
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -750,7 +750,7 @@ send_connect_done (const gchar * command_name, GPtrArray * args,
|
||||||
desc = node ? gst_amf_node_peek_string (node, NULL) : NULL;
|
desc = node ? gst_amf_node_peek_string (node, NULL) : NULL;
|
||||||
if (!desc) {
|
if (!desc) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
||||||
"Connect rejected; no description");
|
"'connect' cmd returned '%s'; no description", code);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -766,14 +766,14 @@ send_connect_done (const gchar * command_name, GPtrArray * args,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
||||||
"unhandled authentication mode: %s", desc);
|
"'connect' cmd returned unhandled authmod: %s", desc);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_regex_match (auth_regex, desc, 0, &match_info)) {
|
if (!g_regex_match (auth_regex, desc, 0, &match_info)) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
||||||
"failed to parse auth rejection: %s", desc);
|
"'connect' cmd returned '%s': %s", code, desc);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ send_connect_done (const gchar * command_name, GPtrArray * args,
|
||||||
|
|
||||||
if (g_str_equal (reason, "authfailed")) {
|
if (g_str_equal (reason, "authfailed")) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
||||||
"authentication failed! wrong credentials?");
|
"authentication failed; wrong credentials?: %s", desc);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
gst_uri_unref (query);
|
gst_uri_unref (query);
|
||||||
return;
|
return;
|
||||||
|
@ -841,7 +841,7 @@ send_connect_done (const gchar * command_name, GPtrArray * args,
|
||||||
|
|
||||||
if (!g_str_equal (reason, "needauth")) {
|
if (!g_str_equal (reason, "needauth")) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
||||||
"unhandled rejection reason '%s'", reason);
|
"authentication failed; reason '%s': %s", reason, desc);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
gst_uri_unref (query);
|
gst_uri_unref (query);
|
||||||
return;
|
return;
|
||||||
|
@ -875,7 +875,7 @@ send_connect_done (const gchar * command_name, GPtrArray * args,
|
||||||
* and password are provided */
|
* and password are provided */
|
||||||
g_warn_if_reached ();
|
g_warn_if_reached ();
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"couldn't generate adobe style authentication query");
|
"internal error: failed to generate adobe auth query");
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -885,7 +885,7 @@ send_connect_done (const gchar * command_name, GPtrArray * args,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"unhandled connect result code: %s", code);
|
"'connect' cmd returned '%s'", code);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1026,7 @@ send_secure_token_response (GTask * task, GstRtmpConnection * connection,
|
||||||
|
|
||||||
if (!data->location.secure_token || !data->location.secure_token[0]) {
|
if (!data->location.secure_token || !data->location.secure_token[0]) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
|
||||||
"server requires secure token authentication");
|
"server requires secureToken but no token provided");
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1198,14 +1198,14 @@ create_stream_done (const gchar * command_name, GPtrArray * args,
|
||||||
|
|
||||||
if (!args) {
|
if (!args) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"createStream failed: %s", command_name);
|
"'createStream' cmd failed: %s", command_name);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->len < 2) {
|
if (args->len < 2) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"createStream failed; not enough return arguments");
|
"'createStream' cmd failed; not enough return arguments");
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1217,7 +1217,7 @@ create_stream_done (const gchar * command_name, GPtrArray * args,
|
||||||
gst_amf_node_dump (result, -1, error_dump);
|
gst_amf_node_dump (result, -1, error_dump);
|
||||||
|
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"createStream failed: %s", error_dump->str);
|
"'createStream' cmd failed: %s: %s", command_name, error_dump->str);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
|
|
||||||
g_string_free (error_dump, TRUE);
|
g_string_free (error_dump, TRUE);
|
||||||
|
@ -1229,7 +1229,7 @@ create_stream_done (const gchar * command_name, GPtrArray * args,
|
||||||
|
|
||||||
if (data->id == 0) {
|
if (data->id == 0) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
|
||||||
"createStream returned ID 0");
|
"'createStream' cmd returned ID 0");
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1291,14 +1291,14 @@ on_publish_or_play_status (const gchar * command_name, GPtrArray * args,
|
||||||
|
|
||||||
if (!args) {
|
if (!args) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"%s failed: %s", command, command_name);
|
"'%s' cmd failed: %s", command, command_name);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->len < 2) {
|
if (args->len < 2) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"%s failed; not enough return arguments", command);
|
"'%s' cmd failed; not enough return arguments", command);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1325,7 +1325,7 @@ on_publish_or_play_status (const gchar * command_name, GPtrArray * args,
|
||||||
|
|
||||||
if (g_strcmp0 (code, "NetStream.Publish.BadName") == 0) {
|
if (g_strcmp0 (code, "NetStream.Publish.BadName") == 0) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_EXISTS,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_EXISTS,
|
||||||
"publish denied: stream already exists: %s", info_dump->str);
|
"publish denied; stream already exists: %s", info_dump->str);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1345,13 +1345,13 @@ on_publish_or_play_status (const gchar * command_name, GPtrArray * args,
|
||||||
|
|
||||||
if (g_strcmp0 (code, "NetStream.Play.StreamNotFound") == 0) {
|
if (g_strcmp0 (code, "NetStream.Play.StreamNotFound") == 0) {
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
||||||
"play denied: stream not found: %s", info_dump->str);
|
"play denied; stream not found: %s", info_dump->str);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
"unhandled %s result: %s", command, info_dump->str);
|
"'%s' cmd failed: %s: %s", command, command_name, info_dump->str);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_string_free (info_dump, TRUE);
|
g_string_free (info_dump, TRUE);
|
||||||
|
|
Loading…
Reference in a new issue