Commit 1ec8cf4d authored by Mickaël Turnel's avatar Mickaël Turnel

Flush the queue in rtp recv each time we pause the call

parent 3c1650c5
......@@ -619,8 +619,8 @@ ORTP_PUBLIC int rtp_session_recvfrom(RtpSession *session, bool_t is_rtp, mblk_t
ORTP_PUBLIC int rtp_session_recv_with_ts(RtpSession *session, uint8_t *buffer, int len, uint32_t ts, int *have_more);
ORTP_PUBLIC int rtp_session_send_with_ts(RtpSession *session, const uint8_t *buffer, int len, uint32_t userts);
/* Specific function only called in Windows environment */
ORTP_PUBLIC void rtp_session_stop_async_recvfrom(RtpSession *session);
/* Specific function called to reset the winrq queue and if called on windows to stop the async reception thread */
ORTP_PUBLIC void rtp_session_reset_recvfrom(RtpSession *session);
/* event API*/
ORTP_PUBLIC void rtp_session_register_event_queue(RtpSession *session, OrtpEvQueue *q);
......
......@@ -263,6 +263,7 @@ rtp_session_init (RtpSession * session, int mode)
session->multicast_loopback=RTP_DEFAULT_MULTICAST_LOOPBACK;
qinit(&session->rtp.rq);
qinit(&session->rtp.tev_rq);
qinit(&session->rtp.winrq);
qinit(&session->contributing_sources);
session->eventqs=NULL;
......@@ -315,7 +316,6 @@ rtp_session_init (RtpSession * session, int mode)
session->rtp.is_win_thread_running = FALSE;
ortp_mutex_init(&session->rtp.winrq_lock, NULL);
#endif
qinit(&session->rtp.winrq);
}
void rtp_session_enable_congestion_detection(RtpSession *session, bool_t enabled){
......@@ -1564,7 +1564,11 @@ static void ortp_stream_uninit(OrtpStream *os){
}
void rtp_session_uninit (RtpSession * session)
{
{
RtpTransport *rtp_meta_transport = NULL;
RtpTransport *rtcp_meta_transport = NULL;
/* If rtp async thread is running stop it and wait fot it to finish */
#if defined(_WIN32) || defined(_WIN32_WCE)
if (session->rtp.is_win_thread_running) {
session->rtp.is_win_thread_running = FALSE;
......@@ -1572,18 +1576,17 @@ void rtp_session_uninit (RtpSession * session)
}
ortp_mutex_destroy(&session->rtp.winrq_lock);
#endif
flushq(&session->rtp.winrq, FLUSHALL);
RtpTransport *rtp_meta_transport = NULL;
RtpTransport *rtcp_meta_transport = NULL;
/* first of all remove the session from the scheduler */
if (session->flags & RTP_SESSION_SCHEDULED)
{
rtp_scheduler_remove_session (session->sched,session);
}
/*flush all queues */
flushq(&session->rtp.rq, FLUSHALL);
flushq(&session->rtp.tev_rq, FLUSHALL);
flushq(&session->rtp.winrq, FLUSHALL);
if (session->eventqs!=NULL) o_list_free(session->eventqs);
/* close sockets */
......@@ -2510,8 +2513,10 @@ bool_t ortp_stream_is_ipv6(OrtpStream *os) {
return FALSE;
}
void rtp_session_stop_async_recvfrom(RtpSession *session) {
void rtp_session_reset_recvfrom(RtpSession *session) {
#if defined(_WIN32) || defined(_WIN32_WCE)
session->rtp.is_win_thread_running = FALSE;
ortp_thread_join(session->rtp.win_t, NULL);
#endif
flushq(&session->rtp.winrq, FLUSHALL);
}
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