Skip to content

Commit

Permalink
satip server: allow to configure TCP RTP payload size for limited cli…
Browse files Browse the repository at this point in the history
…ents, fixes #4517
  • Loading branch information
perexg committed Sep 14, 2017
1 parent 9566406 commit 219dc8e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/satip/rtp.c
Expand Up @@ -33,7 +33,8 @@

#define RTP_PACKETS 128
#define RTP_PAYLOAD (7*188+12)
#define RTP_TCP_PAYLOAD (87*188+12+4) /* cca 16kB */
#define RTP_TCP_MIN_PAYLOAD (7*188+12+4) /* fit ethernet packet */
#define RTP_TCP_MAX_PAYLOAD (348*188+12+4) /* cca 64kB */
#define RTCP_PAYLOAD (1420)

#define RTP_TCP_BUFFER_SIZE (64*1024*1024)
Expand Down Expand Up @@ -465,7 +466,7 @@ void *satip_rtp_queue(th_subscription_t *subs,
satip_rtp_session_t *rtp = calloc(1, sizeof(*rtp));
size_t len;
socklen_t socklen;
int dscp;
int dscp, payload;

if (rtp == NULL)
return NULL;
Expand All @@ -480,7 +481,8 @@ void *satip_rtp_queue(th_subscription_t *subs,
rtp->subs = subs;
rtp->sq = sq;
rtp->hc = hc;
rtp->tcp_payload = RTP_TCP_PAYLOAD;
payload = satip_server_conf.satip_rtptcpsize * 188 + 12 + 4;
rtp->tcp_payload = MINMAX(payload, RTP_TCP_MIN_PAYLOAD, RTP_TCP_MAX_PAYLOAD);
rtp->tcp_buffer_size = 16*1024*1024;
rtp->no_data_cb = no_data_cb;
rtp->no_data_opaque = no_data_opaque;
Expand Down
28 changes: 28 additions & 0 deletions src/satip/server.c
Expand Up @@ -593,6 +593,20 @@ static htsmsg_t *satip_server_class_muxcfg_list ( void *o, const char *lang )
return strtab2htsmsg(tab, 1, lang);
}

static htsmsg_t *satip_server_class_rtptcpsize_list ( void *o, const char *lang )
{
static const struct strtab tab[] = {
{ N_("1316 bytes"), 1316/188 },
{ N_("2632 bytes"), 2632/188 },
{ N_("5264 bytes"), 5264/188 },
{ N_("7896 bytes"), 7896/188 },
{ N_("16356 bytes"), 16356/188 },
{ N_("32712 bytes"), 32712/188 },
{ N_("65424 bytes"), 65424/188 },
};
return strtab2htsmsg(tab, 1, lang);
}

CLASS_DOC(satip_server)
PROP_DOC(satip_muxhandling)

Expand Down Expand Up @@ -705,6 +719,19 @@ const idclass_t satip_server_class = {
.opts = PO_EXPERT | PO_DOC_NLIST,
.group = 1,
},
{
.type = PT_INT,
.id = "satip_rtptcpsize",
.name = N_("RTP over TCP payload"),
.desc = N_("Select the payload size for RTP contents used "
"in the TCP embedded data mode. Some implementations "
"like ffmpeg and VideoLAN have maximum limit 7896 "
"bytes. The recommended value for tvheadend is "
"16356 or 32712 bytes."),
.off = offsetof(struct satip_server_conf, satip_rtptcpsize),
.list = satip_server_class_rtptcpsize_list,
.group = 1,
},
{
.type = PT_STR,
.id = "satip_nat_ip",
Expand Down Expand Up @@ -904,6 +931,7 @@ void satip_server_init(const char *bindaddr, int rtsp_port)
http_server_ip = NULL;
satip_server_bootid = time(NULL);
satip_server_conf.satip_deviceid = 1;
satip_server_conf.satip_rtptcpsize = 7896/188;

satip_server_bindaddr = bindaddr ? strdup(bindaddr) : NULL;
satip_server_rtsp_port_locked = rtsp_port > 0;
Expand Down
1 change: 1 addition & 0 deletions src/satip/server.h
Expand Up @@ -46,6 +46,7 @@ struct satip_server_conf {
int satip_descramble;
int satip_rewrite_pmt;
int satip_muxcnf;
int satip_rtptcpsize;
int satip_nom3u;
int satip_notcp_mode;
int satip_anonymize;
Expand Down

0 comments on commit 219dc8e

Please sign in to comment.