mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
rtmp2/connection: Handle EOF like error
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1403>
This commit is contained in:
parent
031d52672b
commit
297cdaa381
1 changed files with 11 additions and 14 deletions
|
@ -474,6 +474,12 @@ gst_rtmp_connection_input_ready (GInputStream * is, gpointer user_data)
|
||||||
sc->input_bytes->data + oldsize, READ_SIZE, sc->cancellable, &error);
|
sc->input_bytes->data + oldsize, READ_SIZE, sc->cancellable, &error);
|
||||||
g_byte_array_set_size (sc->input_bytes, oldsize + (ret > 0 ? ret : 0));
|
g_byte_array_set_size (sc->input_bytes, oldsize + (ret > 0 ? ret : 0));
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
error = g_error_new (G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED,
|
||||||
|
"connection closed remotely");
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
gint code = error->code;
|
gint code = error->code;
|
||||||
|
|
||||||
|
@ -488,13 +494,9 @@ gst_rtmp_connection_input_ready (GInputStream * is, gpointer user_data)
|
||||||
|
|
||||||
GST_ERROR_OBJECT (sc, "read error: %s %d %s",
|
GST_ERROR_OBJECT (sc, "read error: %s %d %s",
|
||||||
g_quark_to_string (error->domain), code, error->message);
|
g_quark_to_string (error->domain), code, error->message);
|
||||||
g_error_free (error);
|
|
||||||
} else if (ret == 0) {
|
|
||||||
GST_INFO_OBJECT (sc, "read EOF");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret <= 0) {
|
|
||||||
gst_rtmp_connection_emit_error (sc);
|
gst_rtmp_connection_emit_error (sc);
|
||||||
|
g_error_free (error);
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,16 +579,11 @@ out:
|
||||||
static void
|
static void
|
||||||
gst_rtmp_connection_emit_error (GstRtmpConnection * self)
|
gst_rtmp_connection_emit_error (GstRtmpConnection * self)
|
||||||
{
|
{
|
||||||
if (self->error) {
|
if (!self->error) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_INFO_OBJECT (self, "connection error");
|
|
||||||
self->error = TRUE;
|
self->error = TRUE;
|
||||||
|
|
||||||
cancel_all_commands (self);
|
cancel_all_commands (self);
|
||||||
|
|
||||||
g_signal_emit (self, signals[SIGNAL_ERROR], 0);
|
g_signal_emit (self, signals[SIGNAL_ERROR], 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue