Commit 211d12a2 authored by Ghislain MARY's avatar Ghislain MARY

Rework rtp_session_flush_sockets() so that STUN packets are handled during the flush.

parent 5ab29c50
......@@ -287,6 +287,9 @@ void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_t
rtp_session_update_payload_type(session,rtp->paytype);
}
/* Drop the packets while the RTP_SESSION_FLUSH flag is set. */
if (session->flags & RTP_SESSION_FLUSH) return;
jitter_control_new_packet(&session->rtp.jittctl,rtp->timestamp,local_str_ts);
update_rtcp_xr_stat_summary(session, mp, local_str_ts);
......
......@@ -921,28 +921,9 @@ void rtp_session_get_transports(RtpSession *session, RtpTransport **rtptr, RtpTr
*
**/
void rtp_session_flush_sockets(RtpSession *session){
unsigned char trash[4096];
struct sockaddr_storage from;
socklen_t fromlen=sizeof(from);
if (rtp_session_using_transport(session, rtp))
{
mblk_t *trashmp=esballoc(trash,sizeof(trash),0,NULL);
while (session->rtp.gs.tr->t_recvfrom(session->rtp.gs.tr,trashmp,0,(struct sockaddr *)&from,&fromlen)>0){};
if (session->rtcp.gs.tr)
while (session->rtcp.gs.tr->t_recvfrom(session->rtcp.gs.tr,trashmp,0,(struct sockaddr *)&from,&fromlen)>0){};
freemsg(trashmp);
return;
}
if (session->rtp.gs.socket!=(ortp_socket_t)-1){
while (recvfrom(session->rtp.gs.socket,(char*)trash,sizeof(trash),0,(struct sockaddr *)&from,&fromlen)>0){};
}
if (session->rtcp.gs.socket!=(ortp_socket_t)-1){
while (recvfrom(session->rtcp.gs.socket,(char*)trash,sizeof(trash),0,(struct sockaddr*)&from,&fromlen)>0){};
}
rtp_session_set_flag(session, RTP_SESSION_FLUSH);
rtp_session_rtp_recv(session, 0);
rtp_session_unset_flag(session, RTP_SESSION_FLUSH);
}
......
......@@ -43,6 +43,7 @@ typedef enum {
RTCP_OVERRIDE_JITTER=1<<12,
RTCP_OVERRIDE_DELAY=1<<13,
RTP_SESSION_RECV_SEQ_INIT=1<<14,
RTP_SESSION_FLUSH=1<<15
}RtpSessionFlags;
#define rtp_session_using_transport(s, stream) (((s)->flags & RTP_SESSION_USING_TRANSPORT) && (s->stream.gs.tr != 0))
......
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