From 9e9c78222b85fbac28897054b8f38fadc8168917 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Sat, 16 Nov 2024 10:09:27 +0100 Subject: [PATCH] pulse: use default string as default device (#3206) Most audio drivers use "default" string --- modules/pulse/pastream.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/pulse/pastream.c b/modules/pulse/pastream.c index 7e782e36b..3642e9aaf 100644 --- a/modules/pulse/pastream.c +++ b/modules/pulse/pastream.c @@ -170,10 +170,14 @@ int pastream_start(struct pastream_st* st, void *arg) stream_overflow_cb, st); pa_stream_set_state_callback(st->stream, stream_state_cb, st); + const char *device = NULL; + if (str_len(st->device) && str_casecmp(st->device, "default") != 0) { + device = st->device; + } + if (st->direction == PA_STREAM_PLAYBACK) { pa_err = pa_stream_connect_playback(st->stream, - strlen(st->device) == 0 ? NULL : - st->device, &st->attr, + device, &st->attr, PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE, @@ -181,8 +185,7 @@ int pastream_start(struct pastream_st* st, void *arg) } else if (st->direction == PA_STREAM_RECORD) { pa_err = pa_stream_connect_record(st->stream, - strlen(st->device) == 0 ? NULL : - st->device, &st->attr, + device, &st->attr, PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE);