diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-07-12 11:14:30 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-07-12 11:14:30 -0700 |
commit | 193a1e77bf798ef2ce2a1546d845f3bfe6ab3928 (patch) | |
tree | 5bc2701279b1fd3fdd4d3054270d7a003e23e708 /src/rmd_capture_sound.c | |
parent | 99bc91a3c939e07f2d754a67dce60a55d509b3c1 (diff) |
*: standardize sleeps on nanosleep()
usleep() is deprecated by posix in favor of nanosleep(), nanosleep
doesn't dick with signals so it's generally better anyways.
Diffstat (limited to 'src/rmd_capture_sound.c')
-rw-r--r-- | src/rmd_capture_sound.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rmd_capture_sound.c b/src/rmd_capture_sound.c index 2719c60..76ccd4b 100644 --- a/src/rmd_capture_sound.c +++ b/src/rmd_capture_sound.c @@ -38,6 +38,7 @@ #include <sys/uio.h> #include <unistd.h> #include <stdlib.h> +#include <time.h> void *rmdCaptureSound(ProgData *pdata) { @@ -46,7 +47,7 @@ void *rmdCaptureSound(ProgData *pdata) { int frames = pdata->periodsize; #endif //start capturing only after first frame is taken - usleep(pdata->frametime); + nanosleep(&(struct timespec){ .tv_nsec = pdata->frametime * 1000 }, NULL); while (pdata->running) { int sret = 0; |