summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2020-07-30 18:23:23 +0200
committerWim Taymans <wtaymans@redhat.com>2020-07-30 18:23:23 +0200
commita5f85deabe96bd3cbb578b5a4accd56e129e7fe0 (patch)
tree7f08cd21b5f003e6ad201324f8c82141c07548ef
parentdf76501d39e1ac019e7b5efb08bc9a11d7e438d7 (diff)
pulse: also use PIPEWIRE_LATENCY as a fallback
-rw-r--r--pipewire-pulseaudio/src/stream.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/pipewire-pulseaudio/src/stream.c b/pipewire-pulseaudio/src/stream.c
index 62fa1679..fa334186 100644
--- a/pipewire-pulseaudio/src/stream.c
+++ b/pipewire-pulseaudio/src/stream.c
@@ -177,12 +177,25 @@ static const struct spa_pod *get_buffers_param(pa_stream *s, pa_buffer_attr *att
}
static void patch_buffer_attr(pa_stream *s, pa_buffer_attr *attr, pa_stream_flags_t *flags) {
- const char *e;
+ const char *e, *str;
+ char buf[100];
pa_assert(s);
pa_assert(attr);
- if ((e = getenv("PULSE_LATENCY_MSEC"))) {
+ e = getenv("PULSE_LATENCY_MSEC");
+ if (e == NULL) {
+ str = getenv("PIPEWIRE_LATENCY");
+ if (str) {
+ int num, denom;
+ if (sscanf(str, "%u/%u", &num, &denom) == 2 && denom != 0) {
+ snprintf(buf, sizeof(buf)-1, "%lu", num * PA_MSEC_PER_SEC / denom);
+ e = buf;
+ }
+ }
+ }
+
+ if (e) {
uint32_t ms;
pa_sample_spec ss;