From 2193d03eab38a26afcc527a549303bf4f1f3b257 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 21 Oct 2020 17:09:15 +0200 Subject: [PATCH] pulse-server: handle the case with record from monitor Also handle the case where the client asks to record from the monitor source directly. --- src/modules/module-protocol-pulse/pulse-server.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 788d7928b..c2851caa2 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -90,6 +90,8 @@ struct client { }; struct device { +#define DEVICE_FLAG_MONITOR (1<<0) + uint32_t flags; uint32_t index; char *name; enum pw_direction direction; @@ -1466,10 +1468,10 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint } else { dev = &impl->default_source; } - if (dev->direction == PW_DIRECTION_INPUT) { - pw_properties_set(props, PW_KEY_STREAM_CAPTURE_SINK, "true"); + if (dev->direction == PW_DIRECTION_INPUT) dev = dev->monitor; - } + if (SPA_FLAG_IS_SET(dev->flags, DEVICE_FLAG_MONITOR)) + pw_properties_set(props, PW_KEY_STREAM_CAPTURE_SINK, "true"); if (client->version >= 12) { if ((res = message_get(m, @@ -3156,6 +3158,7 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context, .monitor = &impl->default_monitor, }; impl->default_monitor = (struct device) { + .flags = DEVICE_FLAG_MONITOR, .index = 2, .name = "output.pipewire.monitor", .direction = PW_DIRECTION_OUTPUT,