minisatip.patch: increase UDP TX buf, implement 13V for unicable, allow configurable DVR buffer

This commit is contained in:
Jaroslav Kysela 2015-04-14 09:28:46 +02:00
parent c221bcf48e
commit 00bea9eeaa

View File

@ -1,5 +1,5 @@
diff --git a/adapter.c b/adapter.c diff --git a/adapter.c b/adapter.c
index 285faea..01f54b8 100755 index 285faea..ebc7694 100755
--- a/adapter.c --- a/adapter.c
+++ b/adapter.c +++ b/adapter.c
@@ -29,10 +29,15 @@ @@ -29,10 +29,15 @@
@ -68,7 +68,22 @@ index 285faea..01f54b8 100755
a[i].dvr = open (buf, O_RDONLY | O_NONBLOCK); a[i].dvr = open (buf, O_RDONLY | O_NONBLOCK);
if (a[i].fe < 0 || a[i].dvr < 0) if (a[i].fe < 0 || a[i].dvr < 0)
{ {
@@ -151,10 +181,12 @@ init_hw () @@ -139,22 +169,24 @@ init_hw ()
a[i].enabled = 1;
if (!a[i].buf)
- a[i].buf = malloc1 (ADAPTER_BUFFER + 10);
+ a[i].buf = malloc1 (opts.dvr + 10);
if (!a[i].buf)
{
LOG ("memory allocation failed for %d bytes failed, adapter %d",
- ADAPTER_BUFFER, i);
+ opts.dvr, i);
close_adapter (i);
continue;
}
- memset (a[i].buf, 0, ADAPTER_BUFFER + 1);
+ //memset (a[i].buf, 0, ADAPTER_BUFFER + 1);
num_adapters++; num_adapters++;
LOG ("opened DVB adapter %d fe:%d dvr:%d", i, a[i].fe, a[i].dvr); LOG ("opened DVB adapter %d fe:%d dvr:%d", i, a[i].fe, a[i].dvr);
@ -81,15 +96,17 @@ index 285faea..01f54b8 100755
init_dvb_parameters (&a[i].tp); init_dvb_parameters (&a[i].tp);
mark_pids_deleted (i, -1, NULL); mark_pids_deleted (i, -1, NULL);
update_pids (i); update_pids (i);
@@ -165,7 +197,7 @@ init_hw () @@ -165,8 +197,8 @@ init_hw ()
a[i].sock = a[i].sock =
sockets_add (a[i].dvr, NULL, i, TYPE_DVR, (socket_action) read_dmx, sockets_add (a[i].dvr, NULL, i, TYPE_DVR, (socket_action) read_dmx,
(socket_action) close_adapter_for_socket, (socket_action ) adapter_timeout); (socket_action) close_adapter_for_socket, (socket_action ) adapter_timeout);
- memset (a[i].buf, 0, ADAPTER_BUFFER + 1); - memset (a[i].buf, 0, ADAPTER_BUFFER + 1);
- set_socket_buffer (a[i].sock, a[i].buf, ADAPTER_BUFFER);
+ //memset (a[i].buf, 0, ADAPTER_BUFFER + 1); + //memset (a[i].buf, 0, ADAPTER_BUFFER + 1);
set_socket_buffer (a[i].sock, a[i].buf, ADAPTER_BUFFER); + set_socket_buffer (a[i].sock, a[i].buf, opts.dvr);
sockets_timeout (a[i].sock, 60000); sockets_timeout (a[i].sock, 60000);
LOG ("done opening adapter %i fe_sys %d", i, a[i].tp.sys); LOG ("done opening adapter %i fe_sys %d", i, a[i].tp.sys);
@@ -194,6 +226,24 @@ close_adapter (int na) @@ -194,6 +226,24 @@ close_adapter (int na)
mark_pids_deleted (na, -1, NULL); mark_pids_deleted (na, -1, NULL);
update_pids (na); update_pids (na);
@ -209,7 +226,32 @@ index 285faea..01f54b8 100755
t->c2tft, t->ds, t->plp, t->inversion); t->c2tft, t->ds, t->plp, t->inversion);
for (i = 0; i < MAX_PIDS; i++) for (i = 0; i < MAX_PIDS; i++)
if (use_ad && ad->pids[i].flags == 1) if (use_ad && ad->pids[i].flags == 1)
@@ -850,6 +920,31 @@ void set_unicable_adapters(char *o, int type) @@ -825,7 +895,7 @@ void enable_adapters(char *o)
void set_unicable_adapters(char *o, int type)
{
- int i, la, a_id, slot, freq;
+ int i, la, a_id, slot, freq, o13v;
char buf[100], *arg[20], *sep1, *sep2;
strncpy(buf, o, sizeof(buf));
@@ -839,17 +909,46 @@ void set_unicable_adapters(char *o, int type)
sep2 = strchr(arg[i], '-');
if( !sep1 || !sep2)
continue;
+ if(sep2[1] == '*') {
+ o13v = 1;
+ sep2++;
+ }
slot = map_intd(sep1 + 1, NULL, -1);
freq = map_intd(sep2 + 1, NULL, -1);
if( slot < 0 || freq < 0)
continue;
a[a_id].uslot = slot;
- a[a_id].ufreq = freq;
+ a[a_id].ufreq = o13v ? -freq : freq;
a[a_id].switch_type = type;
LOG("Setting %s adapter %d slot %d freq %d", type==SWITCH_UNICABLE?"unicable":"jess", a_id, slot, freq);
} }
} }
@ -242,18 +284,9 @@ index 285faea..01f54b8 100755
int delsys_match(adapter *ad, int del_sys) int delsys_match(adapter *ad, int del_sys)
{ {
diff --git a/adapter.h b/adapter.h diff --git a/adapter.h b/adapter.h
index 629bd9c..ec9f24f 100755 index 629bd9c..d95e59a 100755
--- a/adapter.h --- a/adapter.h
+++ b/adapter.h +++ b/adapter.h
@@ -7,7 +7,7 @@
#define MAX_ADAPTERS 8
#define DVR_BUFFER 30*1024*188
#define MAX_STREAMS_PER_PID 8
-#define ADAPTER_BUFFER 7*7*DVB_FRAME
+#define ADAPTER_BUFFER 70*7*DVB_FRAME
typedef struct struct_pid
{
int pid; // pid for this demux - not used
@@ -45,6 +45,7 @@ typedef struct struct_adapter @@ -45,6 +45,7 @@ typedef struct struct_adapter
int switch_type; int switch_type;
int uslot; // unicable/jess slot int uslot; // unicable/jess slot
@ -390,7 +423,7 @@ index 0000000..4c62d86
+ +
+#endif +#endif
diff --git a/dvb.c b/dvb.c diff --git a/dvb.c b/dvb.c
index 5701bd2..497526a 100755 index 5701bd2..32fd683 100755
--- a/dvb.c --- a/dvb.c
+++ b/dvb.c +++ b/dvb.c
@@ -41,6 +41,10 @@ @@ -41,6 +41,10 @@
@ -444,7 +477,21 @@ index 5701bd2..497526a 100755
if (ioctl(fd, FE_SET_VOLTAGE, pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13) == -1) if (ioctl(fd, FE_SET_VOLTAGE, pol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13) == -1)
LOG("send_diseqc: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno)); LOG("send_diseqc: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno));
@@ -262,6 +292,9 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int @@ -252,8 +282,12 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int
struct dvb_diseqc_master_cmd cmd = {
{0xe0, 0x11, 0x5a, 0x00, 0x00}, 5
};
- int t;
+ int t, o13v = 0;
+ if (ufreq < 0) {
+ o13v = 1;
+ ufreq = -ufreq;
+ }
t = (freq + ufreq + 2) / 4 - 350;
cmd.msg[3] = ((t & 0x0300) >> 8) |
@@ -262,12 +296,15 @@ int send_unicable(int fd, int freq, int pos, int pol, int hiband, int slot, int
LOGL(3, "send_unicable fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x", LOGL(3, "send_unicable fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x",
fd, freq, ufreq, pos, pol, hiband, slot, cmd.msg[0], cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]); fd, freq, ufreq, pos, pol, hiband, slot, cmd.msg[0], cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]);
@ -454,7 +501,22 @@ index 5701bd2..497526a 100755
if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1) if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1)
LOG("send_unicable: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s", fd, strerror(errno)); LOG("send_unicable: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s", fd, strerror(errno));
msleep(15); msleep(15);
@@ -295,6 +328,9 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1)
LOG("send_unicable: FE_SET_TONE failed for fd %d: %s", fd, strerror(errno));
- if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1)
+ if (!o13v && ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1)
LOG("send_unicable: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno));
msleep(15);
if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
@@ -286,6 +323,7 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre
};
// int t = (freq / 1000) - 100;
int t = freq - 100;
+ int o13v = ufreq < 0;
cmd.msg[1] = slot << 3;
cmd.msg[1] |= ((t << 8) & 0x07);
@@ -295,12 +333,15 @@ int send_jess(int fd, int freq, int pos, int pol, int hiband, int slot, int ufre
LOGL(3, "send_jess fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x", LOGL(3, "send_jess fd %d, freq %d, ufreq %d, pos = %d, pol = %d, hiband = %d, slot %d, diseqc => %02x %02x %02x %02x %02x",
fd, freq, ufreq, pos, pol, hiband, slot, cmd.msg[0], cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]); fd, freq, ufreq, pos, pol, hiband, slot, cmd.msg[0], cmd.msg[1], cmd.msg[2], cmd.msg[3], cmd.msg[4]);
@ -464,7 +526,14 @@ index 5701bd2..497526a 100755
if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1) if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) == -1)
LOG("send_jess: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s", fd, strerror(errno)); LOG("send_jess: pre voltage SEC_VOLTAGE_13 failed for fd %d: %s", fd, strerror(errno));
msleep(15); msleep(15);
@@ -320,7 +356,7 @@ int setup_switch (int frontend_fd, transponder *tp) if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1)
LOG("send_jess: FE_SET_TONE failed for fd %d: %s", fd, strerror(errno));
- if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1)
+ if (!o13v && ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) == -1)
LOG("send_jess: FE_SET_VOLTAGE failed for fd %d: %s", fd, strerror(errno));
msleep(15);
if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
@@ -320,7 +361,7 @@ int setup_switch (int frontend_fd, transponder *tp)
int diseqc = (tp->diseqc > 0)? tp->diseqc - 1: 0; int diseqc = (tp->diseqc > 0)? tp->diseqc - 1: 0;
int freq = tp->freq; int freq = tp->freq;
int pol = (tp->pol - 1) & 1; int pol = (tp->pol - 1) & 1;
@ -473,7 +542,7 @@ index 5701bd2..497526a 100755
if (freq < SLOF) if (freq < SLOF)
{ {
freq = (freq - LOF1); freq = (freq - LOF1);
@@ -330,12 +366,100 @@ int setup_switch (int frontend_fd, transponder *tp) @@ -330,12 +371,100 @@ int setup_switch (int frontend_fd, transponder *tp)
hiband = 1; hiband = 1;
} }
@ -574,7 +643,7 @@ index 5701bd2..497526a 100755
}else }else
{ {
if(tp->old_pol != pol || tp->old_hiband != hiband || tp->old_diseqc != diseqc) if(tp->old_pol != pol || tp->old_hiband != hiband || tp->old_diseqc != diseqc)
@@ -343,6 +467,16 @@ int setup_switch (int frontend_fd, transponder *tp) @@ -343,6 +472,16 @@ int setup_switch (int frontend_fd, transponder *tp)
else else
LOGL(3, "Skip sending diseqc commands since the switch position doesn't need to be changed: pol %d, hiband %d, switch position %d", pol, hiband, diseqc); LOGL(3, "Skip sending diseqc commands since the switch position doesn't need to be changed: pol %d, hiband %d, switch position %d", pol, hiband, diseqc);
} }
@ -591,7 +660,7 @@ index 5701bd2..497526a 100755
tp->old_pol = pol; tp->old_pol = pol;
tp->old_hiband = hiband; tp->old_hiband = hiband;
@@ -383,8 +517,10 @@ tune_it_s2 (int fd_frontend, transponder * tp) @@ -383,8 +522,10 @@ tune_it_s2 (int fd_frontend, transponder * tp)
{.cmd = DTV_INVERSION,.u.data = 0}, {.cmd = DTV_INVERSION,.u.data = 0},
{.cmd = DTV_SYMBOL_RATE,.u.data = 0}, {.cmd = DTV_SYMBOL_RATE,.u.data = 0},
{.cmd = DTV_INNER_FEC,.u.data = 0}, {.cmd = DTV_INNER_FEC,.u.data = 0},
@ -602,7 +671,7 @@ index 5701bd2..497526a 100755
{.cmd = DTV_TUNE}, {.cmd = DTV_TUNE},
}; };
static struct dtv_properties dvbs2_cmdseq = static struct dtv_properties dvbs2_cmdseq =
@@ -462,11 +598,15 @@ tune_it_s2 (int fd_frontend, transponder * tp) @@ -462,11 +603,15 @@ tune_it_s2 (int fd_frontend, transponder * tp)
tp->mtype = QPSK; tp->mtype = QPSK;
bpol = getTick(); bpol = getTick();
if_freq = setup_switch (fd_frontend, tp); if_freq = setup_switch (fd_frontend, tp);
@ -618,7 +687,7 @@ index 5701bd2..497526a 100755
p->props[INVERSION].u.data = tp->inversion; p->props[INVERSION].u.data = tp->inversion;
p->props[SYMBOL_RATE].u.data = tp->sr; p->props[SYMBOL_RATE].u.data = tp->sr;
p->props[FEC_INNER].u.data = tp->fec; p->props[FEC_INNER].u.data = tp->fec;
@@ -475,7 +615,12 @@ tune_it_s2 (int fd_frontend, transponder * tp) @@ -475,7 +620,12 @@ tune_it_s2 (int fd_frontend, transponder * tp)
LOG("tuning to %d(%d) pol: %s (%d) sr:%d fec:%s delsys:%s mod:%s rolloff:%s pilot:%s, ts clear=%d, ts pol=%d", LOG("tuning to %d(%d) pol: %s (%d) sr:%d fec:%s delsys:%s mod:%s rolloff:%s pilot:%s, ts clear=%d, ts pol=%d",
tp->freq, p->props[FREQUENCY].u.data, get_pol(tp->pol), tp->pol, p->props[SYMBOL_RATE].u.data, fe_fec[p->props[FEC_INNER].u.data], tp->freq, p->props[FREQUENCY].u.data, get_pol(tp->pol), tp->pol, p->props[SYMBOL_RATE].u.data, fe_fec[p->props[FEC_INNER].u.data],
fe_delsys[p->props[DELSYS].u.data], fe_modulation[p->props[MODULATION].u.data], fe_delsys[p->props[DELSYS].u.data], fe_modulation[p->props[MODULATION].u.data],
@ -632,7 +701,7 @@ index 5701bd2..497526a 100755
break; break;
@@ -560,6 +705,20 @@ set_pid (int hw, int ad, uint16_t i_pid) @@ -560,6 +710,20 @@ set_pid (int hw, int ad, uint16_t i_pid)
char buf[100]; char buf[100];
int fd; int fd;
@ -653,7 +722,7 @@ index 5701bd2..497526a 100755
if ( i_pid > 8192 ) if ( i_pid > 8192 )
LOG_AND_RETURN(-1, "pid %d > 8192 for /dev/dvb/adapter%d/demux%d", i_pid, hw, ad); LOG_AND_RETURN(-1, "pid %d > 8192 for /dev/dvb/adapter%d/demux%d", i_pid, hw, ad);
@@ -585,6 +744,7 @@ set_pid (int hw, int ad, uint16_t i_pid) @@ -585,6 +749,7 @@ set_pid (int hw, int ad, uint16_t i_pid)
} }
LOG ("setting filter on PID %d for fd %d", i_pid, fd); LOG ("setting filter on PID %d for fd %d", i_pid, fd);
@ -661,7 +730,7 @@ index 5701bd2..497526a 100755
return fd; return fd;
} }
@@ -592,6 +752,17 @@ set_pid (int hw, int ad, uint16_t i_pid) @@ -592,6 +757,17 @@ set_pid (int hw, int ad, uint16_t i_pid)
int del_filters (int fd, int pid) int del_filters (int fd, int pid)
{ {
@ -679,7 +748,7 @@ index 5701bd2..497526a 100755
if (fd < 0) if (fd < 0)
LOG_AND_RETURN(0, "DMX_STOP on an invalid handle %d, pid %d", fd, pid); LOG_AND_RETURN(0, "DMX_STOP on an invalid handle %d, pid %d", fd, pid);
if (ioctl (fd, DMX_STOP) < 0) if (ioctl (fd, DMX_STOP) < 0)
@@ -599,6 +770,7 @@ int del_filters (int fd, int pid) @@ -599,6 +775,7 @@ int del_filters (int fd, int pid)
else else
LOG ("clearing filters on PID %d FD %d", pid, fd); LOG ("clearing filters on PID %d FD %d", pid, fd);
close (fd); close (fd);
@ -687,7 +756,7 @@ index 5701bd2..497526a 100755
return 0; return 0;
} }
@@ -606,6 +778,15 @@ int del_filters (int fd, int pid) @@ -606,6 +783,15 @@ int del_filters (int fd, int pid)
fe_delivery_system_t fe_delivery_system_t
dvb_delsys (int aid, int fd, fe_delivery_system_t *sys) dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
{ {
@ -703,7 +772,7 @@ index 5701bd2..497526a 100755
int i, res, rv = 0; int i, res, rv = 0;
struct dvb_frontend_info fe_info; struct dvb_frontend_info fe_info;
@@ -703,6 +884,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys) @@ -703,6 +889,7 @@ dvb_delsys (int aid, int fd, fe_delivery_system_t *sys)
LOG ("returning default from dvb_delsys => %s (count %d)", fe_delsys[rv] , nsys); LOG ("returning default from dvb_delsys => %s (count %d)", fe_delsys[rv] , nsys);
return (fe_delivery_system_t) rv; return (fe_delivery_system_t) rv;
@ -712,7 +781,7 @@ index 5701bd2..497526a 100755
} }
diff --git a/minisatip.c b/minisatip.c diff --git a/minisatip.c b/minisatip.c
index d4076ba..ef21839 100755 index d4076ba..3203b5a 100755
--- a/minisatip.c --- a/minisatip.c
+++ b/minisatip.c +++ b/minisatip.c
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
@ -723,7 +792,7 @@ index d4076ba..ef21839 100755
#include "socketworks.h" #include "socketworks.h"
#include "stream.h" #include "stream.h"
#include "adapter.h" #include "adapter.h"
@@ -62,10 +63,14 @@ usage () @@ -62,10 +63,15 @@ usage ()
-c X: bandwidth capping for the output to the network (default: unlimited)\n\ -c X: bandwidth capping for the output to the network (default: unlimited)\n\
-b X: set the DVR buffer to X KB (default: %dKB)\n\ -b X: set the DVR buffer to X KB (default: %dKB)\n\
-l increases the verbosity (you can use multiple -l), logging to stdout in foreground mode or in /tmp/log when a daemon\n\ -l increases the verbosity (you can use multiple -l), logging to stdout in foreground mode or in /tmp/log when a daemon\n\
@ -731,6 +800,7 @@ index d4076ba..ef21839 100755
-p url: specify playlist url using X_SATIPM3U header \n\ -p url: specify playlist url using X_SATIPM3U header \n\
-u unicable_string: defines the unicable adapters (A) and their slot (S) and frequency (F):\n\ -u unicable_string: defines the unicable adapters (A) and their slot (S) and frequency (F):\n\
\tThe format is: A1:S1-F1[,A2:S2-F2[,...]] \n\ \tThe format is: A1:S1-F1[,A2:S2-F2[,...]] \n\
+ \tWhen * character is used before frequency, force 13V for setup\n\
-j jess_string: same format as unicable_string \n\ -j jess_string: same format as unicable_string \n\
+ -L link adapters (identical src,lo/hi,h/v), the format is M:S (master:slave)\n\ + -L link adapters (identical src,lo/hi,h/v), the format is M:S (master:slave)\n\
+ -Q quattro LNB config (H/H,H/V,L/H,L/V)\n\ + -Q quattro LNB config (H/H,H/V,L/H,L/V)\n\
@ -738,7 +808,12 @@ index d4076ba..ef21839 100755
", ",
DVR_BUFFER / 1024); DVR_BUFFER / 1024);
exit (1); exit (1);
@@ -101,7 +106,7 @@ set_options (int argc, char *argv[]) @@ -97,11 +103,11 @@ set_options (int argc, char *argv[])
opts.device_id = 0;
opts.bootid = 0;
opts.force_scan = 0;
- opts.dvr = DVR_BUFFER;
+ opts.dvr = 70*7*DVB_FRAME;
opts.file_line = 0; opts.file_line = 0;
memset(opts.playlist, sizeof(opts.playlist), 0); memset(opts.playlist, sizeof(opts.playlist), 0);
@ -747,7 +822,7 @@ index d4076ba..ef21839 100755
{ {
// printf("options %d %c %s\n",opt,opt,optarg); // printf("options %d %c %s\n",opt,opt,optarg);
switch (opt) switch (opt)
@@ -143,6 +148,12 @@ set_options (int argc, char *argv[]) @@ -143,6 +149,12 @@ set_options (int argc, char *argv[])
break; break;
} }
@ -760,7 +835,7 @@ index d4076ba..ef21839 100755
case HELP_OPT: case HELP_OPT:
{ {
usage (); usage ();
@@ -209,6 +220,28 @@ set_options (int argc, char *argv[]) @@ -209,6 +221,28 @@ set_options (int argc, char *argv[])
break; break;
} }
@ -789,7 +864,7 @@ index d4076ba..ef21839 100755
} }
} }
@@ -483,6 +516,11 @@ http_response (sockets *s, int rc, char *ah, char *desc, int cseq, int lr) @@ -483,6 +517,11 @@ http_response (sockets *s, int rc, char *ah, char *desc, int cseq, int lr)
#define RBUF 4000 #define RBUF 4000
@ -801,7 +876,7 @@ index d4076ba..ef21839 100755
int int
read_rtsp (sockets * s) read_rtsp (sockets * s)
{ {
@@ -507,8 +545,7 @@ read_rtsp (sockets * s) @@ -507,8 +546,7 @@ read_rtsp (sockets * s)
} }
} }
@ -811,7 +886,7 @@ index d4076ba..ef21839 100755
{ {
if( s->rlen > RBUF - 10 ) if( s->rlen > RBUF - 10 )
{ {
@@ -524,6 +561,9 @@ read_rtsp (sockets * s) @@ -524,6 +562,9 @@ read_rtsp (sockets * s)
return 0; return 0;
} }
@ -821,7 +896,7 @@ index d4076ba..ef21839 100755
rlen = s->rlen; rlen = s->rlen;
s->rlen = 0; s->rlen = 0;
@@ -726,8 +766,7 @@ read_http (sockets * s) @@ -726,8 +767,7 @@ read_http (sockets * s)
"%s" "%s"
"</device></root>"; "</device></root>";
@ -831,7 +906,7 @@ index d4076ba..ef21839 100755
{ {
if( s->rlen > RBUF - 10 ) if( s->rlen > RBUF - 10 )
{ {
@@ -749,6 +788,9 @@ read_http (sockets * s) @@ -749,6 +789,9 @@ read_http (sockets * s)
return 0; return 0;
} }
@ -841,7 +916,7 @@ index d4076ba..ef21839 100755
rlen = s->rlen; rlen = s->rlen;
s->rlen = 0; s->rlen = 0;
@@ -904,6 +946,9 @@ ssdp_reply (sockets * s) @@ -904,6 +947,9 @@ ssdp_reply (sockets * s)
return 0; return 0;
} }
@ -851,21 +926,21 @@ index d4076ba..ef21839 100755
// not my uuid // not my uuid
LOG("Received SSDP packet from %s:%d -> handle %d", inet_ntoa(s->sa.sin_addr), ntohs(s->sa.sin_port), s->sock); LOG("Received SSDP packet from %s:%d -> handle %d", inet_ntoa(s->sa.sin_addr), ntohs(s->sa.sin_port), s->sock);
LOGL(3, "%s", s->buf); LOGL(3, "%s", s->buf);
@@ -987,7 +1032,13 @@ main (int argc, char *argv[]) @@ -987,7 +1033,13 @@ main (int argc, char *argv[])
set_options (argc, argv); set_options (argc, argv);
if (opts.daemon) if (opts.daemon)
becomeDaemon (); becomeDaemon ();
+ if (opts.slog) + if (opts.slog)
+ openlog ("minisatip", LOG_NDELAY|LOG_NOWAIT|LOG_PID|(opts.slog>1?LOG_PERROR:0), LOG_DAEMON); + openlog ("minisatip", LOG_NDELAY|LOG_NOWAIT|LOG_PID|(opts.slog>1?LOG_PERROR:0), LOG_DAEMON);
+#ifdef AXE +#ifdef AXE
+ LOGL(0, "Starting minisatip version %s, compiled with AXE DVB API",VERSION); + LOGL(0, "Starting minisatip version %s, compiled with AXE DVB API, DVR buffer %d bytes",VERSION,opts.dvr);
+#else +#else
LOGL(0, "Starting minisatip version %s, compiled with dvbapi version: %04X",VERSION, DVBAPIVERSION); LOGL(0, "Starting minisatip version %s, compiled with dvbapi version: %04X",VERSION, DVBAPIVERSION);
+#endif +#endif
readBootID(); readBootID();
if ((ssdp = udp_bind (NULL, 1900)) < 1) if ((ssdp = udp_bind (NULL, 1900)) < 1)
FAIL ("SSDP: Could not bind on udp port 1900"); FAIL ("SSDP: Could not bind on udp port 1900");
@@ -1021,7 +1072,9 @@ main (int argc, char *argv[]) @@ -1021,7 +1073,9 @@ main (int argc, char *argv[])
select_and_execute (); select_and_execute ();
unlink(PID_FILE); unlink(PID_FILE);
free_all (); free_all ();
@ -876,7 +951,7 @@ index d4076ba..ef21839 100755
} }
@@ -1247,12 +1300,16 @@ void _log(int level, char * file, int line, const char *fmt, ...) { @@ -1247,12 +1301,16 @@ void _log(int level, char * file, int line, const char *fmt, ...) {
idx = 1; idx = 1;
else if ( idx < 0) else if ( idx < 0)
idx = 0; idx = 0;
@ -896,7 +971,7 @@ index d4076ba..ef21839 100755
both = 0; both = 0;
va_start(arg, fmt); va_start(arg, fmt);
len += vsnprintf(output[idx] + len, sizeof(output[0]) - len, fmt, arg); len += vsnprintf(output[idx] + len, sizeof(output[0]) - len, fmt, arg);
@@ -1271,9 +1328,9 @@ void _log(int level, char * file, int line, const char *fmt, ...) { @@ -1271,9 +1329,9 @@ void _log(int level, char * file, int line, const char *fmt, ...) {
} }
if(both){ if(both){
@ -962,3 +1037,38 @@ index b4891f1..1857089 100755
//force 0 at the end of the string //force 0 at the end of the string
if(ss->lbuf >= ss->rlen) if(ss->lbuf >= ss->rlen)
ss->buf[ss->rlen] = 0; ss->buf[ss->rlen] = 0;
diff --git a/stream.c b/stream.c
index db4a46d..d5b7761 100755
--- a/stream.c
+++ b/stream.c
@@ -320,6 +320,7 @@ int decode_transport (sockets * s, char *arg, char *default_rtp, int start_rtp)
if(sid->type == 0)
{
int i;
+ socklen_t sl;
struct sockaddr_in sa;
sid->type = STREAM_RTSP_UDP;
@@ -332,6 +333,13 @@ int decode_transport (sockets * s, char *arg, char *default_rtp, int start_rtp)
if((sid->rsock = udp_bind_connect (NULL, opts.start_rtp + (sid->sid * 2), p.dest, p.port, &sid->sa)) < 0)
LOG_AND_RETURN (-1, "decode_transport failed: UDP connection on rtp port to %s:%d failed", p.dest, p.port);
+
+ i = 512*1024;
+ if(setsockopt(sid->rsock, SOL_SOCKET, SO_SNDBUF, &i, sizeof(i)))
+ LOG("unable to set output UDP buffer size to %d", i);
+ sl = sizeof(int);
+ if(!getsockopt(sid->rsock, SOL_SOCKET, SO_SNDBUF, &i, &sl))
+ LOG("output UDP buffer size is %d bytes", i);
if ((sid->rtcp = udp_bind_connect (NULL, opts.start_rtp + (sid->sid * 2) +1, p.dest, p.port + 1, &sa)) < 1)
LOG_AND_RETURN (-1, "decode_transport failed: UDP connection on rtcp port to %s:%d failed", p.dest, p.port+1);
@@ -582,7 +590,7 @@ send_rtcp (int s_id, int ctime)
rtcp[51] = 0;
rtcp[52] = 0x80;
rtcp[53] = 0xCC;
- copy16( rtcp, 54, (la + 16) / 4);
+ copy16( rtcp, 54, ((la + 16 + 3) / 4) - 1);
copy32( rtcp, 56, sid->ssrc);
rtcp[60] = 'S';
rtcp[61] = 'E';