mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-26 15:48:09 +00:00
fix race condition
git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@755 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
58eb7e94d6
commit
57d31914f7
2 changed files with 23 additions and 5 deletions
|
|
@ -901,7 +901,8 @@ static void winsndcard_unload(MSSndCardManager *m){
|
|||
|
||||
static void winsndcard_detect(MSSndCardManager *m){
|
||||
_winsndcard_detect(m);
|
||||
ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL);
|
||||
if (poller_thread==NULL)
|
||||
ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL);
|
||||
}
|
||||
|
||||
typedef struct WinSnd{
|
||||
|
|
@ -1105,6 +1106,12 @@ static void winsnd_read_preprocess(MSFilter *f){
|
|||
return ;
|
||||
}
|
||||
}
|
||||
#ifndef _TRUE_TIME
|
||||
ms_mutex_lock(&f->ticker->lock);
|
||||
ms_ticker_set_time_func(f->ticker,winsnd_get_cur_time,d);
|
||||
ms_mutex_unlock(&f->ticker->lock);
|
||||
#endif
|
||||
|
||||
bsize=WINSND_NSAMPLES*d->wfx.nAvgBytesPerSec/8000;
|
||||
ms_debug("Using input buffers of %i bytes",bsize);
|
||||
for(i=0;i<WINSND_NBUFS;++i){
|
||||
|
|
@ -1115,11 +1122,13 @@ static void winsnd_read_preprocess(MSFilter *f){
|
|||
mr=waveInStart(d->indev);
|
||||
if (mr != MMSYSERR_NOERROR){
|
||||
ms_error("waveInStart() error");
|
||||
#ifndef _TRUE_TIME
|
||||
ms_mutex_lock(&f->ticker->lock);
|
||||
ms_ticker_set_time_func(f->ticker,NULL,NULL);
|
||||
ms_mutex_unlock(&f->ticker->lock);
|
||||
#endif
|
||||
return ;
|
||||
}
|
||||
#ifndef _TRUE_TIME
|
||||
ms_ticker_set_time_func(f->ticker,winsnd_get_cur_time,d);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void winsnd_read_postprocess(MSFilter *f){
|
||||
|
|
@ -1127,7 +1136,9 @@ static void winsnd_read_postprocess(MSFilter *f){
|
|||
MMRESULT mr;
|
||||
int i;
|
||||
#ifndef _TRUE_TIME
|
||||
ms_mutex_lock(&f->ticker->lock);
|
||||
ms_ticker_set_time_func(f->ticker,NULL,NULL);
|
||||
ms_mutex_unlock(&f->ticker->lock);
|
||||
#endif
|
||||
d->running=FALSE;
|
||||
mr=waveInStop(d->indev);
|
||||
|
|
|
|||
|
|
@ -1147,7 +1147,8 @@ static void winsnddscard_unload(MSSndCardManager *m){
|
|||
|
||||
static void winsnddscard_detect(MSSndCardManager *m){
|
||||
_winsnddscard_detect(m);
|
||||
ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL);
|
||||
if (poller_thread==NULL)
|
||||
ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL);
|
||||
}
|
||||
|
||||
typedef struct WinSndDs{
|
||||
|
|
@ -1350,7 +1351,9 @@ static void winsndds_read_preprocess(MSFilter *f){
|
|||
|
||||
hr = IDirectSoundCaptureBuffer_Start( d->lpDirectSoundInputBuffer, DSCBSTART_LOOPING );
|
||||
|
||||
ms_mutex_lock(&f->ticker->lock);
|
||||
ms_ticker_set_time_func(f->ticker,winsndds_get_cur_time,d);
|
||||
ms_mutex_unlock(&f->ticker->lock);
|
||||
|
||||
d->thread_running=TRUE;
|
||||
ms_thread_create(&d->thread,NULL,winsndds_read_thread,d);
|
||||
|
|
@ -1370,7 +1373,9 @@ static void winsndds_read_postprocess(MSFilter *f){
|
|||
ms_mutex_unlock(&d->thread_lock);
|
||||
ms_thread_join(d->thread,NULL);
|
||||
|
||||
ms_mutex_lock(&f->ticker->lock);
|
||||
ms_ticker_set_time_func(f->ticker,NULL,NULL);
|
||||
ms_mutex_unlock(&f->ticker->lock);
|
||||
|
||||
if( d->lpDirectSoundInputBuffer )
|
||||
{
|
||||
|
|
@ -1519,7 +1524,9 @@ static void winsndds_write_preprocess(MSFilter *f){
|
|||
|
||||
hr = IDirectSoundCaptureBuffer_Start( d_capture_filter->lpDirectSoundInputBuffer, DSCBSTART_LOOPING );
|
||||
|
||||
ms_mutex_lock(&f->ticker->lock);
|
||||
ms_ticker_set_time_func(f_capture_filter->ticker,winsndds_get_cur_time,d_capture_filter);
|
||||
ms_mutex_unlock(&f->ticker->lock);
|
||||
|
||||
d_capture_filter->thread_running=TRUE;
|
||||
ms_thread_create(&d_capture_filter->thread,NULL,winsndds_read_thread,d_capture_filter);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue