From d6c15cfbd2e69ceaa21f1bb5c4628538462f7ede Mon Sep 17 00:00:00 2001 From: aymeric <aymeric@3f6dc0c8-ddfe-455d-9043-3cd528dc4637> Date: Thu, 20 Aug 2009 13:16:50 +0000 Subject: [PATCH] fix when several sound cards are reloaded by mediastreamer2. git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@586 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/mediastreamer2/src/winsnd2.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/linphone/mediastreamer2/src/winsnd2.c b/linphone/mediastreamer2/src/winsnd2.c index 3377369ef5..5f77c9444f 100755 --- a/linphone/mediastreamer2/src/winsnd2.c +++ b/linphone/mediastreamer2/src/winsnd2.c @@ -801,9 +801,9 @@ static bool_t poller_running=TRUE; static void * new_device_polling_thread(void *ignore){ MSSndCardManager *m; - /*check for new devices every 2 seconds*/ + /*check for new devices every 5 seconds*/ while(poller_running){ - ms_sleep(2); + ms_sleep(5); if (poller_running){ m=ms_snd_card_manager_get(); if(!m) break; @@ -818,12 +818,18 @@ static void * new_device_polling_thread(void *ignore){ static void stop_poller(){ poller_running=FALSE; ms_thread_join(poller_thread,NULL); + poller_thread=NULL; } static void winsndcard_detect(MSSndCardManager *m){ + static int doitonce = 0; _winsndcard_detect(m); - ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL); - atexit(&stop_poller); + if (doitonce==0) + { + doitonce++; + ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL); + atexit(&stop_poller); + } } typedef struct WinSnd{ -- GitLab