Project

General

Profile

Actions

Feature #4881

closed

SAT>IP: Printing the UDP/RTP ports in the connection status of the UI

Added by Mono Polimorph about 7 years ago. Updated about 7 years ago.

Status:
Fixed
Priority:
Normal
Category:
SAT>IP
Target version:
-
Start date:
2018-01-22
Due date:
% Done:

100%

Estimated time:

Description

Hi Jarsolav,

Here another patch related to the UI, as promised in #4748#note-13:

diff --git a/src/satip/rtsp.c b/src/satip/rtsp.c
index 7641b85..3bb6d5a 100644
--- a/src/satip/rtsp.c
+++ b/src/satip/rtsp.c
@@ -1656,8 +1656,9 @@ rtsp_flush_requests(http_connection_t *hc)
 static void
 rtsp_stream_status ( void *opaque, htsmsg_t *m )
 {
-  http_connection_t *hc = opaque;
-  char buf[128];
+  http_connection_t *hc = opaque;  char buf[128];
+  int buf_size = sizeof(buf);
+  struct session *rs = NULL;

   htsmsg_add_str(m, "type", "SAT>IP");
   if (hc->hc_proxy_ip) {
@@ -1666,6 +1667,23 @@ rtsp_stream_status ( void *opaque, htsmsg_t *m )
   }
   if (hc->hc_username)
     htsmsg_add_str(m, "user", hc->hc_username);
+
+  buf[0]='\0';
+  TAILQ_FOREACH(rs, &rtsp_sessions, link) {
+    if (buf_size < 10) break;
+    if (hc->hc_session &&
+        strcmp(rs->session, hc->hc_session) == 0 &&
+        strcmp(rs->peer_ipstr, hc->hc_peer_ipstr) == 0 &&
+        rs->rtp_peer_port > 0) {
+      if (rs->rtp_peer_port == RTSP_TCP_DATA)
+        buf_size -= snprintf(buf + sizeof(buf) - buf_size, buf_size, "%sAVP", buf_size == sizeof(buf)? "" : ",");
+      else
+        buf_size -= snprintf(buf + sizeof(buf) - buf_size, buf_size, "%s%d+1", buf_size == sizeof(buf)? "" : ",", rs->rtp_peer_port);
+    }
+  }
+  if (buf[0] != '\0') {
+    htsmsg_set_str(m, "peer_udp_ports", buf);
+  }
 }

 /*
diff --git a/src/webui/static/app/status.js b/src/webui/static/app/status.js
index 0ac4b78..3a7db18 100644
--- a/src/webui/static/app/status.js
+++ b/src/webui/static/app/status.js
@@ -607,6 +607,7 @@ tvheadend.status_conns = function(panel, index) {
                 { name: 'server_port' },
                 { name: 'peer', sortType: stype },
                 { name: 'peer_port' },
+                { name: 'peer_udp_ports' },
                 { name: 'proxy' },
                 { name: 'user', sortType: stype },
                 {
@@ -645,11 +646,17 @@ tvheadend.status_conns = function(panel, index) {
             }, {
                 width: 50,
                 id: 'peer_port',
-                header: _("Client Port"),
+                header: _("Client TCP Port"),
                 dataIndex: 'peer_port',
                 sortable: true
             }, {
                 width: 50,
+                id: 'peer_udp_ports',
+                header: _("Client UDP Ports"),
+                dataIndex: 'peer_udp_ports',
+                sortable: true
+            }, {
+                width: 50,
                 id: 'user',
                 header: _("Username"),
                 dataIndex: 'user',

This patch is for printing the UDP used ports by SAT>IP clients. It has a very interesting advantage: when the user uses the TCP socket for the streaming it prints “AVP”. So, you can check in the server which users are using Interlaved RTSP.

Furthermore, the patch prints all ports used by each client, as the user can request more than one stream using the same RTSP session.

I hope you like to commit this patch too! :)
Regards.


Files

Actions

Also available in: Atom PDF