Commit c3d6a095 authored by Simon Morlat's avatar Simon Morlat
Browse files

set priority to ringer thread too

do not adapt ticker with time difference less than its interval
parent 28f57ace
...@@ -882,6 +882,7 @@ RingStream * ring_start_with_cb(const char *file,int interval,MSSndCard *sndcard ...@@ -882,6 +882,7 @@ RingStream * ring_start_with_cb(const char *file,int interval,MSSndCard *sndcard
int tmp; int tmp;
int srcrate,dstrate; int srcrate,dstrate;
MSConnectionHelper h; MSConnectionHelper h;
MSTickerParams params={0};
stream=(RingStream *)ms_new0(RingStream,1); stream=(RingStream *)ms_new0(RingStream,1);
stream->source=ms_filter_new(MS_FILE_PLAYER_ID); stream->source=ms_filter_new(MS_FILE_PLAYER_ID);
...@@ -910,9 +911,9 @@ RingStream * ring_start_with_cb(const char *file,int interval,MSSndCard *sndcard ...@@ -910,9 +911,9 @@ RingStream * ring_start_with_cb(const char *file,int interval,MSSndCard *sndcard
ms_filter_call_method(stream->gendtmf,MS_FILTER_SET_NCHANNELS,&tmp); ms_filter_call_method(stream->gendtmf,MS_FILTER_SET_NCHANNELS,&tmp);
ms_filter_call_method(stream->sndwrite,MS_FILTER_SET_NCHANNELS,&tmp); ms_filter_call_method(stream->sndwrite,MS_FILTER_SET_NCHANNELS,&tmp);
stream->ticker=ms_ticker_new(); params.name="Ring MSTicker";
params.prio=MS_TICKER_PRIO_HIGH;
ms_ticker_set_name(stream->ticker,"Audio (ring) MSTicker"); stream->ticker=ms_ticker_new_with_params(&params);
ms_connection_helper_start(&h); ms_connection_helper_start(&h);
ms_connection_helper_link(&h,stream->source,-1,0); ms_connection_helper_link(&h,stream->source,-1,0);
......
...@@ -40,6 +40,8 @@ static const double smooth_coef=0.9; ...@@ -40,6 +40,8 @@ static const double smooth_coef=0.9;
#endif #endif
#define TICKER_INTERVAL 10
void * ms_ticker_run(void *s); void * ms_ticker_run(void *s);
static uint64_t get_cur_time_ms(void *); static uint64_t get_cur_time_ms(void *);
...@@ -54,7 +56,7 @@ static void ms_ticker_init(MSTicker *ticker, const MSTickerParams *params) ...@@ -54,7 +56,7 @@ static void ms_ticker_init(MSTicker *ticker, const MSTickerParams *params)
ticker->execution_list=NULL; ticker->execution_list=NULL;
ticker->ticks=1; ticker->ticks=1;
ticker->time=0; ticker->time=0;
ticker->interval=10; ticker->interval=TICKER_INTERVAL;
ticker->run=FALSE; ticker->run=FALSE;
ticker->exec_id=0; ticker->exec_id=0;
ticker->get_cur_time_ptr=&get_cur_time_ms; ticker->get_cur_time_ptr=&get_cur_time_ms;
...@@ -516,8 +518,12 @@ double ms_ticker_synchronizer_set_external_time(MSTickerSynchronizer* ts, const ...@@ -516,8 +518,12 @@ double ms_ticker_synchronizer_set_external_time(MSTickerSynchronizer* ts, const
return ts->av_skew; return ts->av_skew;
} }
uint64_t ms_ticker_synchronizer_get_corrected_time(MSTickerSynchronizer* ts) { uint64_t ms_ticker_synchronizer_get_corrected_time(MSTickerSynchronizer* ts) {
return get_wallclock_ms() - ts->av_skew; /* round skew to timer resolution in order to avoid adapt the ticker just with statistical "noise" */
int64_t rounded_skew=( ((int64_t)ts->av_skew)/(int64_t)TICKER_INTERVAL) * (int64_t)TICKER_INTERVAL;
return get_wallclock_ms() - rounded_skew;
} }
void ms_ticker_synchronizer_destroy(MSTickerSynchronizer* ts) { void ms_ticker_synchronizer_destroy(MSTickerSynchronizer* ts) {
......
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