Changeset 767:de19eb8842c4 in mediastreamer2


Ignore:
Timestamp:
Nov 9, 2009 8:39:26 PM (4 years ago)
Author:
aymeric <aymeric@…>
Branch:
default
Message:

fix race condition

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@755 3f6dc0c8-ddfe-455d-9043-3cd528dc4637

Location:
linphone/mediastreamer2/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • linphone/mediastreamer2/src/winsnd2.c

    r606 r767  
    902902static void winsndcard_detect(MSSndCardManager *m){ 
    903903        _winsndcard_detect(m); 
    904         ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL); 
     904        if (poller_thread==NULL) 
     905                ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL); 
    905906} 
    906907 
     
    11061107                } 
    11071108        } 
     1109#ifndef _TRUE_TIME 
     1110        ms_mutex_lock(&f->ticker->lock); 
     1111        ms_ticker_set_time_func(f->ticker,winsnd_get_cur_time,d); 
     1112        ms_mutex_unlock(&f->ticker->lock); 
     1113#endif 
     1114 
    11081115        bsize=WINSND_NSAMPLES*d->wfx.nAvgBytesPerSec/8000; 
    11091116        ms_debug("Using input buffers of %i bytes",bsize); 
     
    11161123        if (mr != MMSYSERR_NOERROR){ 
    11171124                ms_error("waveInStart() error"); 
     1125#ifndef _TRUE_TIME 
     1126                ms_mutex_lock(&f->ticker->lock); 
     1127                ms_ticker_set_time_func(f->ticker,NULL,NULL); 
     1128                ms_mutex_unlock(&f->ticker->lock); 
     1129#endif 
    11181130                return ; 
    11191131        } 
    1120 #ifndef _TRUE_TIME 
    1121         ms_ticker_set_time_func(f->ticker,winsnd_get_cur_time,d); 
    1122 #endif 
    11231132} 
    11241133 
     
    11281137        int i; 
    11291138#ifndef _TRUE_TIME 
     1139        ms_mutex_lock(&f->ticker->lock); 
    11301140        ms_ticker_set_time_func(f->ticker,NULL,NULL); 
     1141        ms_mutex_unlock(&f->ticker->lock); 
    11311142#endif 
    11321143        d->running=FALSE; 
  • linphone/mediastreamer2/src/winsndds.cpp

    r607 r767  
    11481148static void winsnddscard_detect(MSSndCardManager *m){ 
    11491149        _winsnddscard_detect(m); 
    1150         ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL); 
     1150        if (poller_thread==NULL) 
     1151                ms_thread_create(&poller_thread,NULL,new_device_polling_thread,NULL); 
    11511152} 
    11521153 
     
    13511352        hr = IDirectSoundCaptureBuffer_Start( d->lpDirectSoundInputBuffer, DSCBSTART_LOOPING ); 
    13521353 
     1354        ms_mutex_lock(&f->ticker->lock); 
    13531355        ms_ticker_set_time_func(f->ticker,winsndds_get_cur_time,d); 
     1356        ms_mutex_unlock(&f->ticker->lock); 
    13541357 
    13551358        d->thread_running=TRUE; 
     
    13711374        ms_thread_join(d->thread,NULL); 
    13721375 
     1376        ms_mutex_lock(&f->ticker->lock); 
    13731377        ms_ticker_set_time_func(f->ticker,NULL,NULL); 
     1378        ms_mutex_unlock(&f->ticker->lock); 
    13741379 
    13751380        if( d->lpDirectSoundInputBuffer ) 
     
    15201525                hr = IDirectSoundCaptureBuffer_Start( d_capture_filter->lpDirectSoundInputBuffer, DSCBSTART_LOOPING ); 
    15211526 
     1527                ms_mutex_lock(&f->ticker->lock); 
    15221528                ms_ticker_set_time_func(f_capture_filter->ticker,winsndds_get_cur_time,d_capture_filter); 
     1529                ms_mutex_unlock(&f->ticker->lock); 
    15231530 
    15241531                d_capture_filter->thread_running=TRUE; 
Note: See TracChangeset for help on using the changeset viewer.