Project

General

Profile

Bug #5031 » 002-satip_rtsp_fix.patch

Igor Mokrushin, 2018-03-26 01:28

View differences:

tvheadend/src/http.h 2018-03-16 22:23:46.968068354 +0300
173 173
  access_t *hc_access;
174 174

  
175 175
  /* RTSP */
176
  int hc_stream;
176 177
  uint64_t hc_cseq;
177 178
  char *hc_session;
178 179

  
tvheadend/src/satip/rtsp.c 2018-03-16 22:40:30.137061730 +0300
969 969
    if (a + 1 != b)
970 970
      return -1;
971 971
    return a;
972
  } else if (strncmp(s, "RTP/AVP/UDP;unicast;client_port=", 32) == 0) {
973
    for (s += 32, u = s; isdigit(*u); u++);
974
    if (*u != '-')
975
      return -1;
976
    a = atoi(s);
977
    for (s = ++u; isdigit(*s); s++);
978
    if (*s != '\0' && *s != ';')
979
      return -1;
980
    b = atoi(u);
981
    if (a + 1 != b)
982
      return -1;
983
    return a;
984
  } else if ((strncmp(s, "RTP/AVP/TCP;unicast;interleaved=0-1", 35) == 0) &&
985
             !satip_server_conf.satip_notcp_mode) {
986
    return RTSP_TCP_DATA;
972 987
  } else if ((strncmp(s, "RTP/AVP/TCP;interleaved=0-1", 27) == 0) &&
973 988
             !satip_server_conf.satip_notcp_mode) {
974 989
    return RTSP_TCP_DATA;
......
1253 1268
  if (mpegts_pid_dump(&rs->pids, buf + r, sizeof(buf) - r, 0, 0) == 0)
1254 1269
    tvh_strlcatf(buf, sizeof(buf), r, "<none>");
1255 1270

  
1271
  if (cmd == RTSP_CMD_DESCRIBE) {
1272
    hc->hc_session = rs->session;
1273
    if (!rs->stream)
1274
      rs->stream = 1;
1275
    hc->hc_stream = rs->stream;
1276
  }
1277

  
1256 1278
  tvhdebug(LS_SATIPS, "%i/%s/%d: %s from %s:%d %s",
1257 1279
           rs->frontend, rs->session, rs->stream,
1258 1280
           caller, hc->hc_peer_ipstr, ntohs(IP_PORT(*hc->hc_peer)), buf);
......
1491 1513
  if ((u = rtsp_check_urlbase(u)) == NULL)
1492 1514
    goto error2;
1493 1515

  
1494
  if ((stream = rtsp_parse_args(hc, u)) < 0)
1516
  /* if ((stream = rtsp_parse_args(hc, u)) < 0) */
1517
  stream = hc->hc_stream;
1518
  if (stream < 0)
1495 1519
    goto error2;
1496 1520

  
1497 1521
  pthread_mutex_lock(&rtsp_lock);
......
1732 1756
  hc.hc_self    = self;
1733 1757
  hc.hc_process = rtsp_process_request;
1734 1758
  hc.hc_cseq    = 1;
1759
  hc.hc_stream  = -1;
1735 1760

  
1736 1761
  http_serve_requests(&hc);
1737 1762

  
......
1765 1790
  rs->tcp_data = NULL;
1766 1791
  pthread_mutex_lock(&global_lock);
1767 1792
  mpegts_pid_reset(&rs->pids);
1768
  rtsp_clean(rs, 1);
1793
  rtsp_clean(rs, 0);
1769 1794
  mtimer_disarm(&rs->timer);
1770 1795
  pthread_mutex_unlock(&global_lock);
1771 1796
}
(2-2/2)