linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-developers] RTP session stays active when other party beco


From: damico
Subject: Re: [Linphone-developers] RTP session stays active when other party becomes unreachable
Date: Mon, 01 Sep 2008 14:48:37 +0200
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

Simon Morlat ha scritto:
Hi Simon,
Many thanks for the tips. I've backported  that feature and it works grate!

Just a note:
I've moved the timeout of 30 seconds out of mediastreamer to
linphonecore in order to put it in the conf file. If you are interested
I can send a patch.
Yes please .
Thanks in advance,

Simon
Hi Simon,
I put it in rtp section as nortp_timeout element... I don't know if it is the right place, change it according your taste.
I chose to use the value 0 to disabling the automatic disconnection.

Regards

--Michele
### Eclipse Workspace Patch 1.0
#P linphone_upstream
Index: coreapi/linphonecore.c
===================================================================
RCS file: /sources/linphone/linphone/coreapi/linphonecore.c,v
retrieving revision 1.224
diff -u -r1.224 linphonecore.c
--- coreapi/linphonecore.c      31 Aug 2008 20:49:47 -0000      1.224
+++ coreapi/linphonecore.c      1 Sep 2008 12:37:01 -0000
@@ -467,6 +467,7 @@
 {
        int port;
        int jitt_comp;
+       int nortp_timeout;
        port=lp_config_get_int(lc->config,"rtp","audio_rtp_port",7078);
        linphone_core_set_audio_port(lc,port);
        
@@ -477,6 +478,8 @@
        jitt_comp=lp_config_get_int(lc->config,"rtp","audio_jitt_comp",60);
        linphone_core_set_audio_jittcomp(lc,jitt_comp);         
        jitt_comp=lp_config_get_int(lc->config,"rtp","video_jitt_comp",60);
+       nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30);
+       linphone_core_set_nortp_timeout(lc,nortp_timeout);      
 }
 
 
@@ -890,6 +893,10 @@
        return lc->rtp_conf.video_rtp_port;
 }
 
+int linphone_core_get_nortp_timeout(const LinphoneCore *lc){
+       return lc->rtp_conf.nortp_timeout;
+}
+
 void linphone_core_set_audio_jittcomp(LinphoneCore *lc, int value)
 {
        lc->rtp_conf.audio_jitt_comp=value;
@@ -904,6 +911,10 @@
        lc->rtp_conf.video_rtp_port=port;
 }
 
+void linphone_core_set_nortp_timeout(LinphoneCore *lc, int nortp_timeout){
+       lc->rtp_conf.nortp_timeout=nortp_timeout;
+}
+
 bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc)
 {
        return lc->sip_conf.use_info;
@@ -990,6 +1001,7 @@
 {
        eXosip_event_t *ev;
        bool_t disconnected=FALSE;
+       int disconnect_timeout = linphone_core_get_nortp_timeout(lc); 
        if (lc->preview_finished){
                lc->preview_finished=0;
                ring_stop(lc->ringstream);
@@ -1028,8 +1040,8 @@
                        if (lc->videostream!=NULL)
                                video_stream_iterate(lc->videostream);
 #endif
-                       if (lc->audiostream!=NULL)
-                               
disconnected=!audio_stream_alive(lc->audiostream);
+                       if (lc->audiostream!=NULL && disconnect_timeout>0)
+                               
disconnected=!audio_stream_alive(lc->audiostream,disconnect_timeout);
                }
        }
        if (linphone_core_video_preview_enabled(lc)){
@@ -2129,6 +2141,7 @@
        
lp_config_set_int(lc->config,"rtp","video_rtp_port",config->video_rtp_port);
        
lp_config_set_int(lc->config,"rtp","audio_jitt_comp",config->audio_jitt_comp);
        
lp_config_set_int(lc->config,"rtp","video_jitt_comp",config->audio_jitt_comp);
+       
lp_config_set_int(lc->config,"rtp","nortp_timeout",config->nortp_timeout);
 }
 
 void sound_config_uninit(LinphoneCore *lc)
Index: coreapi/linphonecore.h
===================================================================
RCS file: /sources/linphone/linphone/coreapi/linphonecore.h,v
retrieving revision 1.127
diff -u -r1.127 linphonecore.h
--- coreapi/linphonecore.h      31 Aug 2008 20:49:47 -0000      1.127
+++ coreapi/linphonecore.h      1 Sep 2008 12:37:02 -0000
@@ -63,6 +63,7 @@
        int video_rtp_port;
        int audio_jitt_comp;  /*jitter compensation*/
        int video_jitt_comp;  /*jitter compensation*/
+       int nortp_timeout;
 }rtp_config_t;
 
 
@@ -584,10 +585,14 @@
 
 int linphone_core_get_video_port(const LinphoneCore *lc);
 
+int linphone_core_get_nortp_timeout(const LinphoneCore *lc);
+
 void linphone_core_set_audio_port(LinphoneCore *lc, int port);
 
 void linphone_core_set_video_port(LinphoneCore *lc, int port);
 
+void linphone_core_set_nortp_timeout(LinphoneCore *lc, int port);
+
 void linphone_core_set_use_info_for_dtmf(LinphoneCore *lc, bool_t use_info);
 
 bool_t linphone_core_get_use_info_for_dtmf(LinphoneCore *lc);
Index: mediastreamer2/src/audiostream.c
===================================================================
RCS file: /sources/linphone/linphone/mediastreamer2/src/audiostream.c,v
retrieving revision 1.19
diff -u -r1.19 audiostream.c
--- mediastreamer2/src/audiostream.c    31 Aug 2008 20:49:47 -0000      1.19
+++ mediastreamer2/src/audiostream.c    1 Sep 2008 12:37:02 -0000
@@ -119,7 +119,7 @@
        return rtpr;
 }
 
-bool_t audio_stream_alive(AudioStream * stream){
+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){
@@ -127,8 +127,8 @@
                        stream->last_packet_count=stats->recv;
                        stream->last_packet_time=time(NULL);
                }else{
-                       if (time(NULL)-stream->last_packet_time>30){
-                               /* more than 30 seconds of inactivity*/
+                       if (time(NULL)-stream->last_packet_time>timeout){
+                               /* more than timeout seconds of inactivity*/
                                return FALSE;
                        }
                }
Index: mediastreamer2/include/mediastreamer2/mediastream.h
===================================================================
RCS file: 
/sources/linphone/linphone/mediastreamer2/include/mediastreamer2/mediastream.h,v
retrieving revision 1.16
diff -u -r1.16 mediastream.h
--- mediastreamer2/include/mediastreamer2/mediastream.h 31 Aug 2008 20:49:47 
-0000      1.16
+++ mediastreamer2/include/mediastreamer2/mediastream.h 1 Sep 2008 12:37:02 
-0000
@@ -83,8 +83,8 @@
 AudioStream *audio_stream_new(int locport, bool_t ipv6);
 int audio_stream_start_now(AudioStream * stream, RtpProfile * prof,  const 
char *remip, int remport, int rem_rtcp_port, int payload_type, int 
jitt_comp,MSSndCard *playcard, MSSndCard *captcard, bool_t echo_cancel);
 void audio_stream_set_relay_session_id(AudioStream *stream, const char 
*relay_session_id);
-/*returns true if we are still receiving some data from remote end */
-bool_t audio_stream_alive(AudioStream * stream);
+/*returns true if we are still receiving some data from remote end in the last 
timeout seconds*/
+bool_t audio_stream_alive(AudioStream * stream, int timeout);
 
 /* stop the above process*/
 void audio_stream_stop (AudioStream * stream);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]