Feature #4752 ยป SAT-IP-Server-RTP-bind-address.diff
src/satip/rtsp.c | ||
---|---|---|
80 | 80 |
static uint16_t stream_id; |
81 | 81 |
static char *rtsp_ip = NULL; |
82 | 82 |
static char *rtsp_nat_ip = NULL; |
83 |
static char *rtp_src_ip = NULL; |
|
83 | 84 |
static int rtsp_port = -1; |
84 | 85 |
static int rtsp_nat_port = -1; |
85 | 86 |
static int rtsp_descramble = 1; |
... | ... | |
1497 | 1498 |
!rs->rtp_udp_bound) { |
1498 | 1499 |
if (udp_bind_double(&rs->udp_rtp, &rs->udp_rtcp, |
1499 | 1500 |
LS_SATIPS, "rtsp", "rtcp", |
1500 |
rtsp_ip, 0, NULL, |
|
1501 |
(rtp_src_ip != NULL && rtp_src_ip[0] != '\0') ? rtp_src_ip : rtsp_ip, 0, NULL,
|
|
1501 | 1502 |
4*1024, 4*1024, |
1502 | 1503 |
RTP_BUFSIZE, RTCP_BUFSIZE)) { |
1503 | 1504 |
errcode = HTTP_STATUS_INTERNAL; |
... | ... | |
1766 | 1767 |
*/ |
1767 | 1768 |
void satip_server_rtsp_init |
1768 | 1769 |
(const char *bindaddr, int port, int descramble, int rewrite_pmt, int muxcnf, |
1769 |
const char *nat_ip, int nat_port) |
|
1770 |
const char *rtp_src, const char *nat_ip, int nat_port)
|
|
1770 | 1771 |
{ |
1771 | 1772 |
static tcp_server_ops_t ops = { |
1772 | 1773 |
.start = rtsp_serve, |
... | ... | |
1796 | 1797 |
rtsp_descramble = descramble; |
1797 | 1798 |
rtsp_rewrite_pmt = rewrite_pmt; |
1798 | 1799 |
rtsp_muxcnf = muxcnf; |
1800 |
s = rtp_src_ip; |
|
1801 |
rtp_src_ip = rtp_src ? strdup(rtp_src) : NULL; |
|
1802 |
free(s); |
|
1799 | 1803 |
s = rtsp_nat_ip; |
1800 | 1804 |
rtsp_nat_ip = nat_ip ? strdup(nat_ip) : NULL; |
1801 | 1805 |
free(s); |
... | ... | |
1824 | 1828 |
rtsp_port = -1; |
1825 | 1829 |
rtsp_nat_port = -1; |
1826 | 1830 |
free(rtsp_ip); |
1831 |
free(rtp_src_ip); |
|
1827 | 1832 |
free(rtsp_nat_ip); |
1828 |
rtsp_ip = rtsp_nat_ip = NULL; |
|
1833 |
rtsp_ip = rtp_src_ip = rtsp_nat_ip = NULL;
|
|
1829 | 1834 |
satip_rtp_done(); |
1830 | 1835 |
pthread_mutex_unlock(&global_lock); |
1831 | 1836 |
} |
src/satip/server.c | ||
---|---|---|
786 | 786 |
.opts = PO_EXPERT, |
787 | 787 |
.group = 2, |
788 | 788 |
}, |
789 |
{ |
|
790 |
.type = PT_STR, |
|
791 |
.id = "satip_rtp_src_ip", |
|
792 |
.name = N_("RTP Local bind IP address"), |
|
793 |
.desc = N_("Bind RTP source address of the outgoing RTP packets " |
|
794 |
"to specific local IP address " |
|
795 |
"(empty = same IP as the listening RTSP; " |
|
796 |
"0.0.0.0 = IP in network of default gateway; " |
|
797 |
"or write here a valid local IP address)."), |
|
798 |
.off = offsetof(struct satip_server_conf, satip_rtp_src_ip), |
|
799 |
.opts = PO_EXPERT, |
|
800 |
.group = 2, |
|
801 |
}, |
|
789 | 802 | |
790 | 803 | |
791 | 804 | |
... | ... | |
954 | 967 |
struct sockaddr_storage http; |
955 | 968 |
char http_ip[128]; |
956 | 969 |
int descramble, rewrite_pmt, muxcnf; |
957 |
char *nat_ip; |
|
970 |
char *nat_ip, *rtp_src_ip;
|
|
958 | 971 |
int nat_port; |
959 | 972 | |
960 | 973 |
if (satip_server_rtsp_port <= 0) |
... | ... | |
979 | 992 |
muxcnf = satip_server_conf.satip_muxcnf; |
980 | 993 |
nat_ip = strdup(satip_server_conf.satip_nat_ip ?: ""); |
981 | 994 |
nat_port = satip_server_conf.satip_nat_rtsp ?: satip_server_rtsp_port; |
995 |
rtp_src_ip = strdup(satip_server_conf.satip_rtp_src_ip ?: ""); |
|
982 | 996 | |
983 | 997 |
if (announce) |
984 | 998 |
pthread_mutex_unlock(&global_lock); |
985 | 999 | |
986 | 1000 |
pthread_mutex_lock(&satip_server_reinit); |
987 | 1001 | |
988 |
satip_server_rtsp_init(http_server_ip, satip_server_rtsp_port, descramble, rewrite_pmt, muxcnf, nat_ip, nat_port); |
|
1002 |
satip_server_rtsp_init(http_server_ip, satip_server_rtsp_port, descramble, rewrite_pmt, muxcnf, rtp_src_ip, nat_ip, nat_port);
|
|
989 | 1003 |
satip_server_info(prefix, descramble, muxcnf); |
990 | 1004 | |
991 | 1005 |
if (announce) |
... | ... | |
997 | 1011 |
pthread_mutex_lock(&global_lock); |
998 | 1012 | |
999 | 1013 |
free(nat_ip); |
1014 |
free(rtp_src_ip); |
|
1000 | 1015 |
} |
1001 | 1016 | |
1002 | 1017 |
/* |
src/satip/server.h | ||
---|---|---|
68 | 68 |
char *satip_nat_ip; |
69 | 69 |
int satip_nat_rtsp; |
70 | 70 |
int satip_nat_name_force; |
71 |
char *satip_rtp_src_ip; |
|
71 | 72 |
}; |
72 | 73 | |
73 | 74 |
extern struct satip_server_conf satip_server_conf; |
... | ... | |
98 | 99 | |
99 | 100 |
void satip_server_rtsp_init(const char *bindaddr, int port, |
100 | 101 |
int descramble, int rewrite_pmt, int muxcnf, |
102 |
const char *rtp_src, |
|
101 | 103 |
const char *nat_ip, int nat_port); |
102 | 104 |
void satip_server_rtsp_register(void); |
103 | 105 |
void satip_server_rtsp_done(void); |