PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
c94a3a9f by Igor V. Kovalenko at 2021-09-08T15:16:20+00:00
combine-sink: Add remix modarg

When module-combine-sink is used to create virtual surround card it is expected
that each slave channel receives data for exactly one combined sink channel.
Currently this is not the case because module-combine-sink would follow
core->disable_remixing setting. Usually this means that multiple channels of
combined sink are getting remixed into slave channel, and there is no option to
disable this behavior just for combined sink.

Improve this by implementing "remix" modarg for module-combine-sink,
default to original behavior (follow core->disable_remixing setting).

Part-of: 
<https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/627>

- - - - -


1 changed file:

- src/modules/module-combine-sink.c


Changes:

=====================================
src/modules/module-combine-sink.c
=====================================
@@ -59,7 +59,8 @@ PA_MODULE_USAGE(
         "format=<sample format> "
         "rate=<sample rate> "
         "channels=<number of channels> "
-        "channel_map=<channel map>");
+        "channel_map=<channel map>"
+        "remix=<boolean>");
 
 #define DEFAULT_SINK_NAME "combined"
 
@@ -79,6 +80,7 @@ static const char* const valid_modargs[] = {
     "rate",
     "channels",
     "channel_map",
+    "remix",
     NULL
 };
 
@@ -160,6 +162,8 @@ struct userdata {
 
     pa_idxset* outputs; /* managed in main context */
 
+    bool remix;
+
     struct {
         PA_LLIST_HEAD(struct output, active_outputs); /* managed in IO thread 
context */
         pa_atomic_t running;  /* we cache that value here, so that every 
thread can query it cheaply */
@@ -1135,6 +1139,9 @@ static int output_create_sink_input(struct output *o) {
     data.flags = 
PA_SINK_INPUT_VARIABLE_RATE|PA_SINK_INPUT_DONT_MOVE|PA_SINK_INPUT_NO_CREATE_ON_SUSPEND;
     data.origin_sink = u->sink;
 
+    if (!u->remix)
+        data.flags |= PA_SINK_INPUT_NO_REMIX;
+
     pa_sink_input_new(&o->sink_input, u->core, &data);
 
     pa_sink_input_new_data_done(&data);
@@ -1457,6 +1464,12 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
+    u->remix = !m->core->disable_remixing;
+    if (pa_modargs_get_value_boolean(ma, "remix", &u->remix) < 0) {
+        pa_log("Invalid boolean remix parameter");
+        goto fail;
+    }
+
     u->resample_method = resample_method;
     u->outputs = pa_idxset_new(NULL, NULL);
     u->thread_info.smoother = pa_smoother_new(



View it on GitLab: 
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/c94a3a9fb58f74e35016af3659f6c28f27fb2c9a

-- 
View it on GitLab: 
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/c94a3a9fb58f74e35016af3659f6c28f27fb2c9a
You're receiving this email because of your account on gitlab.freedesktop.org.


Reply via email to