Commit 44c225af authored by jehan's avatar jehan

store bound local address in rtpsession object

parent e5470e27
......@@ -2,6 +2,12 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT([ortp],[0.23.0])
AC_CANONICAL_SYSTEM
case $INSTALL in
*ginstall*)
INSTALL="$INSTALL -C"
;;
esac
dnl Source packaging numbers
ORTP_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
ORTP_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
......
......@@ -359,6 +359,9 @@ ORTP_PUBLIC void ortp_shm_close(void *memory);
#define ORTP_VAR_PUBLIC extern
#endif
#ifndef IN6_IS_ADDR_MULTICAST
#define IN6_IS_ADDR_MULTICAST(i) (((uint8_t *) (i))[0] == 0xff)
#endif
/*define __ios when we are compiling for ios.
The TARGET_OS_IPHONE macro is stupid, it is defined to 0 when compiling on mac os x.
......
......@@ -242,6 +242,8 @@ typedef struct _OrtpStream {
int loc_port;
socklen_t rem_addrlen;
struct sockaddr_storage rem_addr;
socklen_t loc_addrlen;
struct sockaddr_storage loc_addr;
struct _RtpTransport *tr;
mblk_t *cached_mp;
struct timeval send_bw_start; /* used for bandwidth estimation */
......
......@@ -98,7 +98,7 @@ static bool_t try_connect(int fd, const struct sockaddr *dest, socklen_t addrlen
return TRUE;
}
static ortp_socket_t create_and_bind(const char *addr, int *port, int *sock_family, bool_t reuse_addr){
static ortp_socket_t create_and_bind(const char *addr, int *port, int *sock_family, bool_t reuse_addr,struct sockaddr_storage* bound_addr,socklen_t *bound_addr_len){
int err;
int optval = 1;
ortp_socket_t sock=-1;
......@@ -181,6 +181,8 @@ static ortp_socket_t create_and_bind(const char *addr, int *port, int *sock_fami
close_socket (sock);
sock=-1;
continue;
} else {
ortp_message ("RTP socket [%i] has joined address group [%s]",sock, addr);
}
}
break;
......@@ -197,6 +199,8 @@ static ortp_socket_t create_and_bind(const char *addr, int *port, int *sock_fami
close_socket (sock);
sock=-1;
continue;
} else {
ortp_message ("RTP socket 6 [%i] has joined address group [%s]",sock, addr);
}
}
break;
......@@ -204,6 +208,9 @@ static ortp_socket_t create_and_bind(const char *addr, int *port, int *sock_fami
#endif /*hpux*/
break;
}
memcpy(bound_addr,res0->ai_addr,res0->ai_addrlen);
*bound_addr_len=res0->ai_addrlen;
freeaddrinfo(res0);
#if defined(WIN32) || defined(_WIN32_WCE)
......@@ -302,14 +309,14 @@ rtp_session_set_local_addr (RtpSession * session, const char * addr, int rtp_por
}
/* try to bind the rtp port */
sock=create_and_bind(addr,&rtp_port,&sockfamily,session->reuseaddr);
sock=create_and_bind(addr,&rtp_port,&sockfamily,session->reuseaddr,&session->rtp.gs.loc_addr,&session->rtp.gs.loc_addrlen);
if (sock!=-1){
set_socket_sizes(sock,session->rtp.snd_socket_size,session->rtp.rcv_socket_size);
session->rtp.gs.sockfamily=sockfamily;
session->rtp.gs.socket=sock;
session->rtp.gs.loc_port=rtp_port;
/*try to bind rtcp port */
sock=create_and_bind(addr,&rtcp_port,&sockfamily,session->reuseaddr);
sock=create_and_bind(addr,&rtcp_port,&sockfamily,session->reuseaddr,&session->rtcp.gs.loc_addr,&session->rtcp.gs.loc_addrlen);
if (sock!=(ortp_socket_t)-1){
session->rtcp.gs.sockfamily=sockfamily;
session->rtcp.gs.socket=sock;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment