From efaabd37eab44ac9f056811296552f469bb9fe74 Mon Sep 17 00:00:00 2001 From: iovar Date: Fri, 15 Dec 2006 19:24:18 +0000 Subject: made sure that sound capture will wait for the first time expiration,before it starts(wait on cond_var before loop). git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@238 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/capture_sound.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'recordmydesktop') diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c index ef65bbc..5ba27f7 100644 --- a/recordmydesktop/src/capture_sound.c +++ b/recordmydesktop/src/capture_sound.c @@ -31,9 +31,13 @@ void *CaptureSound(ProgData *pdata){ int frames=pdata->periodsize; int framesize=((snd_pcm_format_width(SND_PCM_FORMAT_S16_LE))/8)*pdata->args.channels; - pthread_mutex_t pmut; + pthread_mutex_t pmut,tmut; pthread_mutex_init(&pmut,NULL); + pthread_mutex_init(&tmut,NULL); + //start capturing only when everything else is finsihed + //ideally, at the same time that the first frame is captured + pthread_cond_wait(&pdata->time_cond,&tmut); while(pdata->running){ int sret=0; SndBuffer *newbuf,*tmp; -- cgit v1.2.1