SAT>IP server: Don't enable SAT>IP server by default, fix some locking issues
This commit is contained in:
parent
e16a5ca3d1
commit
fd24aa9339
3 changed files with 49 additions and 26 deletions
|
@ -1331,9 +1331,7 @@ void satip_server_rtsp_init(const char *bindaddr, int port, int descramble)
|
|||
satip_rtp_init();
|
||||
}
|
||||
if (rtsp_port != port && rtsp_server) {
|
||||
pthread_mutex_lock(&rtsp_lock);
|
||||
rtsp_close_sessions();
|
||||
pthread_mutex_unlock(&rtsp_lock);
|
||||
tcp_server_delete(rtsp_server);
|
||||
rtsp_server = NULL;
|
||||
reg = 1;
|
||||
|
|
|
@ -474,27 +474,59 @@ satips_upnp_discovery_destroy(upnp_service_t *upnp)
|
|||
/*
|
||||
*
|
||||
*/
|
||||
void satip_server_config_changed(void)
|
||||
static void satips_rtsp_port(int def)
|
||||
{
|
||||
int rtsp_port, descramble;
|
||||
int rtsp_port = satip_server_rtsp_port;
|
||||
if (!satip_server_rtsp_port_locked)
|
||||
rtsp_port = config_get_int("satip_rtsp", def);
|
||||
if (getuid() != 0 && rtsp_port > 0 && rtsp_port < 1024) {
|
||||
tvherror("satips", "RTSP port %d specified but no root perms, using 9983", rtsp_port);
|
||||
rtsp_port = 9983;
|
||||
}
|
||||
satip_server_rtsp_port = rtsp_port;
|
||||
|
||||
if (!satip_server_rtsp_port_locked) {
|
||||
rtsp_port = config_get_int("satip_rtsp", 0);
|
||||
satip_server_rtsp_port = rtsp_port;
|
||||
if (rtsp_port > 0) {
|
||||
descramble = config_get_int("satip_descramble", 1);
|
||||
satip_server_rtsp_init(http_server_ip, rtsp_port, descramble);
|
||||
tvhinfo("satips", "SAT>IP Server reinitialized (HTTP %s:%d, RTSP %s:%d, descramble %d, DVB-T %d, DVB-S2 %d, DVB-C %d)",
|
||||
http_server_ip, http_server_port, http_server_ip, rtsp_port,
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
static void satip_server_info(const char *prefix, int descramble)
|
||||
{
|
||||
tvhinfo("satips", "SAT>IP Server %sinitialized "
|
||||
"(HTTP %s:%d, RTSP %s:%d, "
|
||||
"descramble %d, DVB-T %d, DVB-S2 %d, DVB-C %d)",
|
||||
prefix,
|
||||
http_server_ip, http_server_port,
|
||||
http_server_ip, satip_server_rtsp_port,
|
||||
descramble,
|
||||
config_get_int("satip_dvbt", 0),
|
||||
config_get_int("satip_dvbs", 0),
|
||||
config_get_int("satip_dvbc", 0));
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void satip_server_config_changed(void)
|
||||
{
|
||||
int descramble;
|
||||
|
||||
if (!satip_server_rtsp_port_locked) {
|
||||
satips_rtsp_port(0);
|
||||
if (satip_server_rtsp_port > 0) {
|
||||
descramble = config_get_int("satip_descramble", 1);
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
satip_server_rtsp_init(http_server_ip, satip_server_rtsp_port, descramble);
|
||||
satip_server_info("re", descramble);
|
||||
satips_upnp_send_announce();
|
||||
pthread_mutex_lock(&global_lock);
|
||||
} else {
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
tvhinfo("satips", "SAT>IP Server shutdown");
|
||||
satip_server_rtsp_done();
|
||||
satips_upnp_send_byebye();
|
||||
pthread_mutex_lock(&global_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -522,25 +554,18 @@ void satip_server_init(int rtsp_port)
|
|||
http_server_ip = strdup(http_ip);
|
||||
http_server_port = ntohs(IP_PORT(http));
|
||||
|
||||
satip_server_rtsp_port_locked = 1;
|
||||
if (rtsp_port == 0) {
|
||||
satip_server_rtsp_port_locked = 0;
|
||||
rtsp_port = config_get_int("satip_rtsp", getuid() == 0 ? 554 : 9983);
|
||||
}
|
||||
satip_server_rtsp_port_locked = rtsp_port > 0;
|
||||
satip_server_rtsp_port = rtsp_port;
|
||||
if (rtsp_port <= 0)
|
||||
satips_rtsp_port(rtsp_port);
|
||||
|
||||
if (satip_server_rtsp_port <= 0)
|
||||
return;
|
||||
|
||||
descramble = config_get_int("satip_descramble", 1);
|
||||
|
||||
satip_server_rtsp_init(http_server_ip, rtsp_port, descramble);
|
||||
satip_server_rtsp_init(http_server_ip, satip_server_rtsp_port, descramble);
|
||||
|
||||
tvhinfo("satips", "SAT>IP Server initialized (HTTP %s:%d, RTSP %s:%d, descramble %d, DVB-T %d, DVB-S2 %d, DVB-C %d)",
|
||||
http_server_ip, http_server_port, http_server_ip, rtsp_port,
|
||||
descramble,
|
||||
config_get_int("satip_dvbt", 0),
|
||||
config_get_int("satip_dvbs", 0),
|
||||
config_get_int("satip_dvbc", 0));
|
||||
satip_server_info("", descramble);
|
||||
}
|
||||
|
||||
void satip_server_register(void)
|
||||
|
|
|
@ -224,7 +224,7 @@ tvheadend.miscconf = function(panel, index) {
|
|||
if (tvheadend.capabilities.indexOf('satip_server') !== -1) {
|
||||
var rtsp = new Ext.form.NumberField({
|
||||
name: 'satip_rtsp',
|
||||
fieldLabel: 'RTSP Port (554), 0 = disable'
|
||||
fieldLabel: 'RTSP Port (554 or 9983), 0 = disable'
|
||||
});
|
||||
var weight = new Ext.form.NumberField({
|
||||
name: 'satip_weight',
|
||||
|
|
Loading…
Add table
Reference in a new issue