mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-01 22:58:47 -04:00
add lower boundary for artifical latencies
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2276 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
af256978de
commit
03df08872d
1 changed files with 17 additions and 5 deletions
|
|
@ -39,7 +39,7 @@
|
|||
#include <pulsecore/log.h>
|
||||
#include <pulsecore/macro.h>
|
||||
|
||||
static int msec;
|
||||
static int msec_lower, msec_upper;
|
||||
|
||||
static void* work(void *p) PA_GCC_NORETURN;
|
||||
|
||||
|
|
@ -66,7 +66,9 @@ static void* work(void *p) {
|
|||
|
||||
pa_assert_se(clock_gettime(CLOCK_REALTIME, &end) == 0);
|
||||
|
||||
nsec = (uint64_t) ((((double) rand())*msec*PA_NSEC_PER_MSEC)/RAND_MAX);
|
||||
nsec =
|
||||
(uint64_t) ((((double) rand())*(msec_upper-msec_lower)*PA_NSEC_PER_MSEC)/RAND_MAX) +
|
||||
(uint64_t) (msec_lower*PA_NSEC_PER_MSEC);
|
||||
|
||||
pa_log_notice("CPU%i: Freezing for %ims", PA_PTR_TO_INT(p), (int) (nsec/PA_NSEC_PER_MSEC));
|
||||
|
||||
|
|
@ -90,11 +92,21 @@ int main(int argc, char*argv[]) {
|
|||
|
||||
srand(time(NULL));
|
||||
|
||||
msec = argc > 1 ? atoi(argv[1]) : 1000;
|
||||
if (argc >= 3) {
|
||||
msec_lower = atoi(argv[1]);
|
||||
msec_upper = atoi(argv[2]);
|
||||
} else if (argc >= 2) {
|
||||
msec_lower = 0;
|
||||
msec_upper = atoi(argv[1]);
|
||||
} else {
|
||||
msec_lower = 0;
|
||||
msec_upper = 1000;
|
||||
}
|
||||
|
||||
pa_assert(msec > 0);
|
||||
pa_assert(msec_upper > 0);
|
||||
pa_assert(msec_upper >= msec_lower);
|
||||
|
||||
pa_log_notice("Creating random latencies of up to %ims.", msec);
|
||||
pa_log_notice("Creating random latencies in the range of %ims to %ims.", msec_lower, msec_upper);
|
||||
|
||||
for (n = 1; n < sysconf(_SC_NPROCESSORS_CONF); n++) {
|
||||
pthread_t t;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue