From 25a50f75a07b656e380b4e9e2d61cbc6c7740e4b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 1 Nov 2019 08:27:17 +0100 Subject: [PATCH] satip client: try to the the missing poll file descriptor removal, issue #5496 --- src/input/mpegts/satip/satip_frontend.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index 5b0057c82..ebecf7c3f 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -1575,14 +1575,14 @@ satip_frontend_input_thread ( void *aux ) satip_frontend_t *lfe = aux, *lfe_master; satip_tune_req_t *tr = NULL; mpegts_mux_instance_t *mmi; - http_client_t *rtsp; + http_client_t *rtsp = NULL; udp_connection_t *rtp = NULL, *rtcp = NULL; dvb_mux_t *lm; char buf[256]; struct iovec *iovec; uint8_t b[2048], session[32]; sbuf_t *sb; - int nfds, i, r, tc, rtp_port, start = 0; + int nfds, i, r, tc, rtp_port, start = 0, poll_reg = 0; size_t c; tvhpoll_event_t ev[3]; tvhpoll_t *efd; @@ -1601,7 +1601,6 @@ satip_frontend_input_thread ( void *aux ) /* Setup poll */ efd = tvhpoll_create(4); - rtsp = NULL; /* Setup buffers */ sbuf_init(sb = &lfe->sf_sbuf); @@ -1844,6 +1843,7 @@ new_tune: tvhpoll_event(&ev[nfds++], rtsp->hc_fd, TVHPOLL_IN, rtsp); tvhpoll_add(efd, ev, nfds); rtsp->hc_efd = efd; + poll_reg = 1; position = lfe_master->sf_position; if (lfe->sf_device->sd_pilot_on) @@ -2114,6 +2114,7 @@ new_tune: udp_multirecv_free(&um); lfe->sf_curmux = NULL; + assert(poll_reg); nfds = 0; if ((rtsp_flags & SATIP_SETUP_TCP) == 0) { tvhpoll_event1(&ev[nfds++], rtp->fd); @@ -2121,6 +2122,7 @@ new_tune: } tvhpoll_event1(&ev[nfds++], lfe->sf_dvr_pipe.rd); tvhpoll_rem(efd, ev, nfds); + poll_reg = 0; if (exit_flag) { satip_frontend_shutdown(lfe, buf, rtsp, tr, efd); @@ -2130,6 +2132,16 @@ new_tune: } done: + if (poll_reg) { + nfds = 0; + if ((rtsp_flags & SATIP_SETUP_TCP) == 0) { + tvhpoll_event1(&ev[nfds++], rtp->fd); + tvhpoll_event1(&ev[nfds++], rtcp->fd); + } + tvhpoll_event1(&ev[nfds++], lfe->sf_dvr_pipe.rd); + tvhpoll_rem(efd, ev, nfds); + poll_reg = 0; + } udp_close(rtcp); udp_close(rtp); rtcp = rtp = NULL; -- 2.47.2