diff -ruNp tvheadend.new/src/http.h tvheadend/src/http.h --- tvheadend.new/src/http.h 2018-03-16 20:14:00.336001370 +0300 +++ tvheadend/src/http.h 2018-03-16 22:23:46.968068354 +0300 @@ -173,6 +173,7 @@ typedef struct http_connection { access_t *hc_access; /* RTSP */ + int hc_stream; uint64_t hc_cseq; char *hc_session; diff -ruNp tvheadend.new/src/satip/rtsp.c tvheadend/src/satip/rtsp.c --- tvheadend.new/src/satip/rtsp.c 2018-03-16 20:14:00.352001882 +0300 +++ tvheadend/src/satip/rtsp.c 2018-03-16 22:40:30.137061730 +0300 @@ -969,6 +969,21 @@ parse_transport(http_connection_t *hc) if (a + 1 != b) return -1; return a; + } else if (strncmp(s, "RTP/AVP/UDP;unicast;client_port=", 32) == 0) { + for (s += 32, u = s; isdigit(*u); u++); + if (*u != '-') + return -1; + a = atoi(s); + for (s = ++u; isdigit(*s); s++); + if (*s != '\0' && *s != ';') + return -1; + b = atoi(u); + if (a + 1 != b) + return -1; + return a; + } else if ((strncmp(s, "RTP/AVP/TCP;unicast;interleaved=0-1", 35) == 0) && + !satip_server_conf.satip_notcp_mode) { + return RTSP_TCP_DATA; } else if ((strncmp(s, "RTP/AVP/TCP;interleaved=0-1", 27) == 0) && !satip_server_conf.satip_notcp_mode) { return RTSP_TCP_DATA; @@ -1253,6 +1268,13 @@ play: if (mpegts_pid_dump(&rs->pids, buf + r, sizeof(buf) - r, 0, 0) == 0) tvh_strlcatf(buf, sizeof(buf), r, ""); + if (cmd == RTSP_CMD_DESCRIBE) { + hc->hc_session = rs->session; + if (!rs->stream) + rs->stream = 1; + hc->hc_stream = rs->stream; + } + tvhdebug(LS_SATIPS, "%i/%s/%d: %s from %s:%d %s", rs->frontend, rs->session, rs->stream, caller, hc->hc_peer_ipstr, ntohs(IP_PORT(*hc->hc_peer)), buf); @@ -1491,7 +1513,9 @@ rtsp_process_play(http_connection_t *hc, if ((u = rtsp_check_urlbase(u)) == NULL) goto error2; - if ((stream = rtsp_parse_args(hc, u)) < 0) + /* if ((stream = rtsp_parse_args(hc, u)) < 0) */ + stream = hc->hc_stream; + if (stream < 0) goto error2; pthread_mutex_lock(&rtsp_lock); @@ -1732,6 +1756,7 @@ rtsp_serve(int fd, void **opaque, struct hc.hc_self = self; hc.hc_process = rtsp_process_request; hc.hc_cseq = 1; + hc.hc_stream = -1; http_serve_requests(&hc); @@ -1765,7 +1790,7 @@ rtsp_close_session(session_t *rs) rs->tcp_data = NULL; pthread_mutex_lock(&global_lock); mpegts_pid_reset(&rs->pids); - rtsp_clean(rs, 1); + rtsp_clean(rs, 0); mtimer_disarm(&rs->timer); pthread_mutex_unlock(&global_lock); }