summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <arun@arunraghavan.net>2018-05-04 21:59:23 +0530
committerArun Raghavan <arun@arunraghavan.net>2018-05-06 08:03:19 +0530
commitde38a209f41dd2668ff6a72c047caadacc0a71a5 (patch)
tree0614df95e71e5ea0c45a7398a3d61411e40aee96
parentb38535636e4e4fc3b2981fe9a8dffede5a8889b1 (diff)
downloadpulseaudio-de38a209f41dd2668ff6a72c047caadacc0a71a5.tar.gz
module-allow-passthrough: Don't crash if we can't find a sink
module-allow-passthrough has a (necessary) hack to replicate the default sink selection and format negotiation from sink-input.c. One thing that got missed in this replication is the possibility that the sink input is not compatible with the default sink. When this happen, we now exit gracefully. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=105578
-rw-r--r--src/modules/module-allow-passthrough.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/modules/module-allow-passthrough.c b/src/modules/module-allow-passthrough.c
index 16b421d79..f7c61559b 100644
--- a/src/modules/module-allow-passthrough.c
+++ b/src/modules/module-allow-passthrough.c
@@ -184,6 +184,12 @@ static pa_hook_result_t sink_input_new_cb(pa_core *core, pa_sink_input_new_data
if (!new_data->format && new_data->nego_formats && !pa_idxset_isempty(new_data->nego_formats))
new_data->format = pa_format_info_copy(pa_idxset_first(new_data->nego_formats, NULL));
+ if (!new_data->format) {
+ /* Sink doesn't support any requested format */
+ pa_log_debug("Default sink does not match sink input requested formats");
+ return PA_HOOK_OK;
+ }
+
if (pa_sink_input_new_data_is_passthrough(new_data))
return new_passthrough_stream(u, core, new_data->sink, NULL);