mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
rtmp2/connection: Pass triggering GError in 'error' signal
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1403>
This commit is contained in:
parent
9952be2ab3
commit
f2d7b98ea4
4 changed files with 16 additions and 10 deletions
|
@ -1075,13 +1075,16 @@ put_chunk (GstRtmpConnection * connection, gpointer user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
error_callback (GstRtmpConnection * connection, GstRtmp2Sink * self)
|
||||
error_callback (GstRtmpConnection * connection, const GError * error,
|
||||
GstRtmp2Sink * self)
|
||||
{
|
||||
g_mutex_lock (&self->lock);
|
||||
if (self->cancellable) {
|
||||
g_cancellable_cancel (self->cancellable);
|
||||
} else if (self->loop) {
|
||||
GST_ELEMENT_ERROR (self, RESOURCE, WRITE, ("Connection error"), (NULL));
|
||||
GST_ELEMENT_ERROR (self, RESOURCE, WRITE,
|
||||
("Connection error: %s", error->message),
|
||||
("domain %s, code %d", g_quark_to_string (error->domain), error->code));
|
||||
stop_task (self);
|
||||
}
|
||||
g_mutex_unlock (&self->lock);
|
||||
|
|
|
@ -917,13 +917,15 @@ out:
|
|||
}
|
||||
|
||||
static void
|
||||
error_callback (GstRtmpConnection * connection, GstRtmp2Src * self)
|
||||
error_callback (GstRtmpConnection * connection, const GError * error,
|
||||
GstRtmp2Src * self)
|
||||
{
|
||||
g_mutex_lock (&self->lock);
|
||||
if (self->cancellable) {
|
||||
g_cancellable_cancel (self->cancellable);
|
||||
} else if (self->loop) {
|
||||
GST_INFO_OBJECT (self, "Connection error");
|
||||
GST_INFO_OBJECT (self, "Connection error: %s %d %s",
|
||||
g_quark_to_string (error->domain), error->code, error->message);
|
||||
stop_task (self);
|
||||
}
|
||||
g_mutex_unlock (&self->lock);
|
||||
|
|
|
@ -321,7 +321,7 @@ static void send_stop (GstRtmpConnection * connection, const gchar * stream,
|
|||
static void send_secure_token_response (GTask * task,
|
||||
GstRtmpConnection * connection, const gchar * challenge);
|
||||
static void connection_error (GstRtmpConnection * connection,
|
||||
gpointer user_data);
|
||||
const GError * error, gpointer user_data);
|
||||
|
||||
#define DEFAULT_TIMEOUT 5
|
||||
|
||||
|
@ -510,12 +510,13 @@ handshake_done (GObject * source, GAsyncResult * result, gpointer user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
connection_error (GstRtmpConnection * connection, gpointer user_data)
|
||||
connection_error (GstRtmpConnection * connection, const GError * error,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task = user_data;
|
||||
|
||||
if (!g_task_had_error (task))
|
||||
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"error during connection attempt");
|
||||
g_task_return_error (task, g_error_copy (error));
|
||||
}
|
||||
|
||||
static gchar *
|
||||
|
|
|
@ -245,7 +245,7 @@ gst_rtmp_connection_class_init (GstRtmpConnectionClass * klass)
|
|||
gobject_class->finalize = gst_rtmp_connection_finalize;
|
||||
|
||||
signals[SIGNAL_ERROR] = g_signal_new ("error", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_ERROR);
|
||||
|
||||
signals[SIGNAL_STREAM_CONTROL] = g_signal_new ("stream-control",
|
||||
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
|
||||
|
@ -582,7 +582,7 @@ gst_rtmp_connection_emit_error (GstRtmpConnection * self, GError * error)
|
|||
if (!self->error) {
|
||||
self->error = TRUE;
|
||||
cancel_all_commands (self, error->message);
|
||||
g_signal_emit (self, signals[SIGNAL_ERROR], 0);
|
||||
g_signal_emit (self, signals[SIGNAL_ERROR], 0, error);
|
||||
}
|
||||
|
||||
g_error_free (error);
|
||||
|
|
Loading…
Reference in a new issue