diff --git a/subprojects/gst-plugins-bad/gst/rtmp2/rtmp/rtmpconnection.c b/subprojects/gst-plugins-bad/gst/rtmp2/rtmp/rtmpconnection.c index d9af4d2e11..33f0a1356e 100644 --- a/subprojects/gst-plugins-bad/gst/rtmp2/rtmp/rtmpconnection.c +++ b/subprojects/gst-plugins-bad/gst/rtmp2/rtmp/rtmpconnection.c @@ -474,6 +474,12 @@ gst_rtmp_connection_input_ready (GInputStream * is, gpointer user_data) sc->input_bytes->data + oldsize, READ_SIZE, sc->cancellable, &error); 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) { 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", 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); + g_error_free (error); return G_SOURCE_REMOVE; } @@ -577,16 +579,11 @@ out: static void gst_rtmp_connection_emit_error (GstRtmpConnection * self) { - if (self->error) { - return; + if (!self->error) { + self->error = TRUE; + cancel_all_commands (self); + g_signal_emit (self, signals[SIGNAL_ERROR], 0); } - - GST_INFO_OBJECT (self, "connection error"); - self->error = TRUE; - - cancel_all_commands (self); - - g_signal_emit (self, signals[SIGNAL_ERROR], 0); } static void