modules: add reconnect support to module-pulse-tunnel

When the pulse connection is broken, reconnect with the given interval.

Add the reconnect_interval_ms property to the pulse modules.
This commit is contained in:
Wim Taymans 2024-01-05 13:34:19 +01:00
parent b4be094be8
commit 3da66734bd
3 changed files with 106 additions and 40 deletions

View file

@ -32,6 +32,7 @@ static const char *const pulse_module_options =
"sink=<name of the remote sink> "
"sink_name=<name for the local sink> "
"sink_properties=<properties for the local sink> "
"reconnect_interval_ms=<interval to try reconnects, 0 or omitted if disabled> "
"format=<sample format> "
"channels=<number of channels> "
"rate=<sample rate> "
@ -181,6 +182,10 @@ static int module_tunnel_sink_prepare(struct module * const module)
}
audioinfo_to_properties(&info, stream_props);
if ((str = pw_properties_get(props, "reconnect_interval_ms")) != NULL) {
pw_properties_set(props, "reconnect.interval.ms", str);
pw_properties_set(props, "reconnect_interval_ms", NULL);
}
if ((str = pw_properties_get(props, "latency_msec")) != NULL) {
pw_properties_set(props, "pulse.latency", str);
pw_properties_set(props, "latency_msec", NULL);

View file

@ -32,6 +32,7 @@ static const char *const pulse_module_options =
"source=<name of the remote source> "
"source_name=<name for the local source> "
"source_properties=<properties for the local source> "
"reconnect_interval_ms=<interval to try reconnects, 0 or omitted if disabled> "
"format=<sample format> "
"channels=<number of channels> "
"rate=<sample rate> "
@ -178,6 +179,10 @@ static int module_tunnel_source_prepare(struct module * const module)
}
audioinfo_to_properties(&info, stream_props);
if ((str = pw_properties_get(props, "reconnect_interval_ms")) != NULL) {
pw_properties_set(props, "reconnect.interval.ms", str);
pw_properties_set(props, "reconnect_interval_ms", NULL);
}
if ((str = pw_properties_get(props, "latency_msec")) != NULL) {
pw_properties_set(props, "pulse.latency", str);
pw_properties_set(props, "latency_msec", NULL);