Commit 93607074 authored by Simon Morlat's avatar Simon Morlat

meta_rtp_transport should take into account the case where the packet is fragmented.

parent a3debbd3
......@@ -1996,7 +1996,7 @@ void meta_rtp_set_session(RtpSession *s,MetaRtpTransportImpl *m){
m->has_set_session=TRUE;
}
int meta_rtp_transport_sendto(RtpTransport *t, mblk_t *msg , int flags, const struct sockaddr *to, socklen_t tolen) {
int meta_rtp_transport_sendto(RtpTransport *t, mblk_t *msg , int flags, const struct sockaddr *to, socklen_t tolen) {
int prev_ret,ret;
OList *elem;
MetaRtpTransportImpl *m = (MetaRtpTransportImpl*)t->data;
......@@ -2019,7 +2019,7 @@ int meta_rtp_transport_sendto(RtpTransport *t, mblk_t *msg , int flags, const s
if (m->endpoint!=NULL){
ret=m->endpoint->t_sendto(m->endpoint,msg,flags,to,tolen);
}else{
ret=sendto(m->is_rtp?t->session->rtp.gs.socket:t->session->rtcp.gs.socket,(void*)msg->b_rptr,msgdsize(msg),flags,to,tolen);
ret=_ortp_sendto(m->is_rtp?t->session->rtp.gs.socket:t->session->rtcp.gs.socket,msg,flags,to,tolen);
}
return ret;
}
......
......@@ -948,7 +948,7 @@ void rtp_session_flush_sockets(RtpSession *session){
#ifdef USE_SENDMSG
#define MAX_IOV 30
static int rtp_sendmsg(int sock,mblk_t *m, struct sockaddr *rem_addr, int addr_len){
static int rtp_sendmsg(int sock,mblk_t *m, const struct sockaddr *rem_addr, socklen_t addr_len){
int error;
struct msghdr msg;
struct iovec iov[MAX_IOV];
......@@ -972,6 +972,18 @@ static int rtp_sendmsg(int sock,mblk_t *m, struct sockaddr *rem_addr, int addr_l
}
#endif
int _ortp_sendto(ortp_socket_t sockfd, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen){
int error;
#ifdef USE_SENDMSG
error=rtp_sendmsg(sockfd,m,destaddr,destlen);
#else
if (m->b_cont!=NULL)
msgpullup(m,-1);
error = sendto (sockfd, (char*)m->b_rptr, (int) (m->b_wptr - m->b_rptr),
0,destaddr,destlen);
#endif
return error;
}
static void update_sent_bytes(OrtpStream *os, int nbytes) {
int overhead = ortp_stream_is_ipv6(os) ? IP6_UDP_OVERHEAD : IP_UDP_OVERHEAD;
......@@ -1005,14 +1017,7 @@ static int rtp_session_rtp_sendto(RtpSession * session, mblk_t * m, struct socka
if (rtp_session_using_transport(session, rtp)){
error = (session->rtp.gs.tr->t_sendto) (session->rtp.gs.tr,m,0,destaddr,destlen);
}else{
#ifdef USE_SENDMSG
error=rtp_sendmsg(sockfd,m,destaddr,destlen);
#else
if (m->b_cont!=NULL)
msgpullup(m,-1);
error = sendto (sockfd, (char*)m->b_rptr, (int) (m->b_wptr - m->b_rptr),
0,destaddr,destlen);
#endif
error=_ortp_sendto(sockfd,m,0,destaddr,destlen);
}
if (!is_aux){
/*errors to auxiliary destinations are not notified*/
......
......@@ -83,4 +83,6 @@ uint64_t ortp_timeval_to_ntp(const struct timeval *tv);
bool_t ortp_stream_is_ipv6(OrtpStream *os);
int _ortp_sendto(ortp_socket_t sockfd, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen);
#endif
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