mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
ratelimit: allow non-static ratelimit structs
This commit is contained in:
parent
7cc100d9e1
commit
12df6860ad
1 changed files with 14 additions and 4 deletions
|
|
@ -26,21 +26,31 @@
|
||||||
#include <pulsecore/macro.h>
|
#include <pulsecore/macro.h>
|
||||||
|
|
||||||
typedef struct pa_ratelimit {
|
typedef struct pa_ratelimit {
|
||||||
const pa_usec_t interval;
|
pa_usec_t interval;
|
||||||
const unsigned burst;
|
unsigned burst;
|
||||||
unsigned n_printed, n_missed;
|
unsigned n_printed, n_missed;
|
||||||
pa_usec_t begin;
|
pa_usec_t begin;
|
||||||
} pa_ratelimit;
|
} pa_ratelimit;
|
||||||
|
|
||||||
#define PA_DEFINE_RATELIMIT(_name, _interval, _burst) \
|
#define PA_DEFINE_RATELIMIT(_name, _interval, _burst) \
|
||||||
pa_ratelimit _name = { \
|
pa_ratelimit _name = { \
|
||||||
.interval = _interval, \
|
.interval = (_interval), \
|
||||||
.burst = _burst, \
|
.burst = (_burst), \
|
||||||
.n_printed = 0, \
|
.n_printed = 0, \
|
||||||
.n_missed = 0, \
|
.n_missed = 0, \
|
||||||
.begin = 0 \
|
.begin = 0 \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define PA_INIT_RATELIMIT(v, _interval, _burst) \
|
||||||
|
do { \
|
||||||
|
pa_ratelimit *r = &(v); \
|
||||||
|
r->interval = (_interval); \
|
||||||
|
r->burst = (_burst); \
|
||||||
|
r->n_printed = 0; \
|
||||||
|
r->n_missed = 0; \
|
||||||
|
r->begin = 0; \
|
||||||
|
} while (FALSE);
|
||||||
|
|
||||||
pa_bool_t pa_ratelimit_test(pa_ratelimit *r);
|
pa_bool_t pa_ratelimit_test(pa_ratelimit *r);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue