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
This commit is contained in:
Seungha Yang 2018-07-27 15:04:29 +09:00 committed by Olivier Crête
parent f46af953c1
commit 32140dcb84
2 changed files with 7 additions and 5 deletions

View file

@ -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)",

View file

@ -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) {