]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Assign a different port number for each frontend thread
authorKin-Wai Koo <glug71@gmail.com>
Mon, 21 Jan 2019 09:08:12 +0000 (17:08 +0800)
committerJaroslav Kysela <perex@perex.cz>
Mon, 4 Feb 2019 10:07:17 +0000 (11:07 +0100)
src/config.c
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c

index 9bbea9925bf264ad2f4c9a4d2484548bf05ff161..fdd8113ac92b43235e592a339c0c76a0ccd0df87 100644 (file)
@@ -2168,11 +2168,17 @@ const idclass_t config_class = {
       .type   = PT_INT,
       .id     = "local_port",
       .name   = N_("Local Socket Port Number"),
-      .desc   = N_("Port number of the UDP listener. This listener listens "
-                   "for traffic from the HDHomerun device. This is needed if "
-                   "you plan to run TVheadend in a container and you want to "
-                   "stream from an HDHomerun without enabling host networking "
-                   "for the container."),
+      .desc   = N_("Starting port number of the UDP listeners. The listeners "
+                   "listen for traffic from the HDHomerun tuners. This is "
+                   "needed if you plan to run TVheadend in a container and "
+                   "you want to stream from an HDHomerun without enabling "
+                   "host networking for the container. Set this to 0 if you "
+                   "want the port numbers to be assigned dynamically. If you "
+                   "have multiple tuners, this will be the start of the port "
+                   "range. For example, if you have 4 tuners and you set this "
+                   "to 9983, then tuner 0 will talk to port 9983, tuner 1 "
+                   "will talk to port 9984, tuner 2 will talk to port 9985, "
+                   "and tuner 3 will talk to port 9986."),
       .off    = offsetof(config_t, local_port),
       .opts   = PO_HIDDEN | PO_EXPERT,
       .group  = 1
index bf401ee54b8ad3c60b560f8bc4e6ef0db8c3ce0b..b1d6c78138746ee875a1c2d4bf365aa95b52fe18 100644 (file)
@@ -133,7 +133,7 @@ tvhdhomerun_frontend_input_thread ( void *aux )
   memset(&sock_addr, 0, sizeof(sock_addr));
   sock_addr.sin_family = AF_INET;
   sock_addr.sin_addr.s_addr = htonl(INADDR_ANY);
-  sock_addr.sin_port = config.local_port==0?0:htons(config.local_port);
+  sock_addr.sin_port = config.local_port==0?0:htons(config.local_port + hfe->hf_tunerNumber);
   if(bind(sockfd, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) != 0) {
     tvherror(LS_TVHDHOMERUN, "failed bind socket: %d", errno);
     close(sockfd);