From 05eff701a8a4766a21043aee36b89f323693cc60 Mon Sep 17 00:00:00 2001 From: smorlat <smorlat@3f6dc0c8-ddfe-455d-9043-3cd528dc4637> Date: Tue, 5 Jan 2010 15:39:04 +0000 Subject: [PATCH] implement msticker prio for non windows OS git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@805 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/mediastreamer2/src/msticker.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/linphone/mediastreamer2/src/msticker.c b/linphone/mediastreamer2/src/msticker.c index 9eaa254317..3c4ced2cd7 100644 --- a/linphone/mediastreamer2/src/msticker.c +++ b/linphone/mediastreamer2/src/msticker.c @@ -265,6 +265,8 @@ static void sleepMs(int ms){ static int set_high_prio(void){ int precision=2; + int result=0; + struct sched_param param; #ifdef WIN32 MMRESULT mm; TIMECAPS ptc; @@ -286,6 +288,19 @@ static int set_high_prio(void){ if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST)){ ms_warning("SetThreadPriority() failed (%d)\n", GetLastError()); } +#else + memset(¶m,0,sizeof(param)); +#ifdef TARGET_OS_MAC + int policy=SCHED_RR; +#else + int policy=SCHED_OTHER; +#endif + param.sched_priority=sched_get_priority_max(policy); + if(result=pthread_setschedparam(pthread_self(),policy, ¶m)) { + ms_warning("Set sched param failed with error code(%i)\n",result); + } else { + ms_message("MS ticker priority set to max"); + } #endif return precision; } -- GitLab