From: Kin-Wai Koo Date: Mon, 21 Jan 2019 09:08:12 +0000 (+0800) Subject: Assign a different port number for each frontend thread X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03f40731a6b8ea95d113268eda63929f63decac9;p=thirdparty%2Ftvheadend.git Assign a different port number for each frontend thread --- diff --git a/src/config.c b/src/config.c index 9bbea9925..fdd8113ac 100644 --- a/src/config.c +++ b/src/config.c @@ -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 diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c index bf401ee54..b1d6c7813 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c @@ -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);