Commit 43da5cdd authored by Simon Morlat's avatar Simon Morlat
Browse files

audio_stream_alive() now returns FALSE after timeout reached even if no RTP...

audio_stream_alive() now returns FALSE after timeout reached even if no RTP packet were received ever.
parent ea7528d4
...@@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
#define MIXER_MAX_CHANNELS 20 #define MIXER_MAX_CHANNELS 20
#define MAX_LATENCY 0.08
#define ALWAYS_STREAMOUT 1 #define ALWAYS_STREAMOUT 1
static void accumulate(int32_t *sum, int16_t* contrib, int nwords){ static void accumulate(int32_t *sum, int16_t* contrib, int nwords){
...@@ -217,7 +216,7 @@ static void mixer_process(MSFilter *f){ ...@@ -217,7 +216,7 @@ static void mixer_process(MSFilter *f){
if (channel_process_in(&s->channels[i],q,s->sum,nwords)) if (channel_process_in(&s->channels[i],q,s->sum,nwords))
got_something=TRUE; got_something=TRUE;
if ((skip=channel_flow_control(&s->channels[i],s->skip_threshold,f->ticker->time,do_purge))>0){ if ((skip=channel_flow_control(&s->channels[i],s->skip_threshold,f->ticker->time,do_purge))>0){
if (do_purge) ms_warning("Too much data in channel %i, %i ms skipped",i,(skip*1000)/(2*s->nchannels*s->rate)); ms_warning("Too much data in channel %i, %i ms in excess %s",i,(skip*1000)/(2*s->nchannels*s->rate),do_purge ? "were skipped.":".");
} }
} }
} }
......
...@@ -153,12 +153,10 @@ bool_t audio_stream_alive(AudioStream * stream, int timeout){ ...@@ -153,12 +153,10 @@ bool_t audio_stream_alive(AudioStream * stream, int timeout){
stream->last_packet_time=ms_time(NULL); stream->last_packet_time=ms_time(NULL);
} }
} }
if (stats->recv!=0){
if (ms_time(NULL)-stream->last_packet_time>timeout){ if (ms_time(NULL)-stream->last_packet_time>timeout){
/* more than timeout seconds of inactivity*/ /* more than timeout seconds of inactivity*/
return FALSE; return FALSE;
} }
}
return TRUE; return TRUE;
} }
...@@ -643,7 +641,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -643,7 +641,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
,stream->ms.rtprecv ,stream->ms.rtprecv
,NULL); ,NULL);
stream->ms.start_time=ms_time(NULL); stream->ms.start_time=stream->last_packet_time=ms_time(NULL);
stream->ms.is_beginning=TRUE; stream->ms.is_beginning=TRUE;
stream->ms.state=MSStreamStarted; stream->ms.state=MSStreamStarted;
......
...@@ -161,18 +161,14 @@ static void simple_analyser_suggest_action(MSQosAnalyser *objbase, MSRateControl ...@@ -161,18 +161,14 @@ static void simple_analyser_suggest_action(MSQosAnalyser *objbase, MSRateControl
MSSimpleQosAnalyser *obj=(MSSimpleQosAnalyser*)objbase; MSSimpleQosAnalyser *obj=(MSSimpleQosAnalyser*)objbase;
rtpstats_t *cur=&obj->stats[obj->curindex % STATS_HISTORY]; rtpstats_t *cur=&obj->stats[obj->curindex % STATS_HISTORY];
/*big losses and big jitter */ /*big losses and big jitter */
if (cur->lost_percentage>=unacceptable_loss_rate && cur->int_jitter>=big_jitter){ if (cur->lost_percentage>=unacceptable_loss_rate){
action->type=MSRateControlActionDecreaseBitrate; action->type=MSRateControlActionDecreaseBitrate;
action->value=MIN(cur->lost_percentage,50); action->value=MIN(cur->lost_percentage,50);
ms_message("MSQosAnalyser: loss rate unacceptable and big jitter"); ms_message("MSQosAnalyser: loss rate unacceptable");
}else if (rt_prop_increased(obj)){ }else if (rt_prop_increased(obj)){
action->type=MSRateControlActionDecreaseBitrate; action->type=MSRateControlActionDecreaseBitrate;
action->value=20; action->value=20;
ms_message("MSQosAnalyser: rt_prop doubled."); ms_message("MSQosAnalyser: rt_prop doubled.");
}else if (cur->lost_percentage>=unacceptable_loss_rate){
/*big loss rate but no jitter, and no big rtp_prop: pure lossy network*/
action->type=MSRateControlActionDecreasePacketRate;
ms_message("MSQosAnalyser: loss rate unacceptable.");
}else{ }else{
action->type=MSRateControlActionDoNothing; action->type=MSRateControlActionDoNothing;
ms_message("MSQosAnalyser: everything is fine."); ms_message("MSQosAnalyser: everything is fine.");
......
...@@ -117,9 +117,7 @@ void ring_stop(RingStream *stream){ ...@@ -117,9 +117,7 @@ void ring_stop(RingStream *stream){
ms_filter_destroy(stream->source); ms_filter_destroy(stream->source);
ms_filter_destroy(stream->gendtmf); ms_filter_destroy(stream->gendtmf);
ms_filter_destroy(stream->sndwrite); ms_filter_destroy(stream->sndwrite);
if (stream->write_resampler)
ms_filter_destroy(stream->write_resampler);
ms_free(stream); ms_free(stream);
#ifdef _WIN32_WCE
ms_warning("Sleeping a bit after closing the audio device...");
ms_sleep(1);
#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