From: Jaroslav Kysela Date: Thu, 27 Jul 2017 15:00:45 +0000 (+0200) Subject: satip server: signalize pernament 'no data' state to rtsp layer, fixes #4499 X-Git-Tag: v4.2.4~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9480a970a89148c42495514a9bb8f84111ac2107;p=thirdparty%2Ftvheadend.git satip server: signalize pernament 'no data' state to rtsp layer, fixes #4499 --- diff --git a/src/satip/rtp.c b/src/satip/rtp.c index 889db1d93..42becb920 100644 --- a/src/satip/rtp.c +++ b/src/satip/rtp.c @@ -71,6 +71,8 @@ typedef struct satip_rtp_session { pthread_mutex_t *tcp_lock; uint8_t *table_data; int table_data_len; + void (*no_data_cb)(void *opaque); + void *no_data_opaque; } satip_rtp_session_t; static pthread_mutex_t satip_rtp_lock; @@ -403,6 +405,8 @@ satip_rtp_thread(void *aux) break; case SMT_NOSTART: case SMT_EXIT: + if (rtp->no_data_cb) + rtp->no_data_cb(rtp->no_data_opaque); alive = 0; break; @@ -440,7 +444,9 @@ void *satip_rtp_queue(th_subscription_t *subs, struct sockaddr_storage *peer, int port, int fd_rtp, int fd_rtcp, int frontend, int source, dvb_mux_conf_t *dmc, - mpegts_apids_t *pids, int allow_data, int perm_lock) + mpegts_apids_t *pids, int allow_data, int perm_lock, + void (*no_data_cb)(void *opaque), + void *no_data_opaque) { satip_rtp_session_t *rtp = calloc(1, sizeof(*rtp)); int dscp; @@ -458,6 +464,8 @@ void *satip_rtp_queue(th_subscription_t *subs, rtp->subs = subs; rtp->sq = sq; rtp->tcp_lock = tcp_lock; + rtp->no_data_cb = no_data_cb; + rtp->no_data_opaque = no_data_opaque; atomic_set(&rtp->allow_data, allow_data); mpegts_pid_init(&rtp->pids); mpegts_pid_copy(&rtp->pids, pids); diff --git a/src/satip/rtsp.c b/src/satip/rtsp.c index 6093a8889..7bc42ce11 100644 --- a/src/satip/rtsp.c +++ b/src/satip/rtsp.c @@ -56,6 +56,7 @@ typedef struct session { http_connection_t *shutdown_on_close; http_connection_t *tcp_data; int perm_lock; + int no_data; uint32_t nsession; char session[9]; dvb_mux_conf_t dmc; @@ -402,6 +403,16 @@ rtsp_clean(session_t *rs) rs->mux_created = 0; } +/* + * + */ +static void +rtsp_no_data(void *opaque) +{ + session_t *rs = opaque; + rs->no_data = 1; +} + /* * */ @@ -576,8 +587,11 @@ rtsp_start (rtsp_muxcnf == MUXCNF_REJECT || rtsp_muxcnf == MUXCNF_REJECT_EXACT_MATCH ) ? " (configuration)" : ""); goto endclean; } - if (rs->mux == mux && rs->subs) + if (rs->mux == mux && rs->subs) { + if (rs->no_data) + goto endclean; goto pids; + } rtsp_clean(rs); rs->dmc_tuned = dmc; rs->mux = mux; @@ -612,6 +626,7 @@ pids: if (cmd != RTSP_CMD_DESCRIBE && rs->state != STATE_PLAY) { if (rs->mux == NULL) goto endclean; + rs->no_data = 0; rs->rtp_handle = satip_rtp_queue(rs->subs, &rs->prch.prch_sq, &hc->hc_fd_lock, hc->hc_peer, rs->rtp_peer_port, @@ -620,7 +635,7 @@ pids: rs->findex, rs->src, &rs->dmc_tuned, &rs->pids, cmd == RTSP_CMD_PLAY || oldstate == STATE_PLAY, - rs->perm_lock); + rs->perm_lock, rtsp_no_data, rs); if (rs->rtp_handle == NULL) { res = HTTP_STATUS_INTERNAL; goto endclean; diff --git a/src/satip/server.h b/src/satip/server.h index d42d74559..eaa475c6d 100644 --- a/src/satip/server.h +++ b/src/satip/server.h @@ -73,13 +73,9 @@ void *satip_rtp_queue(th_subscription_t *subs, int frontend, int source, dvb_mux_conf_t *dmc, mpegts_apids_t *pids, - int allow_data, int perm_lock); -void satip_rtp_update(void *_rtp, th_subscription_t *subs, - streaming_queue_t *sq, - int frontend, int source, - dvb_mux_conf_t *dmc, - mpegts_apids_t *pids, - mpegts_apids_t *pmt_pids); + int allow_data, int perm_lock, + void (*no_data_cb)(void *opaque), + void *no_data_opaque); void satip_rtp_allow_data(void *_rtp); void satip_rtp_update_pids(void *_rtp, mpegts_apids_t *pids); void satip_rtp_update_pmt_pids(void *_rtp, mpegts_apids_t *pmt_pids);