Commit 9477ed6e authored by Simon Morlat's avatar Simon Morlat

don't remove/close/destroy the RtpTransport when rebinding sockets in case of...

don't remove/close/destroy the RtpTransport when rebinding sockets in case of ESOCKNOTCONN error on iOS
parent bb95930a
......@@ -1415,14 +1415,14 @@ void rtp_session_set_time_jump_limit(RtpSession *session, int milisecs){
else session->rtp.ts_jump=ts;
}
/**
* Closes the rtp and rtcp sockets.
**/
void rtp_session_release_sockets(RtpSession *session){
void _rtp_session_release_sockets(RtpSession *session, bool_t release_transports){
if (session->rtp.gs.socket!=(ortp_socket_t)-1) close_socket (session->rtp.gs.socket);
if (session->rtcp.gs.socket!=(ortp_socket_t)-1) close_socket (session->rtcp.gs.socket);
session->rtp.gs.socket=-1;
session->rtcp.gs.socket=-1;
if (!release_transports)
return;
if (session->rtp.gs.tr) {
if (session->rtp.gs.tr->t_close)
......@@ -1445,6 +1445,13 @@ void rtp_session_release_sockets(RtpSession *session){
*/
}
/**
* Closes the rtp and rtcp sockets, and associated RtpTransport.
**/
void rtp_session_release_sockets(RtpSession *session){
_rtp_session_release_sockets(session, TRUE);
}
ortp_socket_t rtp_session_get_rtp_socket(const RtpSession *session){
return rtp_session_using_transport(session, rtp) ? (session->rtp.gs.tr->t_getsocket)(session->rtp.gs.tr) : session->rtp.gs.socket;
}
......
......@@ -342,7 +342,7 @@ rtp_session_set_local_addr (RtpSession * session, const char * addr, int rtp_por
int sockfamily;
if (session->rtp.gs.socket!=(ortp_socket_t)-1){
/* don't rebind, but close before*/
rtp_session_release_sockets(session);
_rtp_session_release_sockets(session, FALSE);
}
/* try to bind the rtp port */
......
......@@ -86,4 +86,5 @@ bool_t ortp_stream_is_ipv6(OrtpStream *os);
int _rtp_session_sendto(RtpSession *session, bool_t is_rtp, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen);
int _ortp_sendto(ortp_socket_t sockfd, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen);
void _rtp_session_release_sockets(RtpSession *session, bool_t release_transports);
#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