summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-07-10 01:38:53 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-07-11 13:36:42 -0700
commite0e54b16485fa34d416c9a9aaaae2cfab1e1e887 (patch)
tree8d2852bcd5820f03c17e81afbc55d38c6e7183ed
parent5ee0aa1de9006fef2eea65b8f84d512c22775aec (diff)
capture_sound: simplify locking and buffer acquisition
More tidying of things
-rw-r--r--recordmydesktop/src/rmd_capture_sound.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/recordmydesktop/src/rmd_capture_sound.c b/recordmydesktop/src/rmd_capture_sound.c
index 2d02aee..63c46f3 100644
--- a/recordmydesktop/src/rmd_capture_sound.c
+++ b/recordmydesktop/src/rmd_capture_sound.c
@@ -144,22 +144,17 @@ void *rmdCaptureSound(ProgData *pdata) {
#endif
//queue the new buffer
pthread_mutex_lock(&pdata->sound_buffer_mutex);
- tmp=pdata->sound_buffer;
- if (pdata->sound_buffer==NULL)
- pdata->sound_buffer=newbuf;
+ tmp = pdata->sound_buffer;
+ if (!tmp)
+ pdata->sound_buffer = newbuf;
else {
- while (tmp->next!=NULL)
- tmp=tmp->next;
+ while (tmp->next != NULL)
+ tmp = tmp->next;
- tmp->next=newbuf;
+ tmp->next = newbuf;
}
- pthread_mutex_unlock(&pdata->sound_buffer_mutex);
-
-
- //signal that there are data to be proccessed
- pthread_mutex_lock(&pdata->snd_buff_ready_mutex);
pthread_cond_signal(&pdata->sound_data_read);
- pthread_mutex_unlock(&pdata->snd_buff_ready_mutex);
+ pthread_mutex_unlock(&pdata->sound_buffer_mutex);
}
#ifdef HAVE_LIBASOUND
snd_pcm_close(pdata->sound_handle);
© All Rights Reserved