Commit a9ffd72d authored by Simon Morlat's avatar Simon Morlat

new feature: multiple destinations can be added for a RtpSession.

parent c52efa88
...@@ -253,6 +253,8 @@ typedef unsigned char bool_t; ...@@ -253,6 +253,8 @@ typedef unsigned char bool_t;
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
typedef struct _OList OList;
typedef struct ortpTimeSpec{ typedef struct ortpTimeSpec{
int64_t tv_sec; int64_t tv_sec;
int64_t tv_nsec; int64_t tv_nsec;
......
...@@ -202,11 +202,16 @@ typedef struct OrtpRtcpXrStats { ...@@ -202,11 +202,16 @@ typedef struct OrtpRtcpXrStats {
uint32_t discarded_count; uint32_t discarded_count;
} OrtpRtcpXrStats; } OrtpRtcpXrStats;
typedef struct _OrtpAddress{
struct sockaddr_storage addr;
socklen_t len;
}OrtpAddress;
typedef struct _OrtpStream { typedef struct _OrtpStream {
ortp_socket_t socket; ortp_socket_t socket;
int sockfamily; int sockfamily;
int loc_port; int loc_port;
int rem_addrlen; socklen_t rem_addrlen;
struct sockaddr_storage rem_addr; struct sockaddr_storage rem_addr;
struct _RtpTransport *tr; struct _RtpTransport *tr;
mblk_t *cached_mp; mblk_t *cached_mp;
...@@ -216,6 +221,7 @@ typedef struct _OrtpStream { ...@@ -216,6 +221,7 @@ typedef struct _OrtpStream {
unsigned int recv_bytes; /* used for bandwidth estimation */ unsigned int recv_bytes; /* used for bandwidth estimation */
float upload_bw; float upload_bw;
float download_bw; float download_bw;
OList *aux_destinations; /*list of OrtpAddress */
} OrtpStream; } OrtpStream;
typedef struct _RtpStream typedef struct _RtpStream
...@@ -382,6 +388,8 @@ rtp_session_set_remote_addr_full (RtpSession * session, const char * rtp_addr, i ...@@ -382,6 +388,8 @@ rtp_session_set_remote_addr_full (RtpSession * session, const char * rtp_addr, i
/*same as previous function, old name:*/ /*same as previous function, old name:*/
ORTP_PUBLIC int rtp_session_set_remote_addr_and_port (RtpSession * session, const char * addr, int rtp_port, int rtcp_port); ORTP_PUBLIC int rtp_session_set_remote_addr_and_port (RtpSession * session, const char * addr, int rtp_port, int rtcp_port);
ORTP_PUBLIC int rtp_session_set_remote_addr(RtpSession *session,const char *addr, int port); ORTP_PUBLIC int rtp_session_set_remote_addr(RtpSession *session,const char *addr, int port);
ORTP_PUBLIC int rtp_session_add_aux_remote_addr_full(RtpSession * session, const char * rtp_addr, int rtp_port, const char * rtcp_addr, int rtcp_port);
ORTP_PUBLIC void rtp_session_clear_aux_remote_addr(RtpSession * session);
/* alternatively to the set_remote_addr() and set_local_addr(), an application can give /* alternatively to the set_remote_addr() and set_local_addr(), an application can give
a valid socket (potentially connect()ed )to be used by the RtpSession */ a valid socket (potentially connect()ed )to be used by the RtpSession */
ORTP_PUBLIC void rtp_session_set_sockets(RtpSession *session, int rtpfd, int rtcpfd); ORTP_PUBLIC void rtp_session_set_sockets(RtpSession *session, int rtpfd, int rtcpfd);
......
...@@ -1390,6 +1390,22 @@ void rtp_session_dispatch_event(RtpSession *session, OrtpEvent *ev){ ...@@ -1390,6 +1390,22 @@ void rtp_session_dispatch_event(RtpSession *session, OrtpEvent *ev){
ortp_event_destroy(ev); ortp_event_destroy(ev);
} }
void ortp_stream_clear_aux_addresses(OrtpStream *os){
OList *elem;
for (elem=os->aux_destinations;elem!=NULL;elem=elem->next){
OrtpAddress *addr=(OrtpAddress*)elem->data;
ortp_free(addr);
}
os->aux_destinations=o_list_free(os->aux_destinations);
}
static void ortp_stream_uninit(OrtpStream *os){
if (os->cached_mp) {
freemsg(os->cached_mp);
os->cached_mp=NULL;
}
ortp_stream_clear_aux_addresses(os);
}
void rtp_session_uninit (RtpSession * session) void rtp_session_uninit (RtpSession * session)
{ {
...@@ -1409,8 +1425,8 @@ void rtp_session_uninit (RtpSession * session) ...@@ -1409,8 +1425,8 @@ void rtp_session_uninit (RtpSession * session)
wait_point_uninit(&session->snd.wp); wait_point_uninit(&session->snd.wp);
wait_point_uninit(&session->rcv.wp); wait_point_uninit(&session->rcv.wp);
if (session->current_tev!=NULL) freemsg(session->current_tev); if (session->current_tev!=NULL) freemsg(session->current_tev);
if (session->rtp.gs.cached_mp!=NULL) freemsg(session->rtp.gs.cached_mp); ortp_stream_uninit(&session->rtp.gs);
if (session->rtcp.gs.cached_mp!=NULL) freemsg(session->rtcp.gs.cached_mp); ortp_stream_uninit(&session->rtcp.gs);
if (session->full_sdes != NULL) if (session->full_sdes != NULL)
freemsg(session->full_sdes); freemsg(session->full_sdes);
if (session->minimal_sdes != NULL) if (session->minimal_sdes != NULL)
......
This diff is collapsed.
...@@ -78,4 +78,6 @@ bool_t rtp_session_has_fb_packets_to_send(RtpSession *session); ...@@ -78,4 +78,6 @@ bool_t rtp_session_has_fb_packets_to_send(RtpSession *session);
void rtp_session_send_regular_rtcp_packet_and_reschedule(RtpSession *session, uint64_t tc); void rtp_session_send_regular_rtcp_packet_and_reschedule(RtpSession *session, uint64_t tc);
void rtp_session_send_fb_rtcp_packet_and_reschedule(RtpSession *session); void rtp_session_send_fb_rtcp_packet_and_reschedule(RtpSession *session);
void ortp_stream_clear_aux_addresses(OrtpStream *os);
#endif #endif
...@@ -46,7 +46,7 @@ OList * o_list_append(OList *elem, void * data){ ...@@ -46,7 +46,7 @@ OList * o_list_append(OList *elem, void * data){
OList * o_list_free(OList *list){ OList * o_list_free(OList *list){
OList *elem = list; OList *elem = list;
OList *tmp; OList *tmp;
return_val_if_fail(list, list); if (!list) return NULL;
while(elem->next!=NULL) { while(elem->next!=NULL) {
tmp = elem; tmp = elem;
elem = elem->next; elem = elem->next;
......
...@@ -36,8 +36,6 @@ struct _OList { ...@@ -36,8 +36,6 @@ struct _OList {
void *data; void *data;
}; };
typedef struct _OList OList;
#define o_list_next(elem) ((elem)->next) #define o_list_next(elem) ((elem)->next)
......
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