|
From: | damico |
Subject: | Re: [Linphone-users] SIP Session Timers |
Date: | Wed, 09 Feb 2011 18:46:37 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
Hi Dan, try this patch... I write it on the fly (without compiling :) ) I think it should work. I wrote a patch like this for an old linphone version. I hope it works and fix your issue. Regards --Michele diff --git a/src/audiostream.c b/src/audiostream.c index 45764d4..586db87 100644 --- a/src/audiostream.c +++ b/src/audiostream.c @@ -144,27 +144,30 @@ ms_time (time_t *t) } #endif +static void _reset_rtp_alive_info(AudioStream * stream){ + stream->last_packet_count=0; + stream->last_packet_time=time(NULL); +} + bool_t audio_stream_alive(AudioStream * stream, int timeout){ RtpSession *session=stream->session; const rtp_stats_t *stats=rtp_session_get_stats(session); - if (stats->recv!=0){ - if (stream->evq){ - OrtpEvent *ev=ortp_ev_queue_get(stream->evq); - if (ev!=NULL){ - if (ortp_event_get_type(ev)==ORTP_EVENT_RTCP_PACKET_RECEIVED){ - stream->last_packet_time=ms_time(NULL); - } - ortp_event_destroy(ev); + if (stats->recv && stream->evq){ + OrtpEvent *ev=ortp_ev_queue_get(stream->evq); + if (ev!=NULL){ + if (ortp_event_get_type(ev)==ORTP_EVENT_RTCP_PACKET_RECEIVED){ + stream->last_packet_time=ms_time(NULL); } + ortp_event_destroy(ev); } - if (stats->recv!=stream->last_packet_count){ - stream->last_packet_count=stats->recv; - stream->last_packet_time=ms_time(NULL); - }else{ - if (ms_time(NULL)-stream->last_packet_time>timeout){ - /* more than timeout seconds of inactivity*/ - return FALSE; - } + } + if (stats->recv!=stream->last_packet_count){ + stream->last_packet_count=stats->recv; + stream->last_packet_time=ms_time(NULL); + }else{ + if (ms_time(NULL)-stream->last_packet_time>timeout){ + /* more than timeout seconds of inactivity*/ + return FALSE; } } return TRUE; @@ -206,6 +209,7 @@ static void payload_type_changed(RtpSession *session, unsigned long data){ AudioStream *stream=(AudioStream*)data; int pt=rtp_session_get_recv_payload_type(stream->session); audio_stream_change_decoder(stream,pt); + _reset_rtp_alive_info(stream); } int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char *remip,int remport, @@ -379,6 +383,8 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ms_ticker_attach(stream->ticker,stream->soundread); ms_ticker_attach(stream->ticker,stream->rtprecv); + _reset_rtp_alive_info(stream); + return 0; } On 09/02/2011 18:08, Dan Le wrote: Thanks for the response Simon. |
[Prev in Thread] | Current Thread | [Next in Thread] |