From 32140dcb8423171ab7513b2fc9db2ae9ca17f30f Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 27 Jul 2018 15:04:29 +0900 Subject: [PATCH] srt: Do not ignore SRT socket error event ... and set SRT_EPOLL_IN flag if the client is not sender (i.e., source element) since waiting readable event for srt_recvmsg() makes more sense. https://bugzilla.gnome.org/show_bug.cgi?id=796842 --- ext/srt/gstsrt.c | 8 +++++--- ext/srt/gstsrtclientsrc.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ext/srt/gstsrt.c b/ext/srt/gstsrt.c index e845b14981..d780df84bb 100644 --- a/ext/srt/gstsrt.c +++ b/ext/srt/gstsrt.c @@ -43,6 +43,9 @@ gst_srt_client_connect (GstElement * elem, int sender, GError *error = NULL; gpointer sa; size_t sa_len; + int poll_event = SRT_EPOLL_ERR; + + poll_event |= sender ? SRT_EPOLL_OUT : SRT_EPOLL_IN; if (host == NULL) { GST_ELEMENT_ERROR (elem, RESOURCE, OPEN_READ, ("Invalid host"), @@ -137,8 +140,7 @@ gst_srt_client_connect (GstElement * elem, int sender, goto failed; } - srt_epoll_add_usock (*poll_id, sock, &(int) { - SRT_EPOLL_OUT}); + srt_epoll_add_usock (*poll_id, sock, &poll_event); if (srt_connect (sock, sa, sa_len) == SRT_ERROR) { GST_ELEMENT_ERROR (elem, RESOURCE, OPEN_READ, ("Connection error"), @@ -235,7 +237,7 @@ gst_srt_server_listen (GstElement * elem, int sender, const gchar * host, } srt_epoll_add_usock (*poll_id, sock, &(int) { - SRT_EPOLL_IN}); + SRT_EPOLL_IN | SRT_EPOLL_ERR}); if (srt_bind (sock, &sa, sa_len) == SRT_ERROR) { GST_WARNING_OBJECT (elem, "failed to bind SRT server socket (reason: %s)", diff --git a/ext/srt/gstsrtclientsrc.c b/ext/srt/gstsrtclientsrc.c index ac2e202deb..ee70fb77f2 100644 --- a/ext/srt/gstsrtclientsrc.c +++ b/ext/srt/gstsrtclientsrc.c @@ -175,8 +175,8 @@ gst_srt_client_src_fill (GstPushSrc * src, GstBuffer * outbuf) SRTSOCKET ready[2]; gint recv_len; - if (srt_epoll_wait (priv->poll_id, 0, 0, ready, &(int) { - 2}, priv->poll_timeout, 0, 0, 0, 0) == -1) { + if (srt_epoll_wait (priv->poll_id, ready, &(int) { + 2}, 0, 0, priv->poll_timeout, 0, 0, 0, 0) == -1) { /* Assuming that timeout error is normal */ if (srt_getlasterror (NULL) != SRT_ETIMEOUT) {