[pulseaudio-commits] 3 commits - src/modules
src/modules/alsa/alsa-sink.c | 12 +--- src/modules/alsa/alsa-source.c | 12 +--- src/modules/module-null-sink.c |4 ++-- src/modules/module-pipe-sink.c |6 +++--- src/modules/module-solaris.c | 18 +++--- src/modules/oss/module-oss.c | 16 +--- 6 files changed, 27 insertions(+), 41 deletions(-) New commits: commit 7f09164ed7979210adcdb7674b9d6217fd44ed66 Author: Tanu Kaskinen Date: Wed Feb 21 11:54:41 2018 +0200 null-sink, pipe-sink: some state variable cleanups pa_sink_get_state() is supposed to be used from the main thread. In this case it doesn't really matter, because the SET_STATE handler is executed while the main thread is waiting, but since the state is available also in thread_info, let's use that. All other modules use thread_info.state too, so at least this change improves consistency. Also, we can use the PA_SINK_IS_OPENED macro to simplify the code a bit. diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c index 25b0f309..3ace082d 100644 --- a/src/modules/module-null-sink.c +++ b/src/modules/module-null-sink.c @@ -91,8 +91,8 @@ static int sink_process_msg( switch (code) { case PA_SINK_MESSAGE_SET_STATE: -if (pa_sink_get_state(u->sink) == PA_SINK_SUSPENDED || pa_sink_get_state(u->sink) == PA_SINK_INIT) { -if (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING || PA_PTR_TO_UINT(data) == PA_SINK_IDLE) +if (u->sink->thread_info.state == PA_SINK_SUSPENDED || u->sink->thread_info.state == PA_SINK_INIT) { +if (PA_SINK_IS_OPENED(PA_PTR_TO_UINT(data))) u->timestamp = pa_rtclock_now(); } diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c index a2074c1f..995785e1 100644 --- a/src/modules/module-pipe-sink.c +++ b/src/modules/module-pipe-sink.c @@ -111,10 +111,10 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse switch (code) { case PA_SINK_MESSAGE_SET_STATE: -if (pa_sink_get_state(u->sink) == PA_SINK_SUSPENDED || pa_sink_get_state(u->sink) == PA_SINK_INIT) { -if (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING || PA_PTR_TO_UINT(data) == PA_SINK_IDLE) +if (u->sink->thread_info.state == PA_SINK_SUSPENDED || u->sink->thread_info.state == PA_SINK_INIT) { +if (PA_SINK_IS_OPENED(PA_PTR_TO_UINT(data))) u->timestamp = pa_rtclock_now(); -} else if (pa_sink_get_state(u->sink) == PA_SINK_RUNNING || pa_sink_get_state(u->sink) == PA_SINK_IDLE) { +} else if (u->sink->thread_info.state == PA_SINK_RUNNING || u->sink->thread_info.state == PA_SINK_IDLE) { if (PA_PTR_TO_UINT(data) == PA_SINK_SUSPENDED) { /* Clear potential FIFO error flag */ u->fifo_error = false; commit 2dff0d6a6a4df2aab6f36212b705489d5af42835 Author: Tanu Kaskinen Date: Mon Feb 19 16:48:21 2018 +0200 alsa: add a couple of FIXME comments build_pollfd() isn't likely to fail, but if it does, pa_sink/source_put() will crash on an assertion failure. I haven't seen such crash happening, this is just something that I noticed while studying the state change code. diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index fe0a21a5..309d726e 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1203,6 +1203,9 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse if (u->sink->thread_info.state == PA_SINK_INIT) { if (build_pollfd(u) < 0) +/* FIXME: This will cause an assertion failure in + * pa_sink_put(), because with the current design + * pa_sink_put() is not allowed to fail. */ return -PA_ERR_IO; } diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index b11a03f8..adaa42cb 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -1058,6 +1058,9 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off if (u->source->thread_info.state == PA_SOURCE_INIT) { if (build_pollfd(u) < 0) +/* FIXME: This will cause an assertion failure in + * pa_source_put(), because with the current design + * pa_source_put() is not allowed to fail. */ return -PA_ERR_IO; } commit 7f201b1fd419b91a226d23ee1e216661ae082dcf Author: Tanu Kaskinen Date: Mon Feb 19 16:48:19 2018 +0200 alsa, solaris, oss: remove unnecessary error handling when suspending Suspending never fai
[pulseaudio-commits] 3 commits - src/modules
src/modules/alsa/alsa-mixer.c | 107 +++-- src/modules/alsa/alsa-mixer.h |9 + src/modules/alsa/alsa-sink.c |2 src/modules/alsa/alsa-source.c |2 src/modules/alsa/mixer/paths/analog-output.conf.common | 12 + src/modules/alsa/mixer/paths/hdmi-output-0.conf|5 src/modules/alsa/mixer/paths/hdmi-output-1.conf|5 src/modules/alsa/mixer/paths/hdmi-output-2.conf|5 src/modules/alsa/mixer/paths/hdmi-output-3.conf|5 src/modules/alsa/mixer/paths/hdmi-output-4.conf|5 src/modules/alsa/mixer/paths/hdmi-output-5.conf|5 src/modules/alsa/mixer/paths/hdmi-output-6.conf|5 src/modules/alsa/mixer/paths/hdmi-output-7.conf|5 13 files changed, 144 insertions(+), 28 deletions(-) New commits: commit 72fa468a45031ba4be4d24d70fddf282b5c9da66 Author: Tanu Kaskinen Date: Sun Oct 8 19:48:26 2017 +0300 alsa-mixer: autodetect the ELD device This removes the need to hardcode the ELD device index in the path configuration. The hardcoded values don't work with the Intel HDMI LPE driver. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100488 diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index eaee7ea0..a524d6d6 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -2051,6 +2051,28 @@ static int element_parse_enumeration(pa_config_parser_state *state) { return 0; } +static int parse_eld_device(pa_config_parser_state *state) { +pa_alsa_path *path; +uint32_t eld_device; + +path = state->userdata; + +if (pa_atou(state->rvalue, &eld_device) >= 0) { +path->autodetect_eld_device = false; +path->eld_device = eld_device; +return 0; +} + +if (pa_streq(state->rvalue, "auto")) { +path->autodetect_eld_device = true; +path->eld_device = -1; +return 0; +} + +pa_log("[%s:%u] Invalid value for option 'eld-device': %s", state->filename, state->lineno, state->rvalue); +return -1; +} + static int option_parse_priority(pa_config_parser_state *state) { pa_alsa_path *p; pa_alsa_option *o; @@ -2568,7 +2590,7 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa { "description-key", pa_config_parse_string,NULL, "General" }, { "description", pa_config_parse_string,NULL, "General" }, { "mute-during-activation", pa_config_parse_bool, NULL, "General" }, -{ "eld-device", pa_config_parse_int, NULL, "General" }, +{ "eld-device", parse_eld_device, NULL, "General" }, /* [Option ...] */ { "priority",option_parse_priority, NULL, NULL }, @@ -2608,7 +2630,6 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa items[1].data = &p->description_key; items[2].data = &p->description; items[3].data = &mute_during_activation; -items[4].data = &p->eld_device; if (!paths_dir) paths_dir = get_default_paths_dir(); @@ -4012,6 +4033,9 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, } PA_HASHMAP_FOREACH(p, ps->paths, state) { +if (p->autodetect_eld_device) +p->eld_device = m->hw_device_index; + if (pa_alsa_path_probe(p, m, mixer_handle, m->profile_set->ignore_dB) < 0) pa_hashmap_remove(ps->paths, p); } diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h index c64f42b7..3ea4d732 100644 --- a/src/modules/alsa/alsa-mixer.h +++ b/src/modules/alsa/alsa-mixer.h @@ -193,6 +193,7 @@ struct pa_alsa_path { char *description_key; char *description; unsigned priority; +bool autodetect_eld_device; int eld_device; pa_proplist *proplist; diff --git a/src/modules/alsa/mixer/paths/analog-output.conf.common b/src/modules/alsa/mixer/paths/analog-output.conf.common index baf37660..e52830d9 100644 --- a/src/modules/alsa/mixer/paths/analog-output.conf.common +++ b/src/modules/alsa/mixer/paths/analog-output.conf.common @@ -64,8 +64,12 @@ ; mute-during-activation = yes | no # If this path supports hardware mute, should the hw mute be used while activating this ;# path? In some cases this can reduce extra noises during port switching, while in other ;# cases this can increase such noises. Default: no. -; eld-device = ... # If this is an HDMI port, here's where to specify the device number for the ELD mixer -;# control. The default is to not make use of ELD information. +; eld-device = ...
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/alsa/alsa-mixer.h |1 src/modules/alsa/alsa-sink.c| 22 ++ src/modules/alsa/module-alsa-card.c | 34 ++ src/pulsecore/cli-text.c| 54 +--- src/pulsecore/core.c| 41 +++ src/pulsecore/core.h| 13 src/pulsecore/sink.c| 27 -- src/pulsecore/sink.h|2 + src/pulsecore/source.c | 27 -- src/pulsecore/source.h |2 + 10 files changed, 172 insertions(+), 51 deletions(-) New commits: commit f17644318194f213e30bc396e041680154b217d4 Author: Tanu Kaskinen Date: Thu Dec 28 12:09:19 2017 +0200 sink, source: improve suspend cause logging Previously the suspend cause was logged as a hexadecimal number, now it's logged as a human-friendly string. Also, the command line interface handled only a subset of causes when printing them, now all suspend causes are printed. diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c index 794f51c1..474f3367 100644 --- a/src/pulsecore/cli-text.c +++ b/src/pulsecore/cli-text.c @@ -212,6 +212,7 @@ char *pa_sink_list_to_string(pa_core *c) { v[PA_VOLUME_SNPRINT_VERBOSE_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t; const char *cmn; +char suspend_cause_buf[PA_SUSPEND_CAUSE_TO_STRING_BUF_SIZE]; cmn = pa_channel_map_to_pretty_name(&sink->channel_map); @@ -222,7 +223,7 @@ char *pa_sink_list_to_string(pa_core *c) { "\tdriver: <%s>\n" "\tflags: %s%s%s%s%s%s%s%s\n" "\tstate: %s\n" -"\tsuspend cause: %s%s%s%s\n" +"\tsuspend cause: %s\n" "\tpriority: %u\n" "\tvolume: %s\n" "\tbalance %0.2f\n" @@ -250,10 +251,7 @@ char *pa_sink_list_to_string(pa_core *c) { sink->flags & PA_SINK_FLAT_VOLUME ? "FLAT_VOLUME " : "", sink->flags & PA_SINK_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "", pa_sink_state_to_string(pa_sink_get_state(sink)), -sink->suspend_cause & PA_SUSPEND_USER ? "USER " : "", -sink->suspend_cause & PA_SUSPEND_APPLICATION ? "APPLICATION " : "", -sink->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "", -sink->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "", +pa_suspend_cause_to_string(sink->suspend_cause, suspend_cause_buf), sink->priority, pa_cvolume_snprint_verbose(cv, sizeof(cv), @@ -328,6 +326,7 @@ char *pa_source_list_to_string(pa_core *c) { v[PA_VOLUME_SNPRINT_VERBOSE_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t; const char *cmn; +char suspend_cause_buf[PA_SUSPEND_CAUSE_TO_STRING_BUF_SIZE]; cmn = pa_channel_map_to_pretty_name(&source->channel_map); @@ -338,7 +337,7 @@ char *pa_source_list_to_string(pa_core *c) { "\tdriver: <%s>\n" "\tflags: %s%s%s%s%s%s%s\n" "\tstate: %s\n" -"\tsuspend cause: %s%s%s%s\n" +"\tsuspend cause: %s\n" "\tpriority: %u\n" "\tvolume: %s\n" "\tbalance %0.2f\n" @@ -363,10 +362,7 @@ char *pa_source_list_to_string(pa_core *c) { source->flags & PA_SOURCE_LATENCY ? "LATENCY " : "", source->flags & PA_SOURCE_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "", pa_source_state_to_string(pa_source_get_state(source)), -source->suspend_cause & PA_SUSPEND_USER ? "USER " : "", -source->suspend_cause & PA_SUSPEND_APPLICATION ? "APPLICATION " : "", -source->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "", -source->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "", +pa_suspend_cause_to_string(source->suspend_cause, suspend_cause_buf), source->priority, pa_cvolume_snprint_verbose(cv, sizeof(cv), diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 454c5668..79abbc04 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -502,3 +502,44 @@ void pa_core_rttime_restart(pa_core *c, pa_time_event *e, pa_usec_t usec) { c->mainloop->time_restart(e, pa_timeval_rtstore(&tv, usec, true)); } + +/* Helper macro to reduce repetition in pa_suspend_cause_to_string(). + * Parameters: + * char *p: the current position in the write buffer + * bool first: is cause_to_check the first cause to be written? + * pa_suspend_cause_t cause_bitfield: the causes given to pa_suspend_cause_to_string() + * pa_suspend_cause_t cause_to_check: the cause whose presence in cause_bitfield is to be checked + */ +#define CHECK_CAUSE(p, first, cause_bitfield, cause_to_check) \ +if (cause_bitfield & PA_SUSPEND_##cause_to_check) {
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/bluetooth/backend-ofono.c |6 +++ src/modules/bluetooth/bluez4-util.c | 12 ++- src/modules/bluetooth/bluez5-util.c | 12 ++- src/modules/dbus/iface-core.c |4 +- src/modules/module-default-device-restore.c | 30 +- src/modules/module-switch-on-connect.c |8 ++-- src/modules/reserve.c |6 +++ src/pulsecore/cli-command.c |4 +- src/pulsecore/core.c| 46 +--- src/pulsecore/core.h| 13 --- src/pulsecore/protocol-native.c |6 +-- src/pulsecore/sink.c|5 --- src/pulsecore/source.c |5 --- 13 files changed, 96 insertions(+), 61 deletions(-) New commits: commit e7d7b29c174f0b97d8a06de6fa3b555e64cc267a Author: Tanu Kaskinen Date: Tue Jul 11 21:16:17 2017 +0300 protocol-native: fix bytes-to-usec conversion of "on-the-fly" data The on_the_fly_snapshot variable contains the amount of bytes that has been sent from the source IO thread to the main thread, but not yet pushed to the stream memblockq. The data is in the stream format, but the bytes-to-usec conversion used the source format, which caused random latency reporting errors. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=81075 diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 068e0c00..866e2c64 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -2922,7 +2922,7 @@ static void command_get_record_latency(pa_pdispatch *pd, uint32_t command, uint3 pa_tagstruct_put_usec(reply, s->current_monitor_latency); pa_tagstruct_put_usec(reply, s->current_source_latency + - pa_bytes_to_usec(s->on_the_fly_snapshot, &s->source_output->source->sample_spec)); + pa_bytes_to_usec(s->on_the_fly_snapshot, &s->source_output->sample_spec)); pa_tagstruct_put_boolean(reply, pa_source_get_state(s->source_output->source) == PA_SOURCE_RUNNING && pa_source_output_get_state(s->source_output) == PA_SOURCE_OUTPUT_RUNNING); commit a448cc587c203bba42b1b9805317088e95775f71 Author: Tanu Kaskinen Date: Fri Jun 30 00:09:34 2017 +0300 core: change configured_default_sink/source type to string This allows us to restore the default device properly when a hotpluggable device (e.g. a USB sound card) is set as the default, but unplugged temporarily. Previously we would forget that the unplugged device was ever set as the default, because we had to set configured_default_sink to NULL to avoid having a stale pa_sink pointer, and also because module-default-device-restore couldn't resolve the name of a currently-unplugged device to a pa_sink pointer. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89934 diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c index 3f368ab4..7177455b 100644 --- a/src/modules/dbus/iface-core.c +++ b/src/modules/dbus/iface-core.c @@ -721,7 +721,7 @@ static void handle_set_fallback_sink(DBusConnection *conn, DBusMessage *msg, DBu return; } -pa_core_set_configured_default_sink(c->core, pa_dbusiface_device_get_sink(fallback_sink)); +pa_core_set_configured_default_sink(c->core, pa_dbusiface_device_get_sink(fallback_sink)->name); pa_dbus_send_empty_reply(conn, msg); } @@ -809,7 +809,7 @@ static void handle_set_fallback_source(DBusConnection *conn, DBusMessage *msg, D return; } -pa_core_set_configured_default_source(c->core, pa_dbusiface_device_get_source(fallback_source)); +pa_core_set_configured_default_source(c->core, pa_dbusiface_device_get_source(fallback_source)->name); pa_dbus_send_empty_reply(conn, msg); } diff --git a/src/modules/module-default-device-restore.c b/src/modules/module-default-device-restore.c index 56fee67f..adf19ff9 100644 --- a/src/modules/module-default-device-restore.c +++ b/src/modules/module-default-device-restore.c @@ -60,7 +60,6 @@ static void load(struct userdata *u) { pa_log_info("Manually configured default sink, not overwriting."); else if ((f = pa_fopen_cloexec(u->sink_filename, "r"))) { char ln[256] = ""; -pa_sink *s; if (fgets(ln, sizeof(ln)-1, f)) pa_strip_nl(ln); @@ -68,11 +67,12 @@ static void load(struct userdata *u) { if (!ln[0]) pa_log_info("No previous default sink setting, ignoring."); -else if ((s = pa_namereg_get(u->core, ln, PA_NAMEREG_SINK))) { -pa_core_set_configured_default_sink(u->core, s); -pa_log_info("Restored default sink '%s'.", ln); -} else -pa_log_info("Saved default sink '%s' not existent, not r
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/echo-cancel/module-echo-cancel.c | 98 ++- src/modules/module-equalizer-sink.c | 64 ++--- src/modules/module-ladspa-sink.c | 67 ++ src/modules/module-remap-sink.c | 68 ++ src/modules/module-remap-source.c| 39 +++--- src/modules/module-switch-on-connect.c | 12 +++ src/modules/module-virtual-sink.c| 67 ++ src/modules/module-virtual-source.c | 38 +++--- src/modules/module-virtual-surround-sink.c | 67 ++ src/pulsecore/sink.c |6 + src/pulsecore/source.c |6 + 11 files changed, 334 insertions(+), 198 deletions(-) New commits: commit e08124f6ba09d553e3a9a3b8fee16f3a83571122 Author: Georg Chini Date: Thu May 18 07:47:27 2017 +0200 sink/source: Don't update default sink/source before calling PA_CORE_HOOK_{SINK,SOURCE}_PUT In sink_put() and source_put(), pa_core_update_default_{sink,source}() was called before the PA_CORE_HOOK_{SINK,SOURCE}_PUT hook. Therefore module-switch-on-connect could not correctly determine the old default sink/source if no user default was set and a sink/source with higher priority than any other sink/source turned up. This patch corrects the problem by swapping the order of the hook call and the pa_core_update_default_sink() call. Additionally it corrects a problem in module-switch-on-connect. If, after the change above, the new sink/source was the first sink/source to appear, pulseaudio would crash because module-switch-on-connect assumed that the default sink/source was not NULL. The patch checks if the default sink/source is NULL and only sets the new default sink/source in that case. diff --git a/src/modules/module-switch-on-connect.c b/src/modules/module-switch-on-connect.c index 776c923e..e2da7222 100644 --- a/src/modules/module-switch-on-connect.c +++ b/src/modules/module-switch-on-connect.c @@ -75,6 +75,12 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, void* return PA_HOOK_OK; } +/* No default sink, nothing to move away, just set the new default */ +if (!c->default_sink) { +pa_core_set_configured_default_sink(c, sink); +return PA_HOOK_OK; +} + if (c->default_sink == sink) return PA_HOOK_OK; @@ -135,6 +141,12 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source, return PA_HOOK_OK; } +/* No default source, nothing to move away, just set the new default */ +if (!c->default_source) { +pa_core_set_configured_default_source(c, source); +return PA_HOOK_OK; +} + if (c->default_source == source) return PA_HOOK_OK; diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 43dad516..39463bd2 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -660,10 +660,12 @@ void pa_sink_put(pa_sink* s) { pa_source_put(s->monitor_source); -pa_core_update_default_sink(s->core); - pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK | PA_SUBSCRIPTION_EVENT_NEW, s->index); pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SINK_PUT], s); + +/* This function must be called after the PA_CORE_HOOK_SINK_PUT hook, + * because module-switch-on-connect needs to know the old default sink */ +pa_core_update_default_sink(s->core); } /* Called from main context */ diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index cfbc6268..d56a13dd 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -603,10 +603,12 @@ void pa_source_put(pa_source *s) { else pa_assert_se(source_set_state(s, PA_SOURCE_IDLE) == 0); -pa_core_update_default_source(s->core); - pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_NEW, s->index); pa_hook_fire(&s->core->hooks[PA_CORE_HOOK_SOURCE_PUT], s); + +/* This function must be called after the PA_CORE_HOOK_SOURCE_PUT hook, + * because module-switch-on-connect needs to know the old default source */ +pa_core_update_default_source(s->core); } /* Called from main context */ commit edc465da77874a1058cec0ab3714922e1ec0cc27 Author: Georg Chini Date: Thu May 18 07:46:46 2017 +0200 virtual sources and sinks: Don't double attach a sink input or source output on filter load When a filter is loaded and module-switch-on-connect is present, switch-on-connect will make the filter the default sink or source and move streams from the old default to the filter. This is done from the sink/source put hook, therefore streams are moved to the filter before the module init function of the filter calls sink_input_put() or source_output_put(). The move succeeds because the asyncmsq already poin
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/alsa/alsa-mixer.c|4 src/modules/alsa/mixer/profile-sets/default.conf |8 src/modules/dbus/iface-core.c| 114 +- src/modules/dbus/iface-sample.c | 10 - src/modules/module-default-device-restore.c | 14 - src/modules/module-intended-roles.c | 37 ++-- src/modules/module-rescue-streams.c | 20 -- src/modules/module-switch-on-connect.c | 30 +-- src/pulsecore/cli-command.c | 20 -- src/pulsecore/cli-text.c | 12 - src/pulsecore/core.c | 186 +++ src/pulsecore/core.h | 28 +++ src/pulsecore/device-port.c |8 src/pulsecore/namereg.c | 115 -- src/pulsecore/namereg.h |6 src/pulsecore/protocol-native.c | 19 +- src/pulsecore/sink.c |7 src/pulsecore/source.c |7 18 files changed, 404 insertions(+), 241 deletions(-) New commits: commit 1c477fcb679ac50259ef057ebe23c80c529aa612 Author: Tanu Kaskinen Date: Thu Feb 16 12:09:39 2017 +0200 core, device-port: check availability when choosing the default device It doesn't make sense to use a sink or source whose active port is unavailable, so let's take this into account when choosing the default sink and source. diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 16fd040a..52e51db1 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -266,6 +266,14 @@ static int compare_sinks(pa_sink *a, pa_sink *b) { core = a->core; +/* Available sinks always beat unavailable sinks. */ +if (a->active_port && a->active_port->available == PA_AVAILABLE_NO +&& (!b->active_port || b->active_port->available != PA_AVAILABLE_NO)) +return -1; +if (b->active_port && b->active_port->available == PA_AVAILABLE_NO +&& (!a->active_port || a->active_port->available != PA_AVAILABLE_NO)) +return 1; + /* The configured default sink is preferred over any other sink. */ if (b == core->configured_default_sink) return -1; @@ -332,6 +340,14 @@ static int compare_sources(pa_source *a, pa_source *b) { core = a->core; +/* Available sources always beat unavailable sources. */ +if (a->active_port && a->active_port->available == PA_AVAILABLE_NO +&& (!b->active_port || b->active_port->available != PA_AVAILABLE_NO)) +return -1; +if (b->active_port && b->active_port->available == PA_AVAILABLE_NO +&& (!a->active_port || a->active_port->available != PA_AVAILABLE_NO)) +return 1; + /* The configured default source is preferred over any other source. */ if (b == core->configured_default_source) return -1; diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c index 7c9ddf32..76a7e80a 100644 --- a/src/pulsecore/device-port.c +++ b/src/pulsecore/device-port.c @@ -93,6 +93,14 @@ void pa_device_port_set_available(pa_device_port *p, pa_available_t status) { * be created before port objects, and then p->card could be non-NULL for * the whole lifecycle of pa_device_port. */ if (p->card) { +/* A sink or source whose active port is unavailable can't be the + * default sink/source, so port availability changes may affect the + * default sink/source choice. */ +if (p->direction == PA_DIRECTION_OUTPUT) +pa_core_update_default_sink(p->core); +else +pa_core_update_default_source(p->core); + pa_subscription_post(p->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index); pa_hook_fire(&p->core->hooks[PA_CORE_HOOK_PORT_AVAILABLE_CHANGED], p); } commit 6b348961304903483aa78d4ddc1fd036ef75a7cb Author: Tanu Kaskinen Date: Thu Feb 16 12:09:38 2017 +0200 improve default sink/source handling Currently the default sink policy is simple: either the user has configured it explicitly, in which case we always use that as the default, or we pick the sink with the highest priority. The sink priorities are currently static, so there's no need to worry about updating the default sink when sink priorities change. I intend to make things a bit more complex: if the active port of a sink is unavailable, the sink should not be the default sink, and I also want to make sink priorities dependent on the active port, so changing the port should cause re-evaluation of which sink to choose as the default. Currently the default sink choice is done only when someone calls pa_namereg_get_default_sink(), and change notifications are only sent when a sink is created or destroyed. That makes it hard to add new ru
[pulseaudio-commits] 3 commits - src/modules src/pulsecore src/utils
src/modules/dbus/module-dbus-protocol.c |4 ++-- src/modules/raop/raop-client.c | 30 +++--- src/modules/raop/raop-sink.c|2 +- src/pulsecore/core-util.c |4 ++-- src/pulsecore/dbus-util.c |4 ++-- src/pulsecore/shm.c |2 +- src/utils/padsp.c |6 +++--- 7 files changed, 26 insertions(+), 26 deletions(-) New commits: commit 74abce331b8423219911de33f99c0870f871633d Author: Peter Meerwald-Stadler Date: Tue Mar 7 14:29:12 2017 +0100 raop: Fix check for invalid file descriptor file descriptor 0 is valid Signed-off-by: Peter Meerwald-Stadler diff --git a/src/modules/raop/raop-client.c b/src/modules/raop/raop-client.c index 1bd4c4a..f23cf93 100644 --- a/src/modules/raop/raop-client.c +++ b/src/modules/raop/raop-client.c @@ -968,10 +968,10 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_ break; annonce_error: -if (c->udp_cfd > 0) +if (c->udp_cfd >= 0) pa_close(c->udp_cfd); c->udp_cfd = -1; -if (c->udp_tfd > 0) +if (c->udp_tfd >= 0) pa_close(c->udp_tfd); c->udp_tfd = -1; @@ -1073,11 +1073,11 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_ break; setup_error: -if (c->tcp_sfd > 0) +if (c->tcp_sfd >= 0) pa_close(c->tcp_sfd); c->tcp_sfd = -1; -if (c->udp_sfd > 0) +if (c->udp_sfd >= 0) pa_close(c->udp_sfd); c->udp_sfd = -1; @@ -1135,11 +1135,11 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_ case STATE_TEARDOWN: { pa_log_debug("RAOP: TEARDOWN"); -if (c->tcp_sfd > 0) +if (c->tcp_sfd >= 0) pa_close(c->tcp_sfd); c->tcp_sfd = -1; -if (c->udp_sfd > 0) +if (c->udp_sfd >= 0) pa_close(c->udp_sfd); c->udp_sfd = -1; @@ -1163,11 +1163,11 @@ static void rtsp_stream_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_ c->is_recording = false; -if (c->tcp_sfd > 0) +if (c->tcp_sfd >= 0) pa_close(c->tcp_sfd); c->tcp_sfd = -1; -if (c->udp_sfd > 0) +if (c->udp_sfd >= 0) pa_close(c->udp_sfd); c->udp_sfd = -1; @@ -1507,11 +1507,11 @@ bool pa_raop_client_is_alive(pa_raop_client *c) { switch (c->protocol) { case PA_RAOP_PROTOCOL_TCP: -if (c->tcp_sfd > 0) +if (c->tcp_sfd >= 0) return true; break; case PA_RAOP_PROTOCOL_UDP: -if (c->udp_sfd > 0) +if (c->udp_sfd >= 0) return true; break; default: @@ -1531,11 +1531,11 @@ bool pa_raop_client_can_stream(pa_raop_client *c) { switch (c->protocol) { case PA_RAOP_PROTOCOL_TCP: -if (c->tcp_sfd > 0 && c->is_recording) +if (c->tcp_sfd >= 0 && c->is_recording) return true; break; case PA_RAOP_PROTOCOL_UDP: -if (c->udp_sfd > 0 && c->is_recording) +if (c->udp_sfd >= 0 && c->is_recording) return true; break; default: @@ -1557,14 +1557,14 @@ int pa_raop_client_stream(pa_raop_client *c) { switch (c->protocol) { case PA_RAOP_PROTOCOL_TCP: -if (c->tcp_sfd > 0 && !c->is_recording) { +if (c->tcp_sfd >= 0 && !c->is_recording) { c->is_recording = true; c->is_first_packet = true; c->sync_count = 0; } break; case PA_RAOP_PROTOCOL_UDP: -if (c->udp_sfd > 0 && !c->is_recording) { +if (c->udp_sfd >= 0 && !c->is_recording) { c->is_recording = true; c->is_first_packet = true; c->sync_count = 0; @@ -1722,7 +1722,7 @@ pa_volume_t pa_raop_client_adjust_volume(pa_raop_client *c, pa_volume_t volume) void pa_raop_client_handle_oob_packet(pa_raop_client *c, const int fd, const uint8_t packet[], ssize_t size) { pa_assert(c); -pa_assert(fd > 0); +pa_assert(fd >= 0); pa_assert(packet); if (c->protocol == PA_RAOP_PROTOCOL_UDP) { diff --git a/src/modules/raop/raop-sink.c b/src/modules/raop/raop-sink.c index d321a2d..c5ff8b9 100644 --- a/src/modules/raop/raop-sink.c +++ b/src/modules/raop/raop-sink.c @@ -247,7 +247,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse if (u->rtpoll_item) { pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, &nbfds);
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/bluetooth/module-bluetooth-policy.c |6 ++-- src/modules/module-suspend-on-idle.c| 34 src/pulsecore/sink-input.c | 10 +++ src/pulsecore/sink.c|7 +++- src/pulsecore/sink.h|9 +- src/pulsecore/source-output.c | 10 +++ src/pulsecore/source.c |5 ++- src/pulsecore/source.h |6 +++- 8 files changed, 52 insertions(+), 35 deletions(-) New commits: commit 74ff1153425c927e6dfd198cbf1e0d6edfbfa873 Author: Tanu Kaskinen Date: Wed Oct 12 17:20:41 2016 +0300 sink-input, source-output: set sink/source to NULL before the "unlink post" hook At the time the "unlink post" hook is fired, the stream is not any more connected to its old device, so it makes sense to reset the sink/source pointer to NULL before firing the hook. If this is not done, the pointer may become stale during the "unlink post" hook, because module-bluetooth-policy does a card profile change in its "unlink post" callback, so even if the pointer is valid when module-bluetooth-policy's callback is called, it will be invalid in subsequent callbacks. diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 0dda204..c248cd8 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -697,11 +697,6 @@ void pa_sink_input_unlink(pa_sink_input *i) { reset_callbacks(i); -if (linked) { -pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_REMOVE, i->index); -pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK_POST], i); -} - if (i->sink) { if (PA_SINK_IS_LINKED(pa_sink_get_state(i->sink))) pa_sink_update_status(i->sink); @@ -709,6 +704,11 @@ void pa_sink_input_unlink(pa_sink_input *i) { i->sink = NULL; } +if (linked) { +pa_subscription_post(i->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_REMOVE, i->index); +pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK_POST], i); +} + pa_core_maybe_vacuum(i->core); pa_sink_input_unref(i); diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 35ef1c5..3c421ad 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -591,11 +591,6 @@ void pa_source_output_unlink(pa_source_output*o) { reset_callbacks(o); -if (linked) { -pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_REMOVE, o->index); -pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], o); -} - if (o->source) { if (PA_SOURCE_IS_LINKED(pa_source_get_state(o->source))) pa_source_update_status(o->source); @@ -603,6 +598,11 @@ void pa_source_output_unlink(pa_source_output*o) { o->source = NULL; } +if (linked) { +pa_subscription_post(o->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_REMOVE, o->index); +pa_hook_fire(&o->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], o); +} + pa_core_maybe_vacuum(o->core); pa_source_output_unref(o); commit c3393d27a5b18bca3e052d54a734d5cfb9e0aea0 Author: Tanu Kaskinen Date: Wed Oct 12 17:20:40 2016 +0300 suspend-on-idle: use earlier (safer) hooks for stream unlink notifications In the "unlink post" hook it's not guaranteed that the stream's old device exists any more, so let's use the "unlink" hook that is safer. For example, module-bluetooth-policy does a card profile change in the source-output "unlink post" hook, which invalidates the source-output's source pointer. When the "unlink" hook is fired, the stream is still linked to its device, which affects the return values of the check_suspend() functions. The unlinked streams should be ignored by the check_suspend() functions, so I had to add extra parameters to those functions. diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c index f7620db..a284f85 100644 --- a/src/modules/module-suspend-on-idle.c +++ b/src/modules/module-suspend-on-idle.c @@ -67,13 +67,13 @@ static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval d->userdata->core->mainloop->time_restart(d->time_event, NULL); -if (d->sink && pa_sink_check_suspend(d->sink) <= 0 && !(d->sink->suspend_cause & PA_SUSPEND_IDLE)) { +if (d->sink && pa_sink_check_suspend(d->sink, NULL, NULL) <= 0 && !(d->sink->suspend_cause & PA_SUSPEND_IDLE)) { pa_log_info("Sink %s idle for too long, suspending ...", d->sink->name); pa_sink_suspend(d->sink, true, PA_SUSPEND_IDLE); pa_core_maybe_vacuum(d->userdata->core); } -if (d->source && pa_source_check_suspend(d
[pulseaudio-commits] 3 commits - src/modules
src/modules/module-device-manager.c | 42 ++--- src/modules/module-filter-apply.c | 60 +++- 2 files changed, 70 insertions(+), 32 deletions(-) New commits: commit fcee3da944703f382209f0638cc4ef5beb8122a9 Author: Arun Raghavan Date: Fri May 6 11:56:00 2016 +0530 module-device-manager: Refine logic to ignore filtered streams Rather than entirely ignore streams for which we have automatically loaded a filter, this makes module-device-manager only avoid rerouting such streams within their existing filter hierarchy. If, for example, m-d-m decided to move a stream which is currently routed to speakers/mic which we requested echo cancellation for, to a USB headset, the previous logic would disallow such a move even though it was legitimate. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93443 Signed-off-by: Arun Raghavan diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c index b3115ee..2a0a67f 100644 --- a/src/modules/module-device-manager.c +++ b/src/modules/module-device-manager.c @@ -649,9 +649,10 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha } static void route_sink_input(struct userdata *u, pa_sink_input *si) { -const char *ignore; +const char *auto_filtered_prop; const char *role; uint32_t role_index, device_index; +bool auto_filtered = false; pa_sink *sink; pa_assert(u); @@ -664,9 +665,9 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) { if (!si->sink) return; -ignore = pa_proplist_gets(si->proplist, "module-device-manager.ignore"); -if (ignore && (pa_parse_boolean(ignore) == 1)) -return; +auto_filtered_prop = pa_proplist_gets(si->proplist, "module-device-manager.auto_filtered"); +if (auto_filtered_prop) +auto_filtered = (pa_parse_boolean(auto_filtered_prop) == 1); /* It might happen that a stream and a sink are set up at the same time, in which case we want to make sure we don't @@ -689,6 +690,13 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) { if (!(sink = pa_idxset_get_by_index(u->core->sinks, device_index))) return; +if (auto_filtered) { +/* For streams for which a filter has been loaded by another module, we + * do not try to execute moves within the same filter hierarchy */ +if (pa_sink_get_master(si->sink) == pa_sink_get_master(sink)) +return; +} + if (si->sink != sink) pa_sink_input_move_to(si, sink, false); } @@ -712,9 +720,10 @@ static pa_hook_result_t route_sink_inputs(struct userdata *u, pa_sink *ignore_si } static void route_source_output(struct userdata *u, pa_source_output *so) { -const char *ignore; +const char *auto_filtered_prop; const char *role; uint32_t role_index, device_index; +bool auto_filtered = false; pa_source *source; pa_assert(u); @@ -730,9 +739,9 @@ static void route_source_output(struct userdata *u, pa_source_output *so) { if (!so->source) return; -ignore = pa_proplist_gets(so->proplist, "module-device-manager.ignore"); -if (ignore && (pa_parse_boolean(ignore) == 1)) -return; +auto_filtered_prop = pa_proplist_gets(so->proplist, "module-device-manager.auto_filtered"); +if (auto_filtered_prop) +auto_filtered = (pa_parse_boolean(auto_filtered_prop) == 1); /* It might happen that a stream and a source are set up at the same time, in which case we want to make sure we don't @@ -755,6 +764,13 @@ static void route_source_output(struct userdata *u, pa_source_output *so) { if (!(source = pa_idxset_get_by_index(u->core->sources, device_index))) return; +if (auto_filtered) { +/* For streams for which a filter has been loaded by another module, we + * do not try to execute moves within the same filter hierarchy */ +if (pa_source_get_master(so->source) == pa_source_get_master(source)) +return; +} + if (so->source != source) pa_source_output_move_to(so, source, false); } diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c index c8bb4da..47ef46d 100644 --- a/src/modules/module-filter-apply.c +++ b/src/modules/module-filter-apply.c @@ -38,7 +38,7 @@ #include "module-filter-apply-symdef.h" #define PA_PROP_FILTER_APPLY_MOVING "filter.apply.moving" -#define PA_PROP_MDM_IGNORE "module-device-manager.ignore" +#define PA_PROP_MDM_AUTO_FILTERED "module-device-manager.auto_filtered" PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION("Load filter sinks automatically when needed"); @@ -66,8 +66,8 @@ struct filter { struct userdata { pa_core *core; pa_hashmap *filters; -/* Keep track of streams we're managing PA_PROP_MDM_IGNORE on, we'
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/module-card-restore.c | 68 src/modules/module-switch-on-port-available.c | 209 +- src/pulsecore/card.c | 46 + src/pulsecore/card.h | 12 + src/pulsecore/core.h |1 5 files changed, 328 insertions(+), 8 deletions(-) New commits: commit 23c15c3b52a958887c1f8cad3c94879a8770ef0e Author: Tanu Kaskinen Date: Fri Mar 4 15:23:32 2016 +0200 switch-on-port-available: prefer ports that have been selected by the user Let's assume that there are two output ports, and they are on different profiles: * Integrated speakers (priority: 1, available) * HDMI(priority: 5900, not available) Then the user plugs in an HDMI monitor with speakers. Since the HDMI priority is lower than the speaker priority, we don't route to HDMI by default. However, the user manually switches the profile to use the HDMI output. Then the user plugs out the monitor, so we switch back to speakers. When the monitor is plugged back in, the user needs to manually switch the audio output again. That should be improved: if the user preferred to the HDMI output over the speakers, we should remember that and automatically switch to HDMI whenever it becomes available. The lack of automatic switching is even worse when the monitor goes to a sleep mode after some period of inactivity. The monitor audio may become unavailable, and PulseAudio can't distinguish that from the case where the monitor is physically unplugged. Even worse, the monitor may become unavailable for a short while when adjusting the display parameters (for example, media center software may adjust the display parameters to match the media that is being played back). In these cases we clearly should switch automatically back to HDMI when it becomes available again. This patch fixes the problem by setting pa_card.preferred_input_port and pa_card.preferred_output_port when the user changes the card profile or a port, and switching to the preferred port when it becomes available. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93946 diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c index 2453644..b9a0f3b 100644 --- a/src/modules/module-switch-on-port-available.c +++ b/src/modules/module-switch-on-port-available.c @@ -29,7 +29,37 @@ #include "module-switch-on-port-available-symdef.h" -static bool profile_good_for_output(pa_card_profile *profile, unsigned prio) { +struct card_info { +struct userdata *userdata; +pa_card *card; + +/* We need to cache the active profile, because we want to compare the old + * and new profiles in the PROFILE_CHANGED hook. Without this we'd only + * have access to the new profile. */ +pa_card_profile *active_profile; +}; + +struct userdata { +pa_hashmap *card_infos; /* pa_card -> struct card_info */ +}; + +static void card_info_new(struct userdata *u, pa_card *card) { +struct card_info *info; + +info = pa_xnew0(struct card_info, 1); +info->userdata = u; +info->card = card; +info->active_profile = card->active_profile; + +pa_hashmap_put(u->card_infos, card, info); +} + +static void card_info_free(struct card_info *info) { +pa_hashmap_remove(info->userdata->card_infos, info->card); +pa_xfree(info); +} + +static bool profile_good_for_output(pa_card_profile *profile, pa_device_port *port) { pa_card *card; pa_sink *sink; uint32_t idx; @@ -47,19 +77,21 @@ static bool profile_good_for_output(pa_card_profile *profile, unsigned prio) { if (card->active_profile->max_source_channels != profile->max_source_channels) return false; -/* Try not to switch to HDMI sinks from analog when HDMI is becoming available */ +if (port == card->preferred_output_port) +return true; + PA_IDXSET_FOREACH(sink, card->sinks, idx) { if (!sink->active_port) continue; -if ((sink->active_port->available != PA_AVAILABLE_NO) && (sink->active_port->priority >= prio)) +if ((sink->active_port->available != PA_AVAILABLE_NO) && (sink->active_port->priority >= port->priority)) return false; } return true; } -static bool profile_good_for_input(pa_card_profile *profile, unsigned prio) { +static bool profile_good_for_input(pa_card_profile *profile, pa_device_port *port) { pa_card *card; pa_source *source; uint32_t idx; @@ -77,11 +109,14 @@ static bool profile_good_for_input(pa_card_profile *profile, unsigned prio) { if (card->active_profile->max_sink_channels != profile->max_sink_channels) return false; +if (port == card->preferred_input_port) +return true; + PA_IDXSET_FOREACH(source, card-
[pulseaudio-commits] 3 commits - src/modules
src/modules/module-switch-on-port-available.c | 37 ++ 1 file changed, 27 insertions(+), 10 deletions(-) New commits: commit b88f2859a988ce5a1667363445c67fc34b756298 Author: Tanu Kaskinen Date: Fri Mar 4 15:23:29 2016 +0200 switch-on-port-available: avoid repetitive pointer deferencing Trivial refactoring. diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c index 9bfb43f..2453644 100644 --- a/src/modules/module-switch-on-port-available.c +++ b/src/modules/module-switch-on-port-available.c @@ -30,22 +30,25 @@ #include "module-switch-on-port-available-symdef.h" static bool profile_good_for_output(pa_card_profile *profile, unsigned prio) { +pa_card *card; pa_sink *sink; uint32_t idx; pa_assert(profile); -if (!pa_safe_streq(profile->card->active_profile->input_name, profile->input_name)) +card = profile->card; + +if (!pa_safe_streq(card->active_profile->input_name, profile->input_name)) return false; -if (profile->card->active_profile->n_sources != profile->n_sources) +if (card->active_profile->n_sources != profile->n_sources) return false; -if (profile->card->active_profile->max_source_channels != profile->max_source_channels) +if (card->active_profile->max_source_channels != profile->max_source_channels) return false; /* Try not to switch to HDMI sinks from analog when HDMI is becoming available */ -PA_IDXSET_FOREACH(sink, profile->card->sinks, idx) { +PA_IDXSET_FOREACH(sink, card->sinks, idx) { if (!sink->active_port) continue; @@ -57,21 +60,24 @@ static bool profile_good_for_output(pa_card_profile *profile, unsigned prio) { } static bool profile_good_for_input(pa_card_profile *profile, unsigned prio) { +pa_card *card; pa_source *source; uint32_t idx; pa_assert(profile); -if (!pa_safe_streq(profile->card->active_profile->output_name, profile->output_name)) +card = profile->card; + +if (!pa_safe_streq(card->active_profile->output_name, profile->output_name)) return false; -if (profile->card->active_profile->n_sinks != profile->n_sinks) +if (card->active_profile->n_sinks != profile->n_sinks) return false; -if (profile->card->active_profile->max_sink_channels != profile->max_sink_channels) +if (card->active_profile->max_sink_channels != profile->max_sink_channels) return false; -PA_IDXSET_FOREACH(source, profile->card->sources, idx) { +PA_IDXSET_FOREACH(source, card->sources, idx) { if (!source->active_port) continue; commit a99eb81db363427d706ee28db73dd33999291cf3 Author: Tanu Kaskinen Date: Fri Mar 4 15:23:28 2016 +0200 switch-on-port-available: fix inverted if condition I'm sure the original intention was to switch the port if the target port is available on the currently active profile. diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c index e5e1e9d..9bfb43f 100644 --- a/src/modules/module-switch-on-port-available.c +++ b/src/modules/module-switch-on-port-available.c @@ -193,7 +193,7 @@ static bool switch_to_port(pa_device_port *port) { pa_log_debug("Trying to switch to port %s", port->name); if (!pp.is_preferred_profile_active) { if (try_to_switch_profile(port) < 0) { -if (pp.is_possible_profile_active) +if (!pp.is_possible_profile_active) return false; } else commit fe4f96d56ee2e8818790b3d562a22d26192591c7 Author: Tanu Kaskinen Date: Fri Mar 4 15:23:27 2016 +0200 switch-on-port-available: unify input/output switching policy I don't think there's any reason why the same logic that has previously added to output profile switching shouldn't be used with input too. diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c index 6f4c895..e5e1e9d 100644 --- a/src/modules/module-switch-on-port-available.c +++ b/src/modules/module-switch-on-port-available.c @@ -56,7 +56,10 @@ static bool profile_good_for_output(pa_card_profile *profile, unsigned prio) { return true; } -static bool profile_good_for_input(pa_card_profile *profile) { +static bool profile_good_for_input(pa_card_profile *profile, unsigned prio) { +pa_source *source; +uint32_t idx; + pa_assert(profile); if (!pa_safe_streq(profile->card->active_profile->output_name, profile->output_name)) @@ -68,6 +71,14 @@ static bool profile_good_for_input(pa_card_profile *profile) { if (profile->card->active_profile->max_sink_channels != profile->max_sink_channels) return false; +PA_IDXSET_FOREACH(source, profile->card->sources, idx) { +if (!source->active_port) +continue; + +if ((source->active_port->availa
[pulseaudio-commits] 3 commits - src/modules
src/modules/alsa/mixer/paths/analog-input-linein.conf |7 src/modules/alsa/mixer/paths/analog-input-mic.conf|7 src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules |1 src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf | 72 ++ 4 files changed, 87 insertions(+) New commits: commit 031ca878216c76a508da45fc086fa19509406771 Author: Tanu Kaskinen Date: Mon Aug 10 17:22:38 2015 +0200 alsa-mixer: sb-omni-surround-5.1.conf: remove analog-surround-40 mapping It was reported that the 4.0 mode doesn't work properly: http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/23677/focus=23904 diff --git a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf index 84d8483..5795067 100644 --- a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf +++ b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf @@ -43,13 +43,6 @@ paths-output = analog-output priority = 5 direction = output -[Mapping analog-surround-40] -device-strings = surround40:%f -channel-map = front-left,front-right,rear-left,rear-right -paths-output = analog-output -priority = 6 -direction = output - [Mapping analog-surround-41] device-strings = surround41:%f channel-map = front-left,front-right,rear-left,rear-right,lfe commit 9083750fc8c54708da87d49b3affce86770c08c5 Author: Tanu Kaskinen Date: Thu Aug 6 12:13:54 2015 +0200 alsa-mixer: sb-omni-surround-5.1.conf: rename analog-stereo to analog-stereo-output The mapping is only useful for output, and this renaming makes the name symmetric with the input mapping. diff --git a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf index 1c4aa7b..84d8483 100644 --- a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf +++ b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf @@ -23,11 +23,12 @@ [General] auto-profiles = yes -[Mapping analog-stereo] +[Mapping analog-stereo-output] device-strings = front:%f hw:%f channel-map = left,right paths-output = analog-output priority = 10 +direction = output [Mapping analog-stereo-input] device-strings = hw:%f,1,0 @@ -75,4 +76,4 @@ device-strings = iec958:%f channel-map = left,right paths-output = iec958-stereo-output priority = 5 -direction = output \ No newline at end of file +direction = output commit b7744e5004b7dbd36bbb0ed7d211e7da3f5feb1b Author: Nazar Mokrynskyi Date: Wed Jun 3 17:32:09 2015 +0200 alsa-mixer: Add support for Creative SoundBlaster Omni Surround 5.1 USB sound card Mic and Line in inputs were not working at all, since they use the hw:x,1,0 device, which is not supported in the default configuration. diff --git a/src/modules/alsa/mixer/paths/analog-input-linein.conf b/src/modules/alsa/mixer/paths/analog-input-linein.conf index 5577ea6..2c94a0b 100644 --- a/src/modules/alsa/mixer/paths/analog-input-linein.conf +++ b/src/modules/alsa/mixer/paths/analog-input-linein.conf @@ -62,6 +62,13 @@ enumeration = select name = analog-input-linein required-any = any +[Element PCM Capture Source] +enumeration = select + +[Option PCM Capture Source:Line] +name = analog-input-linein +required-any = any + [Element Mic] switch = off volume = off diff --git a/src/modules/alsa/mixer/paths/analog-input-mic.conf b/src/modules/alsa/mixer/paths/analog-input-mic.conf index a4d1c65..4d64f92 100644 --- a/src/modules/alsa/mixer/paths/analog-input-mic.conf +++ b/src/modules/alsa/mixer/paths/analog-input-mic.conf @@ -69,6 +69,13 @@ enumeration = select name = analog-input-microphone required-any = any +[Element PCM Capture Source] +enumeration = select + +[Option PCM Capture Source:Mic] +name = analog-input-microphone +required-any = any + ;;; Some AC'97s have "Mic Select" and "Mic Boost (+20dB)" [Element Mic Select] diff --git a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules index eeb6ac4..70e34e6 100644 --- a/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules +++ b/src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules @@ -97,5 +97,6 @@ ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="1011", ENV{PULSE_PROFILE_SET}="nativ ATTRS{idVendor}=="17cc", ATTRS{idProduct}=="1021", ENV{PULSE_PROFILE_SET}="native-instruments-traktor-audio10.conf" ATTRS{idVendor}=="0763", ATTRS{idProduct}=="2012", ENV{PULSE_PROFILE_SET}="maudio-fasttrack-pro.conf" ATTRS{idVendor}=="045e", ATTRS{idProduct}=="02bb", ENV{PULSE_PROFILE_SET}="kinect-audio.conf" +ATTRS{idVendor}=="041e", ATTRS{idProduct}=="322c", ENV{PULSE_PROFILE_SET}="sb-omni-surround-5.1.conf" LABEL="pulseaudio_end" diff --git a/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf b/src/modules/alsa/mixer/profile-sets/sb-omni-surround-5.1.conf new file mode 100644 index 000..1c4aa7b --- /dev/nul
[pulseaudio-commits] 3 commits - src/modules src/utils
src/modules/alsa/alsa-util.c |2 +- src/modules/module-tunnel.c |2 +- src/utils/pacmd.c|2 +- 3 files changed, 3 insertions(+), 3 deletions(-) New commits: commit f5c001af5ff4e1a7432f96674ed6ea7ff6b2be5a Author: Boris Egorov Date: Mon Jan 12 23:52:12 2015 +0600 pacmd: add missing 'else' keyword See code above for proper behavior. Issue detected by PVS Studio diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c index 61b87a0..7e49296 100644 --- a/src/utils/pacmd.c +++ b/src/utils/pacmd.c @@ -333,7 +333,7 @@ int main(int argc, char*argv[]) { if (watch_socket->revents & POLLHUP) { ibuf_eof = true; ibuf_length = 0; -} if (watch_socket->revents & POLLOUT) { +} else if (watch_socket->revents & POLLOUT) { ssize_t r; pa_assert(ibuf_length > 0); commit 1931e40b1c5316d119dc2e5d93428a2d0231b15d Author: Boris Egorov Date: Mon Jan 12 23:52:11 2015 +0600 tunnel: use proper value for pa_source_state switch pa_source_state_t can have value PA_SOURCE_INVALID_STATE, not PA_SINK_INVALID_STATE. It happens to be the same here, but it can break sometimes. Issue detected by PVS Studio. diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index bef6ae8..6600219 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -691,7 +691,7 @@ static int source_set_state(pa_source *s, pa_source_state_t state) { case PA_SOURCE_UNLINKED: case PA_SOURCE_INIT: -case PA_SINK_INVALID_STATE: +case PA_SOURCE_INVALID_STATE: ; } commit 3e6ce485f090780f623a879ad6a8dfd85edf53c1 Author: Boris Egorov Date: Mon Jan 12 23:52:10 2015 +0600 alsa-util: fix parenthesis position in err assignment Issue detected by CppCheck and PVS Studio diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index 4131cff..a9469c0 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -443,7 +443,7 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, bool peri snd_pcm_sw_params_alloca(&swparams); -if ((err = snd_pcm_sw_params_current(pcm, swparams) < 0)) { +if ((err = snd_pcm_sw_params_current(pcm, swparams)) < 0) { pa_log_warn("Unable to determine current swparams: %s\n", pa_alsa_strerror(err)); return err; } ___ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
[pulseaudio-commits] 3 commits - src/modules src/pulsecore src/tests
src/modules/echo-cancel/module-echo-cancel.c |6 +++--- src/modules/module-console-kit.c |2 +- src/modules/module-solaris.c |6 +++--- src/pulsecore/log.h |2 +- src/pulsecore/memchunk.c |2 +- src/pulsecore/mix.c |4 ++-- src/pulsecore/pipe.c |2 +- src/tests/flist-test.c |2 +- src/tests/mcalign-test.c |3 +-- 9 files changed, 14 insertions(+), 15 deletions(-) New commits: commit 101092465db158c69720d2ff6789d6b31be656bc Author: Peter Meerwald Date: Sun Nov 9 17:49:54 2014 +0100 core: Replace assert()s with pa_assert()s Signed-off-by: Peter Meerwald diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index c755119..eed4830 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -1559,14 +1559,14 @@ uint32_t pa_echo_canceller_blocksize_power2(unsigned rate, unsigned ms) { unsigned nframes = (rate * ms) / 1000; uint32_t y = 1 << ((8 * sizeof(uint32_t)) - 2); -assert(rate >= 4000); -assert(ms >= 1); +pa_assert(rate >= 4000); +pa_assert(ms >= 1); /* nframes should be a power of 2, round down to nearest power of two */ while (y > nframes) y >>= 1; -assert(y >= 1); +pa_assert(y >= 1); return y; } diff --git a/src/modules/module-console-kit.c b/src/modules/module-console-kit.c index 0fed15f..c8a35d4 100644 --- a/src/modules/module-console-kit.c +++ b/src/modules/module-console-kit.c @@ -240,7 +240,7 @@ static int get_session_list(struct userdata *u) { if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID) break; -assert(at == DBUS_TYPE_OBJECT_PATH); +pa_assert(at == DBUS_TYPE_OBJECT_PATH); dbus_message_iter_get_basic(&sub, &id); add_session(u, id); diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index 4f11000..abde50a 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -495,7 +495,7 @@ static void sink_set_volume(pa_sink *s) { AUDIO_INITINFO(&info); info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM; -assert(info.play.gain <= AUDIO_MAX_GAIN); +pa_assert(info.play.gain <= AUDIO_MAX_GAIN); if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) { if (errno == EINVAL) @@ -530,7 +530,7 @@ static void source_set_volume(pa_source *s) { AUDIO_INITINFO(&info); info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM; -assert(info.play.gain <= AUDIO_MAX_GAIN); +pa_assert(info.play.gain <= AUDIO_MAX_GAIN); if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) { if (errno == EINVAL) @@ -817,7 +817,7 @@ finish: static void sig_callback(pa_mainloop_api *api, pa_signal_event*e, int sig, void *userdata) { struct userdata *u = userdata; -assert(u); +pa_assert(u); pa_log_debug("caught signal"); diff --git a/src/pulsecore/memchunk.c b/src/pulsecore/memchunk.c index 5f8545f..792b4c7 100644 --- a/src/pulsecore/memchunk.c +++ b/src/pulsecore/memchunk.c @@ -111,7 +111,7 @@ pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src) { } bool pa_memchunk_isset(pa_memchunk *chunk) { -assert(chunk); +pa_assert(chunk); return chunk->memblock || diff --git a/src/pulsecore/pipe.c b/src/pulsecore/pipe.c index 4e3c0c3..6ca1626 100644 --- a/src/pulsecore/pipe.c +++ b/src/pulsecore/pipe.c @@ -41,7 +41,7 @@ static int set_block(int fd, int blocking) { int v; -assert(fd >= 0); +pa_assert(fd >= 0); if ((v = fcntl(fd, F_GETFL)) < 0) return -1; diff --git a/src/tests/flist-test.c b/src/tests/flist-test.c index 6915204..d8c227a 100644 --- a/src/tests/flist-test.c +++ b/src/tests/flist-test.c @@ -88,7 +88,7 @@ int main(int argc, char* argv[]) { for (i = 0; i < THREADS_MAX; i++) { threads[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1)); -assert(threads[i]); +pa_assert(threads[i]); } pa_msleep(6); diff --git a/src/tests/mcalign-test.c b/src/tests/mcalign-test.c index 443b4a7..455e18c 100644 --- a/src/tests/mcalign-test.c +++ b/src/tests/mcalign-test.c @@ -21,7 +21,6 @@ #include #endif -#include #include #include #include @@ -56,7 +55,7 @@ int main(int argc, char *argv[]) { c.index = c.length = 0; } -assert(c.index < pa_memblock_get_length(c.memblock)); +pa_assert(c.index < pa_memblock_get_length(c.memblock)); l = pa_memblock_get_length(c.memblock) - c.index; commit 59334021d3c77a4a2c5f79e1fd72870472ddf43c Author: Peter Meerwald Date: Sat Nov
[pulseaudio-commits] 3 commits - src/modules
src/modules/alsa/alsa-mixer.c | 14 +--- src/modules/alsa/alsa-mixer.h |6 - src/modules/alsa/alsa-sink.c|6 - src/modules/alsa/alsa-source.c |6 - src/modules/alsa/alsa-ucm.c |7 -- src/modules/alsa/alsa-util.c| 111 src/modules/alsa/alsa-util.h|7 -- src/modules/alsa/module-alsa-card.c | 50 8 files changed, 120 insertions(+), 87 deletions(-) New commits: commit 300a5e3ed70064c296e09bc4e40531f3257154c5 Author: David Henningsson Date: Mon Sep 1 15:58:22 2014 +0200 alsa: Remove unnecessary hctl handles being passed around Now that we have switched to using the mixer handle only, there is no use for sending hctl handles around. Signed-off-by: David Henningsson diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 6be56fe..8b23d90 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -2657,7 +2657,7 @@ static void path_create_settings(pa_alsa_path *p) { element_create_settings(p->elements, NULL); } -int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, bool ignore_dB) { +int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, bool ignore_dB) { pa_alsa_element *e; pa_alsa_jack *j; double min_dB[PA_CHANNEL_POSITION_MAX], max_dB[PA_CHANNEL_POSITION_MAX]; @@ -3851,7 +3851,6 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, snd_pcm_t *pcm_handle; pa_alsa_path_set *ps; snd_mixer_t *mixer_handle; -snd_hctl_t *hctl_handle; if (direction == PA_ALSA_DIRECTION_OUTPUT) { if (m->output_path_set) @@ -3870,7 +3869,7 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, pa_assert(pcm_handle); -mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL, &hctl_handle); +mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL); if (!mixer_handle) { /* Cannot open mixer, remove all entries */ pa_hashmap_remove_all(ps->paths); @@ -3878,7 +3877,7 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile, } PA_HASHMAP_FOREACH(p, ps->paths, state) { -if (pa_alsa_path_probe(p, mixer_handle, hctl_handle, m->profile_set->ignore_dB) < 0) { +if (pa_alsa_path_probe(p, mixer_handle, m->profile_set->ignore_dB) < 0) { pa_hashmap_remove(ps->paths, p); } } diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h index ff3cb2d..7e6300e 100644 --- a/src/modules/alsa/alsa-mixer.h +++ b/src/modules/alsa/alsa-mixer.h @@ -226,7 +226,7 @@ void pa_alsa_element_dump(pa_alsa_element *e); pa_alsa_path *pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa_direction_t direction); pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t direction); -int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, bool ignore_dB); +int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, bool ignore_dB); void pa_alsa_path_dump(pa_alsa_path *p); int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v); int pa_alsa_path_get_mute(pa_alsa_path *path, snd_mixer_t *m, bool *muted); @@ -335,7 +335,7 @@ void pa_alsa_profile_set_free(pa_alsa_profile_set *s); void pa_alsa_profile_set_dump(pa_alsa_profile_set *s); void pa_alsa_profile_set_drop_unsupported(pa_alsa_profile_set *s); -snd_mixer_t *pa_alsa_open_mixer_for_pcm(snd_pcm_t *pcm, char **ctl_device, snd_hctl_t **hctl); +snd_mixer_t *pa_alsa_open_mixer_for_pcm(snd_pcm_t *pcm, char **ctl_device); pa_alsa_fdlist *pa_alsa_fdlist_new(void); void pa_alsa_fdlist_free(pa_alsa_fdlist *fdl); diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index daa9061..9e9b863 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1886,12 +1886,10 @@ static void set_sink_name(pa_sink_new_data *data, pa_modargs *ma, const char *de } static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, bool ignore_dB) { -snd_hctl_t *hctl; - if (!mapping && !element) return; -if (!(u->mixer_handle = pa_alsa_open_mixer_for_pcm(u->pcm_handle, &u->control_device, &hctl))) { +if (!(u->mixer_handle = pa_alsa_open_mixer_for_pcm(u->pcm_handle, &u->control_device))) { pa_log_info("Failed to find a working mixer device."); return; } @@ -1901,7 +1899,7 @@ static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char if (!(u->mixer_path = pa_alsa_path_synthesize(element, PA_ALSA_DIRECTION_OUTPUT))) goto fail; -if (pa_alsa_path_probe(u->mixer_path, u->mixer_handle, hctl, ignore_dB) < 0) +if (pa_alsa_path_probe(u->mixer_path, u->mixer_handle, ignore_dB) < 0) g
[pulseaudio-commits] 3 commits - src/modules
src/modules/alsa/alsa-mixer.c| 121 +-- src/modules/alsa/alsa-mixer.h|4 src/modules/alsa/mixer/profile-sets/default.conf | 15 ++ 3 files changed, 130 insertions(+), 10 deletions(-) New commits: commit 48edd0a00f455df075efcf1986103e5f507c816f Author: David Henningsson Date: Fri Jul 25 15:16:41 2014 +0200 alsa: Add a multichannel fallback mapping In case all other profiles fail, try this fallback mapping as well. It allows the device to specify the channel count, so it can be used for devices that only supports being opened in multichannel mode. Signed-off-by: David Henningsson diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 9aa28a3..b4f4bbd 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -3859,6 +3859,7 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) { static const struct description_map well_known_descriptions[] = { { "analog-mono",N_("Analog Mono") }, { "analog-stereo", N_("Analog Stereo") }, +{ "multichannel", N_("Multichannel") }, { "analog-surround-21", N_("Analog Surround 2.1") }, { "analog-surround-30", N_("Analog Surround 3.0") }, { "analog-surround-31", N_("Analog Surround 3.1") }, diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf index ebe2324..8b67e33 100644 --- a/src/modules/alsa/mixer/profile-sets/default.conf +++ b/src/modules/alsa/mixer/profile-sets/default.conf @@ -107,7 +107,7 @@ device-strings = hw:%f channel-map = mono paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-desktop-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headset-mic -priority = 1 +priority = 2 [Mapping analog-stereo] device-strings = front:%f hw:%f @@ -165,7 +165,7 @@ direction = output # device name standardized in alsa. device-strings = hw:%f channel-map = aux0,aux1,aux2,aux3 -priority = 1 +priority = 2 direction = input [Mapping iec958-stereo] @@ -452,6 +452,13 @@ channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe priority = 1 direction = output +[Mapping multichannel] +device-strings = hw:%f +channel-map = left,right,rear-left,rear-right +exact-channels = false +fallback = yes +priority = 1 + ; An example for defining multiple-sink profiles #[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo] #description = Foobar commit c15107eaf6045711d799a71204a8f94a1c424182 Author: David Henningsson Date: Fri Jul 25 15:05:45 2014 +0200 alsa: Allow "fallback" configuration for mappings and profiles A fallback mapping or profile will only be considered for probing if all non-fallback profiles fail. If auto-profiles are used, a profile made up of one non-fallback mapping and one fallback mapping will be considered a fallback profile. Signed-off-by: David Henningsson diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 77c3c7e..9aa28a3 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -3611,6 +3611,34 @@ static int mapping_parse_priority(pa_config_parser_state *state) { return 0; } +static int mapping_parse_fallback(pa_config_parser_state *state) { +pa_alsa_profile_set *ps; +pa_alsa_profile *p; +pa_alsa_mapping *m; +int k; + +pa_assert(state); + +ps = state->userdata; + +if ((k = pa_parse_boolean(state->rvalue)) < 0) { +pa_log("[%s:%u] Fallback invalid of '%s'", state->filename, state->lineno, state->section); +return -1; +} + +if ((m = pa_alsa_mapping_get(ps, state->section))) +m->fallback = k; +else if ((p = profile_get(ps, state->section))) +p->fallback_input = p->fallback_output = k; +else { +pa_log("[%s:%u] Section name %s invalid.", state->filename, state->lineno, state->section); +return -1; +} + +return 0; +} + + static int profile_parse_mappings(pa_config_parser_state *state) { pa_alsa_profile_set *ps; pa_alsa_profile *p; @@ -3939,12 +3967,14 @@ static void profile_set_add_auto_pair( p->output_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); pa_idxset_put(p->output_mappings, m, NULL); p->priority += m->priority * 100; +p->fallback_output = m->fallback; } if (n) { p->input_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_com
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/alsa/alsa-sink.c |8 ++-- src/modules/alsa/alsa-source.c |8 ++-- src/pulsecore/sink-input.c |4 +- src/pulsecore/sink.c | 24 +++--- src/pulsecore/sink.h |4 +- src/pulsecore/source-output.c |4 +- src/pulsecore/source.c | 68 +++-- src/pulsecore/source.h |4 +- 8 files changed, 81 insertions(+), 43 deletions(-) New commits: commit 441a5a422cd2ea62aa43e62bbb81369d635e61f9 Author: Tanu Kaskinen Date: Fri Aug 23 13:58:55 2013 +0300 sink, source: Fix error reporting style for rate updates diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index f910d19..6e60646 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1593,7 +1593,7 @@ static bool sink_set_formats(pa_sink *s, pa_idxset *formats) { return true; } -static bool sink_update_rate_cb(pa_sink *s, uint32_t rate) { +static int sink_update_rate_cb(pa_sink *s, uint32_t rate) { struct userdata *u = s->userdata; int i; bool supported = false; @@ -1609,16 +1609,16 @@ static bool sink_update_rate_cb(pa_sink *s, uint32_t rate) { if (!supported) { pa_log_info("Sink does not support sample rate of %d Hz", rate); -return false; +return -1; } if (!PA_SINK_IS_OPENED(s->state)) { pa_log_info("Updating rate for device %s, new rate is %d",u->device_name, rate); u->sink->sample_spec.rate = rate; -return true; +return 0; } -return false; +return -1; } static int process_rewind(struct userdata *u) { diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index faf8965..78125b1 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -1401,7 +1401,7 @@ static void source_update_requested_latency_cb(pa_source *s) { update_sw_params(u); } -static bool source_update_rate_cb(pa_source *s, uint32_t rate) { +static int source_update_rate_cb(pa_source *s, uint32_t rate) { struct userdata *u = s->userdata; int i; bool supported = false; @@ -1417,16 +1417,16 @@ static bool source_update_rate_cb(pa_source *s, uint32_t rate) { if (!supported) { pa_log_info("Source does not support sample rate of %d Hz", rate); -return false; +return -1; } if (!PA_SOURCE_IS_OPENED(s->state)) { pa_log_info("Updating rate for device %s, new rate is %d", u->device_name, rate); u->source->sample_spec.rate = rate; -return true; +return 0; } -return false; +return -1; } static void thread_func(void *userdata) { diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index a275715..b5e8a0b 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -426,7 +426,7 @@ int pa_sink_input_new( module-suspend-on-idle can resume a sink */ pa_log_info("Trying to change sample rate"); -if (pa_sink_update_rate(data->sink, data->sample_spec.rate, pa_sink_input_new_data_is_passthrough(data)) == true) +if (pa_sink_update_rate(data->sink, data->sample_spec.rate, pa_sink_input_new_data_is_passthrough(data)) >= 0) pa_log_info("Rate changed to %u Hz", data->sink->sample_spec.rate); } @@ -1829,7 +1829,7 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, bool save) { SINK_INPUT_MOVE_FINISH hook */ pa_log_info("Trying to change sample rate"); -if (pa_sink_update_rate(dest, i->sample_spec.rate, pa_sink_input_is_passthrough(i)) == true) +if (pa_sink_update_rate(dest, i->sample_spec.rate, pa_sink_input_is_passthrough(i)) >= 0) pa_log_info("Rate changed to %u Hz", dest->sample_spec.rate); } diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index bc8a3fd..de8c82e 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -1377,8 +1377,8 @@ void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result) { } /* Called from main thread */ -bool pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough) { -bool ret = false; +int pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough) { +int ret = -1; uint32_t desired_rate = rate; uint32_t default_rate = s->default_sample_rate; uint32_t alternate_rate = s->alternate_sample_rate; @@ -1387,32 +1387,32 @@ bool pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough) { bool use_alternate = false; if (rate == s->sample_spec.rate) -return true; +return 0; if (!s->update_rate) -return false; +return -1; if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough)) { pa_log_debug("Default and alternate sample rates are the same."); -return false; +return -1; } if (PA_SINK_IS_RUNNING(s->state))
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/module-device-manager.c |4 ++-- src/modules/rtp/rtp.c |2 +- src/pulsecore/core-util.h |9 + 3 files changed, 12 insertions(+), 3 deletions(-) New commits: commit 19a7c6e49b631ac5c19cdabafeb96683b0f93b51 Author: David Henningsson Date: Wed May 22 13:26:24 2013 +0200 rtp: Reset timestamp with correct size if not found This fixes a compiler warning when building under Ubuntu. Signed-off-by: David Henningsson diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c index c094fcf..9195493 100644 --- a/src/modules/rtp/rtp.c +++ b/src/modules/rtp/rtp.c @@ -286,7 +286,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, struct if (!found_tstamp) { pa_log_warn("Couldn't find SCM_TIMESTAMP data in auxiliary recvmsg() data!"); -memset(tstamp, 0, sizeof(tstamp)); +pa_zero(*tstamp); } return 0; commit d396b76934ead9e6f5c3ac7bb6d7d79cd9a7f981 Author: David Henningsson Date: Wed May 22 13:21:24 2013 +0200 module-device-manager: Fix description restore e->description is a pointer, not a fixed char array. Hence it makes no sense to use strncmp. This fixes a compiler warning when compiling under Ubuntu. Signed-off-by: David Henningsson diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c index 207870d..5db5550 100644 --- a/src/modules/module-device-manager.c +++ b/src/modules/module-device-manager.c @@ -889,7 +889,7 @@ static pa_hook_result_t sink_new_hook_callback(pa_core *c, pa_sink_new_data *new name = pa_sprintf_malloc("sink:%s", new_data->name); if ((e = entry_read(u, name))) { -if (e->user_set_description && strncmp(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), sizeof(e->description)) != 0) { +if (e->user_set_description && !pa_safe_streq(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION))) { pa_log_info("Restoring description for sink %s.", new_data->name); pa_proplist_sets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION, e->description); } @@ -913,7 +913,7 @@ static pa_hook_result_t source_new_hook_callback(pa_core *c, pa_source_new_data name = pa_sprintf_malloc("source:%s", new_data->name); if ((e = entry_read(u, name))) { -if (e->user_set_description && strncmp(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), sizeof(e->description)) != 0) { +if (e->user_set_description && !pa_safe_streq(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION))) { /* NB, We cannot detect if we are a monitor here... this could mess things up a bit... */ pa_log_info("Restoring description for source %s.", new_data->name); pa_proplist_sets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION, e->description); commit de5eb70032344c02d3dfe09ff9d830c16bd595f0 Author: David Henningsson Date: Wed May 22 14:08:19 2013 +0200 core-util: Add pa_safe_streq Like pa_streq, but does not blow up on NULL pointers. Signed-off-by: David Henningsson diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h index 15e6809..7b59fbc 100644 --- a/src/pulsecore/core-util.h +++ b/src/pulsecore/core-util.h @@ -208,6 +208,15 @@ void pa_unset_env_recorded(void); pa_bool_t pa_in_system_mode(void); #define pa_streq(a,b) (!strcmp((a),(b))) + +/* Like pa_streq, but does not blow up on NULL pointers. */ +static inline bool pa_safe_streq(const char *a, const char *b) +{ +if (a == NULL || b == NULL) +return a == b; +return pa_streq(a, b); +} + pa_bool_t pa_str_in_list_spaces(const char *needle, const char *haystack); char *pa_get_host_name_malloc(void); ___ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
[pulseaudio-commits] 3 commits - src/modules
src/modules/alsa/mixer/paths/analog-input.conf |1 - src/modules/alsa/mixer/paths/analog-output-headphones.conf |1 - src/modules/alsa/module-alsa-card.c|3 +++ 3 files changed, 3 insertions(+), 2 deletions(-) New commits: commit ca4942e89cf462e5f8c36ca9b8b689879083af6b Author: David Henningsson Date: Tue Apr 16 06:40:40 2013 +0200 alsa-mixer: Switch to Headphone when Headphone mic jack is plugged in When a "Headphone Mic" jack becomes available, we do not know if a headphone or a mic has been plugged in. Therefore, setting both paths to "unknown" is, in theory, the correct thing to do. However, in practice, people are more likely to plug in a headphone rather than a mic. Therefore, allow autoswitch to the headphone port when the jack is plugged in. A more advanced implementation would consider what was plugged in last time depending on what port was selected on the input side at that time, and set availability accordingly. However, such an implementation will have to wait (probably at least until we have our fancy routing system implementation). Buglink: https://bugs.launchpad.net/bugs/1169143 Signed-off-by: David Henningsson diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf b/src/modules/alsa/mixer/paths/analog-output-headphones.conf index 29358e7..76cd01e 100644 --- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf +++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf @@ -44,7 +44,6 @@ state.unplugged = unknown # This jack can be either a headphone *or* a mic. Used on some ASUS netbooks. [Jack Headphone Mic] required-any = any -state.plugged = unknown [Element Hardware Master] switch = mute commit 068a3ec9d4383e92241b72c7d146a42a189473b8 Author: David Henningsson Date: Wed Apr 24 10:59:42 2013 +0200 alsa-mixer: Allow input fallback port for devices with no gain control I recently came across a device without any ALSA-level mixer controls, everything was physical knobs on the hardware. This patch enables that device to get a port too ("Analog Input"). Signed-off-by: David Henningsson diff --git a/src/modules/alsa/mixer/paths/analog-input.conf b/src/modules/alsa/mixer/paths/analog-input.conf index ecacc9c..c8f8e3c 100644 --- a/src/modules/alsa/mixer/paths/analog-input.conf +++ b/src/modules/alsa/mixer/paths/analog-input.conf @@ -23,7 +23,6 @@ priority = 100 [Element Capture] -required = volume switch = mute volume = merge override-map.1 = all commit 2553757922c23068af7e691372ad781a7a0898d1 Author: David Henningsson Date: Tue Apr 16 14:56:35 2013 +0200 alsa: Fix ELD access warning on shutdown The hdmi_eld_changed callback is called by alsa-lib at shutdown. In that case, just exit instead of trying to access something with already closed handles. Signed-off-by: David Henningsson diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index 9b739dc..b37eabc 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -409,6 +409,9 @@ static int hdmi_eld_changed(snd_hctl_elem_t *elem, unsigned int mask) { pa_hdmi_eld eld; bool changed = false; +if (mask == SND_CTL_EVENT_MASK_REMOVE) +return 0; + p = find_port_with_eld_device(u->card->ports, device); if (p == NULL) { pa_log_error("Invalid device changed in ALSA: %d", device); ___ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
[pulseaudio-commits] 3 commits - src/modules
src/modules/alsa/alsa-mixer.c |3 src/modules/alsa/alsa-mixer.h |1 src/modules/alsa/alsa-util.c | 68 src/modules/alsa/alsa-util.h |8 + src/modules/alsa/mixer/paths/analog-output.conf.common |2 src/modules/alsa/mixer/paths/hdmi-output-0.conf|1 src/modules/alsa/mixer/paths/hdmi-output-1.conf|1 src/modules/alsa/mixer/paths/hdmi-output-2.conf|1 src/modules/alsa/mixer/paths/hdmi-output-3.conf|1 src/modules/alsa/module-alsa-card.c| 72 + 10 files changed, 158 insertions(+) New commits: commit fd3a4e588c558432cd213f6337204096fe709320 Author: David Henningsson Date: Tue Feb 19 13:25:49 2013 +0100 alsa-card: Make ELD monitor name a port property If there is a proper monitor name, we expose this as a device.product.name property on the port. This can be useful for UIs who might want to show this name. Signed-off-by: David Henningsson diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index f5e1c9e..3b96cea 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -388,6 +388,77 @@ static int report_jack_state(snd_hctl_elem_t *elem, unsigned int mask) return 0; } +static pa_device_port* find_port_with_eld_device(pa_hashmap *ports, int device) { +void *state; +pa_device_port *p; + +PA_HASHMAP_FOREACH(p, ports, state) { +pa_alsa_port_data *data = PA_DEVICE_PORT_DATA(p); +pa_assert(data->path); +if (device == data->path->eld_device) +return p; +} +return NULL; +} + +static int hdmi_eld_changed(snd_hctl_elem_t *elem, unsigned int mask) { +struct userdata *u = snd_hctl_elem_get_callback_private(elem); +int device = snd_hctl_elem_get_device(elem); +const char *old_monitor_name; +pa_device_port *p; +pa_hdmi_eld eld; +bool changed = false; + +p = find_port_with_eld_device(u->card->ports, device); +if (p == NULL) { +pa_log_error("Invalid device changed in ALSA: %d", device); +return 0; +} + +if (pa_alsa_get_hdmi_eld(u->hctl_handle, device, &eld) < 0) +memset(&eld, 0, sizeof(eld)); + +old_monitor_name = pa_proplist_gets(p->proplist, PA_PROP_DEVICE_PRODUCT_NAME); +if (eld.monitor_name[0] == '\0') { +changed |= old_monitor_name != NULL; +pa_proplist_unset(p->proplist, PA_PROP_DEVICE_PRODUCT_NAME); +} else { +changed |= (old_monitor_name == NULL) || (strcmp(old_monitor_name, eld.monitor_name) != 0); +pa_proplist_sets(p->proplist, PA_PROP_DEVICE_PRODUCT_NAME, eld.monitor_name); +} + +if (changed && mask != 0) +pa_subscription_post(u->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, u->card->index); + +return 0; +} + +static void init_eld_ctls(struct userdata *u) { +void *state; +pa_device_port *port; + +PA_HASHMAP_FOREACH(port, u->card->ports, state) { +pa_alsa_port_data *data = PA_DEVICE_PORT_DATA(port); +snd_hctl_elem_t* hctl_elem; +int device; + +pa_assert(data->path); +device = data->path->eld_device; +if (device < 0) +continue; + +hctl_elem = pa_alsa_find_eld_ctl(u->hctl_handle, device); +if (!hctl_elem) { +pa_log_debug("No ELD device found for port %s.", port->name); +continue; +} + +snd_hctl_elem_set_callback_private(hctl_elem, u); +snd_hctl_elem_set_callback(hctl_elem, hdmi_eld_changed); +hdmi_eld_changed(hctl_elem, 0); +} +} + static void init_jacks(struct userdata *u) { void *state; pa_alsa_path* path; @@ -676,6 +747,7 @@ int pa__init(pa_module *m) { init_profile(u); init_jacks(u); +init_eld_ctls(u); if (reserve) pa_reserve_wrapper_unref(reserve); commit bf487f0ffaeca7474232e5d62a3609344f8835b6 Author: David Henningsson Date: Tue Feb 19 13:25:48 2013 +0100 alsa-mixer: Add possibility to configure ELD device The alsa mixer kcontrol has "device index" 3, 7, 8, and 9. We need to configure this properly. Signed-off-by: David Henningsson diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index f2e68d3..137c9eb 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -2390,6 +2390,7 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa { "description", pa_config_parse_string,NULL, "General" }, { "name",pa_config_parse_string,NULL, "General" }, { "mute-during-activation", pa_config_parse_bool, NULL, "General" }, +{ "eld-device", pa_config_parse_int, NULL, "Gener
[pulseaudio-commits] 3 commits - src/modules
src/modules/echo-cancel/module-echo-cancel.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) New commits: commit 9b6dced2cb2df31cde66bad57cc5a0b45842ca66 Author: Stefan Huber Date: Mon Feb 11 10:56:46 2013 +0100 echo-cancel-test: When fopen() fails tell which file failed diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index db6b46c..9d94a83 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -2103,17 +2103,17 @@ int main(int argc, char* argv[]) { u.captured_file = fopen(argv[2], "rb"); if (u.captured_file == NULL) { -perror ("fopen failed"); +perror ("Could not open capture file"); goto fail; } u.played_file = fopen(argv[1], "rb"); if (u.played_file == NULL) { -perror ("fopen failed"); +perror ("Could not open play file"); goto fail; } u.canceled_file = fopen(argv[3], "wb"); if (u.canceled_file == NULL) { -perror ("fopen failed"); +perror ("Could not open canceled file"); goto fail; } @@ -2156,7 +2156,7 @@ int main(int argc, char* argv[]) { u.drift_file = fopen(argv[5], "rt"); if (u.drift_file == NULL) { -perror ("fopen failed"); +perror ("Could not open drift file"); goto fail; } } commit 7eff884848a3c1d15bc37e1602a78e63fa9cc511 Author: Stefan Huber Date: Mon Feb 11 10:56:45 2013 +0100 echo-cancel-test: Pass aec_args with module args The echo canceller module can pass arguments to the EC implementation via the module parameter aec_args. However, the echo-cancel-test passes EC arguments via a separate argv[] option, which is inconsistent. Fix this. diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 718e104..db6b46c 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -2140,7 +2140,7 @@ int main(int argc, char* argv[]) { goto fail; if (!u.ec->init(u.core, u.ec, &source_ss, &source_map, &sink_ss, &sink_map, &nframes, - (argc > 5) ? argv[5] : NULL )) { + pa_modargs_get_value(ma, "aec_args", NULL))) { pa_log("Failed to init AEC engine"); goto fail; } @@ -2148,12 +2148,12 @@ int main(int argc, char* argv[]) { u.sink_blocksize = nframes * pa_frame_size(&sink_ss); if (u.ec->params.drift_compensation) { -if (argc < 7) { +if (argc < 6) { pa_log("Drift compensation enabled but drift file not specified"); goto fail; } -u.drift_file = fopen(argv[6], "rt"); +u.drift_file = fopen(argv[5], "rt"); if (u.drift_file == NULL) { perror ("fopen failed"); @@ -2254,7 +2254,7 @@ out: return ret; usage: -pa_log("Usage: %s play_file rec_file out_file [module args] [aec_args] [drift_file]", argv[0]); +pa_log("Usage: %s play_file rec_file out_file [module args] [drift_file]", argv[0]); fail: ret = -1; commit 8aa30049ec69f736983398dd038d918df9dc0d78 Author: Stefan Huber Date: Mon Feb 11 10:56:44 2013 +0100 echo-cancel-test: Enable debug log level diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 8ce6330..718e104 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -2092,6 +2092,9 @@ int main(int argc, char* argv[]) { float drift; uint32_t nframes; +if (!getenv("MAKE_CHECK")) +pa_log_set_level(PA_LOG_DEBUG); + pa_memzero(&u, sizeof(u)); if (argc < 4 || argc > 7) { ___ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
[pulseaudio-commits] 3 commits - src/modules
src/modules/bluetooth/bluetooth-util.c | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-) New commits: commit 849161f0865d5a264de3b0073112bb3238e7022c Author: Tanu Kaskinen Date: Thu Jan 31 09:34:55 2013 +0200 bluetooth: Fail if BlueZ tries to give duplicate device addresses. diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index d10eb97..98e795c 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -372,7 +372,11 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo return -1; } -pa_xfree(d->address); +if (d->address) { +pa_log("Device %s: Received a duplicate Address property.", d->path); +return -1; +} + d->address = pa_xstrdup(value); } commit cd23fbf94729a9bb645c7fc784d30d430703f43b Author: Mikel Astiz Date: Tue Jan 29 13:10:12 2013 +0100 bluetooth: Detect changes in constant properties The D-Bus API should guarantee that some properties remain constant and therefore treat changes in such properties as errors. diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 5da557a..d10eb97 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -367,6 +367,11 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, boo pa_xfree(d->alias); d->alias = pa_xstrdup(value); } else if (pa_streq(key, "Address")) { +if (is_property_change) { +pa_log("Device property 'Address' expected to be constant but changed for %s", d->path); +return -1; +} + pa_xfree(d->address); d->address = pa_xstrdup(value); } commit b531422218d736ba0594fce7308d582b6c37c814 Author: Mikel Astiz Date: Tue Jan 29 13:10:11 2013 +0100 bluetooth: Propagate to property parsers if it is initial value Add a parameter so that property parsing functions distinguish the initial case from property changes received later. diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 1a14c9c..5da557a 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -259,7 +259,7 @@ static const char *check_variant_property(DBusMessageIter *i) { return key; } -static int parse_manager_property(pa_bluetooth_discovery *y, DBusMessageIter *i) { +static int parse_manager_property(pa_bluetooth_discovery *y, DBusMessageIter *i, bool is_property_change) { const char *key; DBusMessageIter variant_i; @@ -299,7 +299,7 @@ static int parse_manager_property(pa_bluetooth_discovery *y, DBusMessageIter *i) return 0; } -static int parse_adapter_property(pa_bluetooth_discovery *y, DBusMessageIter *i) { +static int parse_adapter_property(pa_bluetooth_discovery *y, DBusMessageIter *i, bool is_property_change) { const char *key; DBusMessageIter variant_i; @@ -339,7 +339,7 @@ static int parse_adapter_property(pa_bluetooth_discovery *y, DBusMessageIter *i) return 0; } -static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i) { +static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i, bool is_property_change) { const char *key; DBusMessageIter variant_i; @@ -487,7 +487,7 @@ static const char *transport_state_to_string(pa_bluetooth_transport_state_t stat pa_assert_not_reached(); } -static int parse_audio_property(pa_bluetooth_device *d, const char *interface, DBusMessageIter *i) { +static int parse_audio_property(pa_bluetooth_device *d, const char *interface, DBusMessageIter *i, bool is_property_change) { pa_bluetooth_transport *transport; const char *key; DBusMessageIter variant_i; @@ -710,18 +710,18 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) { dbus_message_iter_recurse(&element_i, &dict_i); if (dbus_message_has_interface(p->message, "org.bluez.Manager")) { -if (parse_manager_property(y, &dict_i) < 0) +if (parse_manager_property(y, &dict_i, false) < 0) goto finish; } else if (dbus_message_has_interface(p->message, "org.bluez.Adapter")) { -if (parse_adapter_property(y, &dict_i) < 0) +if (parse_adapter_property(y, &dict_i, false) < 0) goto finish; } else if (dbus_message_has_interface(p->message, "org.bluez.Device")) { -if (parse_device_property(d, &dict_i) < 0) +if (parse_device_property(d, &dict_i, false)
[pulseaudio-commits] 3 commits - src/modules
src/modules/echo-cancel/module-echo-cancel.c | 45 --- 1 file changed, 27 insertions(+), 18 deletions(-) New commits: commit 84e45843220af6479c3e250d0dcfc6904fad007f Author: Stefan Huber Date: Tue Dec 18 13:52:32 2012 +0100 echo-cancel: Fix calc_diff for asymmetric sample specs In case that source and sink use different sample specs (e.g., different number of channels) the computation of the latency difference fails. To fix this, we obtain the corresponding latencies in terms of time using the respective sample specs instead of buffer sizes. Signed-off-by: Stefan Huber Acked-by: Peter Meerwald diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 5c639ae..103aef0 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -294,34 +294,38 @@ enum { }; static int64_t calc_diff(struct userdata *u, struct snapshot *snapshot) { -int64_t buffer, diff_time, buffer_latency; - -/* get the number of samples between capture and playback */ -if (snapshot->plen > snapshot->rlen) -buffer = snapshot->plen - snapshot->rlen; +int64_t diff_time, buffer_latency; +pa_usec_t plen, rlen, source_delay, sink_delay, recv_counter, send_counter; + +/* get latency difference between playback and record */ +plen = pa_bytes_to_usec(snapshot->plen, &u->sink_input->sample_spec); +rlen = pa_bytes_to_usec(snapshot->rlen, &u->source_output->sample_spec); +if (plen > rlen) +buffer_latency = plen - rlen; else -buffer = 0; +buffer_latency = 0; -buffer += snapshot->source_delay + snapshot->sink_delay; +source_delay = pa_bytes_to_usec(snapshot->source_delay, &u->source_output->sample_spec); +sink_delay = pa_bytes_to_usec(snapshot->sink_delay, &u->sink_input->sample_spec); +buffer_latency += source_delay + sink_delay; -/* add the amount of samples not yet transferred to the source context */ -if (snapshot->recv_counter <= snapshot->send_counter) -buffer += (int64_t) (snapshot->send_counter - snapshot->recv_counter); +/* add the latency difference due to samples not yet transferred */ +send_counter = pa_bytes_to_usec(snapshot->send_counter, &u->sink_input->sample_spec); +recv_counter = pa_bytes_to_usec(snapshot->recv_counter, &u->source_output->sample_spec); +if (recv_counter <= send_counter) +buffer_latency += (int64_t) (send_counter - recv_counter); else -buffer += PA_CLIP_SUB(buffer, (int64_t) (snapshot->recv_counter - snapshot->send_counter)); - -/* convert to time */ -buffer_latency = pa_bytes_to_usec(buffer, &u->source_output->sample_spec); +buffer_latency += PA_CLIP_SUB(buffer_latency, (int64_t) (recv_counter - send_counter)); -/* capture and playback samples are perfectly aligned when diff_time is 0 */ +/* capture and playback are perfectly aligned when diff_time is 0 */ diff_time = (snapshot->sink_now + snapshot->sink_latency - buffer_latency) - (snapshot->source_now - snapshot->source_latency); pa_log_debug("Diff %lld (%lld - %lld + %lld) %lld %lld %lld %lld", (long long) diff_time, (long long) snapshot->sink_latency, (long long) buffer_latency, (long long) snapshot->source_latency, -(long long) snapshot->source_delay, (long long) snapshot->sink_delay, -(long long) (snapshot->send_counter - snapshot->recv_counter), +(long long) source_delay, (long long) sink_delay, +(long long) (send_counter - recv_counter), (long long) (snapshot->sink_now - snapshot->source_now)); return diff_time; commit fc9ad93bb4b2a150766f9a4431949fc4ff4a69eb Author: Stefan Huber Date: Tue Dec 18 13:52:31 2012 +0100 echo-cancel: Fix missing setup of sink_ss in echo-cancel-test. In main() of echo-cancel-test it is wrongly assumed that the EC implementation's init() function properly initializes sink_ss. In contrast, pa__init() sets sink_ss by default to sink_master->sample_spec. Fix this by setting sink_ss to default parameters and let EC implementation's init() override these settings. Signed-off-by: Stefan Huber Acked-by: Peter Meerwald diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index f7c7276..5c639ae 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -2104,6 +2104,11 @@ int main(int argc, char* argv[]) { source_ss.channels = DEFAULT_CHANNELS; pa_channel_map_init_auto(&source_map, source_ss.channels, PA_CHANNEL_MAP_DEFAULT); +sink_ss.format = PA_SAMPLE_S16LE; +sink_ss.rate = DEFAULT_RATE; +sink_ss.channels = DEFAULT_CHANNELS; +pa_channel_map_init_auto(&sink_map, sink_ss.channels, PA_CHANNEL_MAP_DEFAULT); + if (in
[pulseaudio-commits] 3 commits - src/modules
src/modules/bluetooth/module-bluetooth-device.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) New commits: commit bbb47c67bb4434d752f2225d7f1744721c6e6054 Author: Mikel Astiz Date: Mon Dec 3 11:03:59 2012 +0100 bluetooth: Request headset audio during profile switch When a headset is having a profile switch, we can either leave the SCO state unmodified (as it was before this patch) or we can alternatively request it (as older versions of PA). This patch tries to avoid a potential regression in case a module such as module-suspend-on-idle is not present, due to the provided resume-on-running policy. Without this patch, and without such a policy, the sink and sources would stay suspended until the user manually performed another profile switch (i.e. hsp->off->hsp). There are several other solutions currently being discussed as a longer term solution, some of which require extendind the core. This patch is therefore proposed as a short-term workaround to avoid the regression. diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index f8315e1..093550e 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1743,7 +1743,7 @@ static int add_sink(struct userdata *u) { switch (u->profile) { case PROFILE_A2DP: case PROFILE_HSP: -data.suspend_cause = PA_SUSPEND_IDLE; +pa_assert_not_reached(); /* Profile switch should have failed */ break; case PROFILE_HFGW: data.suspend_cause = PA_SUSPEND_USER; @@ -1818,7 +1818,7 @@ static int add_source(struct userdata *u) { if (!bt_transport_is_acquired(u)) switch (u->profile) { case PROFILE_HSP: -data.suspend_cause = PA_SUSPEND_IDLE; +pa_assert_not_reached(); /* Profile switch should have failed */ break; case PROFILE_A2DP_SOURCE: case PROFILE_HFGW: @@ -2011,7 +2011,10 @@ static int setup_transport(struct userdata *u) { u->transport_removed_slot = pa_hook_connect(&t->hooks[PA_BLUETOOTH_TRANSPORT_HOOK_REMOVED], PA_HOOK_NORMAL, (pa_hook_cb_t) transport_removed_cb, u); -bt_transport_acquire(u, FALSE); +if (u->profile == PROFILE_A2DP_SOURCE || u->profile == PROFILE_HFGW) +bt_transport_acquire(u, FALSE); /* In case of error, the sink/sources will be created suspended */ +else if (bt_transport_acquire(u, TRUE) < 0) +return -1; /* We need to fail here until the interactions with module-suspend-on-idle and alike get improved */ bt_transport_config(u); commit 01435e613417258f35e406f1ab95042b1c48b832 Author: Mikel Astiz Date: Mon Dec 3 11:03:58 2012 +0100 bluetooth: Do not setup stream before thread starts bt_transport_acquire() might get called from the main thread, in case the IO thread hasn't been started yet. In this case, we should not call setup_stream() since this is going to be called in the beginning of thread_func(). diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 7d89f6c..f8315e1 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -426,6 +426,10 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t start) { return 0; done: +/* If thread is still about to start, the stream will be set up in the beginning of thread_func() */ +if (u->thread == NULL) +return 0; + setup_stream(u); return 0; commit 1dcdb96ee5384d16644271233ff93dbdd2e6c158 Author: Mikel Astiz Date: Mon Dec 3 11:03:57 2012 +0100 bluetooth: Trivially refactor to call setup_stream() directly If the transport is already acquired and the stream needs to be started, call setup_stream() directly instead of bt_transport_acquire(u, TRUE). Both calls are identical in these conditions, with the exception of the log trace which has now been moved to setup_stream(). diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 506a479..7d89f6c 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -284,6 +284,8 @@ static void setup_stream(struct userdata *u) { struct pollfd *pollfd; int one; +pa_log_info("Transport %s resuming", u->transport->path); + bt_transport_config_mtu(u); pa_make_fd_nonblock(u->stream_fd); @@ -424,7 +426,6 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t start) { return 0; done: -pa_log_info("Tran
[pulseaudio-commits] 3 commits - src/modules
src/modules/module-loopback.c | 73 +- 1 file changed, 65 insertions(+), 8 deletions(-) New commits: commit 5412a69cac8af1f052d32c5b968ccf5639366a52 Author: Mikel Astiz Date: Thu Sep 20 14:28:34 2012 +0200 loopback: Disable adjust timer when suspended Stop the rate adjustment timer when no audio is flowing. diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index ad03816..26d2e6a 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -131,6 +131,8 @@ enum { SOURCE_OUTPUT_MESSAGE_LATENCY_SNAPSHOT }; +static void enable_adjust_timer(struct userdata *u, bool enable); + /* Called from main context */ static void teardown(struct userdata *u) { pa_assert(u); @@ -140,10 +142,7 @@ static void teardown(struct userdata *u) { pa_asyncmsgq_flush(u->asyncmsgq, 0); u->adjust_time = 0; -if (u->time_event) { -u->core->mainloop->time_free(u->time_event); -u->time_event = NULL; -} +enable_adjust_timer(u, false); if (u->sink_input) pa_sink_input_unlink(u->sink_input); @@ -236,6 +235,30 @@ static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct tim adjust_rates(u); } +/* Called from main context */ +static void enable_adjust_timer(struct userdata *u, bool enable) { +if (enable) { +if (u->time_event || u->adjust_time <= 0) +return; + +u->time_event = pa_core_rttime_new(u->module->core, pa_rtclock_now() + u->adjust_time, time_callback, u); +} else { +if (!u->time_event) +return; + +u->core->mainloop->time_free(u->time_event); +u->time_event = NULL; +} +} + +/* Called from main context */ +static void update_adjust_timer(struct userdata *u) { +if (u->sink_input->state == PA_SINK_INPUT_CORKED || u->source_output->state == PA_SOURCE_OUTPUT_CORKED) +enable_adjust_timer(u, false); +else +enable_adjust_timer(u, true); +} + /* Called from input thread context */ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) { struct userdata *u; @@ -398,6 +421,8 @@ static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspended) { pa_assert_se(u = o->userdata); pa_sink_input_cork(u->sink_input, suspended); + +update_adjust_timer(u); } /* Called from output thread context */ @@ -540,7 +565,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in pa_assert_ctl_context(); -if (u->adjust_time > 0) +if (u->time_event) adjust_rates(u); return 0; } @@ -664,6 +689,8 @@ static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspended) { pa_assert_se(u = i->userdata); pa_source_output_cork(u->source_output, suspended); + +update_adjust_timer(u); } int pa__init(pa_module *m) { @@ -933,8 +960,7 @@ int pa__init(pa_module *m) { if (pa_sink_get_state(u->sink_input->sink) != PA_SINK_SUSPENDED) pa_source_output_cork(u->source_output, FALSE); -if (u->adjust_time > 0) -u->time_event = pa_core_rttime_new(m->core, pa_rtclock_now() + u->adjust_time, time_callback, u); +update_adjust_timer(u); pa_modargs_free(ma); return 0; commit 6c916697bc2ee87be41d8a3dc5fee12689c63957 Author: Frédéric Dalleau Date: Thu Sep 20 14:28:33 2012 +0200 loopback: Cork source-output if sink is suspended During initialization, the approach avoids having a needless short period of corked state in case the sink is suspended, by always creating the source-output corked and uncorking it immediately afterwards when the sink is not suspended. diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index 25a2ba8..ad03816 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -655,6 +655,17 @@ static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { return dest != u->source_output->source->monitor_of; } +/* Called from main thread */ +static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspended) { +struct userdata *u; + +pa_sink_input_assert_ref(i); +pa_assert_ctl_context(); +pa_assert_se(u = i->userdata); + +pa_source_output_cork(u->source_output, suspended); +} + int pa__init(pa_module *m) { pa_modargs *ma = NULL; struct userdata *u; @@ -817,6 +828,7 @@ int pa__init(pa_module *m) { u->sink_input->update_max_request = sink_input_update_max_request_cb; u->sink_input->may_move_to = sink_input_may_move_to_cb; u->sink_input->moving = sink_input_moving_cb; +u->sink_input->suspend = sink_input_suspend_cb; u->sink_input->userdata = u; pa_sink_input_set_requested_latency(u->sink_input, u->latency/3); @@ -838,6 +850,7 @@ int pa__init(pa_module *m) { pa_so
[pulseaudio-commits] 3 commits - src/modules
src/modules/bluetooth/bluetooth-util.c | 210 - 1 file changed, 104 insertions(+), 106 deletions(-) New commits: commit 57469ce73443c27ab0046962265e398cf6ec2cf0 Author: Mikel Astiz Date: Thu Jul 26 12:36:33 2012 +0200 bluetooth: Remove minor unnecessary check The return value of dbus_message_iter_next() doesn't need to be checked since the while condition will be false anyway (arg type will be DBUS_TYPE_INVALID). diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index bb32ad2..bfe00dc 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -396,8 +396,7 @@ static int parse_device_property(pa_bluetooth_discovery *y, pa_bluetooth_device has_audio = TRUE; } -if (!dbus_message_iter_next(&ai)) -break; +dbus_message_iter_next(&ai); } /* this might eventually be racy if .Audio is not there yet, but the State change will come anyway later, so this call is for cold-detection mostly */ @@ -589,8 +588,7 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) { } } -if (!dbus_message_iter_next(&element_i)) -break; +dbus_message_iter_next(&element_i); } finish: commit ffe723d50670fd1d185f0f11353124baf233ecb5 Author: Mikel Astiz Date: Thu Jul 26 12:36:32 2012 +0200 bluetooth: Replace deprecated ListDevices() The method ListDevices() in org.bluez.Adapter was deprecated in BlueZ 4.61, and is going to be removed in future releases. Instead, a property was introduced for this purpose in BlueZ 4.7. diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index d3557ab..bb32ad2 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -76,6 +76,7 @@ struct pa_bluetooth_discovery { static void get_properties_reply(DBusPendingCall *pending, void *userdata); static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, DBusMessage *m, DBusPendingCallNotifyFunction func, void *call_data); static void found_adapter(pa_bluetooth_discovery *y, const char *path); +static pa_bluetooth_device *found_device(pa_bluetooth_discovery *y, const char* path); pa_bt_audio_state_t pa_bt_audio_state_from_string(const char* value) { pa_assert(value); @@ -250,6 +251,46 @@ static int parse_manager_property(pa_bluetooth_discovery *y, DBusMessageIter *i) return 0; } +static int parse_adapter_property(pa_bluetooth_discovery *y, DBusMessageIter *i) { +const char *key; +DBusMessageIter variant_i; + +pa_assert(y); + +key = check_variant_property(i); +if (key == NULL) +return -1; + +dbus_message_iter_recurse(i, &variant_i); + +switch (dbus_message_iter_get_arg_type(&variant_i)) { + +case DBUS_TYPE_ARRAY: { + +DBusMessageIter ai; +dbus_message_iter_recurse(&variant_i, &ai); + +if (dbus_message_iter_get_arg_type(&ai) == DBUS_TYPE_OBJECT_PATH && +pa_streq(key, "Devices")) { + +while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) { +const char *value; + +dbus_message_iter_get_basic(&ai, &value); + +found_device(y, value); + +dbus_message_iter_next(&ai); +} +} + +break; +} +} + +return 0; +} + static int parse_device_property(pa_bluetooth_discovery *y, pa_bluetooth_device *d, DBusMessageIter *i) { const char *key; DBusMessageIter variant_i; @@ -471,7 +512,8 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) { /* We don't use p->call_data here right-away since the device * might already be invalidated at this point */ -if (dbus_message_has_interface(p->message, "org.bluez.Manager")) +if (dbus_message_has_interface(p->message, "org.bluez.Manager") || +dbus_message_has_interface(p->message, "org.bluez.Adapter")) d = NULL; else d = pa_hashmap_get(y->devices, dbus_message_get_path(p->message)); @@ -516,6 +558,10 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) { if (parse_manager_property(y, &dict_i) < 0) goto finish; +} else if (dbus_message_has_interface(p->message, "org.bluez.Adapter")) { +if (parse_adapter_property(y, &dict_i) < 0) +goto finish; + } else if (dbus_message_has_interface(p->message, "org.bluez.Device")) { if (parse_device_property(y, d, &dict_i) < 0) goto finish; @@ -615,53 +661,6 @@ finish: pa_xfree(endpoint); }
[pulseaudio-commits] 3 commits - src/modules
src/modules/bluetooth/module-bluetooth-device.c | 74 +- src/modules/bluetooth/module-bluetooth-discover.c |5 - 2 files changed, 47 insertions(+), 32 deletions(-) New commits: commit 00cc8af99551177d0e44545c5364924110748632 Author: Mikel Astiz Date: Fri Jul 27 16:41:22 2012 +0200 bluetooth: Avoid duplicating profile argument twice The module module-bluetooth-device should never be given parameter 'profile' twice, even if both HFGW and A2DP are playing. This patch proposed to consider HFGW first. diff --git a/src/modules/bluetooth/module-bluetooth-discover.c b/src/modules/bluetooth/module-bluetooth-discover.c index e96a4f3..d4e056e 100644 --- a/src/modules/bluetooth/module-bluetooth-discover.c +++ b/src/modules/bluetooth/module-bluetooth-discover.c @@ -107,11 +107,10 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const args = tmp; } -if (d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED) -args = pa_sprintf_malloc("%s profile=\"a2dp_source\" auto_connect=no", args); - if (d->hfgw_state >= PA_BT_AUDIO_STATE_CONNECTED) args = pa_sprintf_malloc("%s profile=\"hfgw\"", args); +else if (d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED) +args = pa_sprintf_malloc("%s profile=\"a2dp_source\" auto_connect=no", args); pa_log_debug("Loading module-bluetooth-device %s", args); m = pa_module_load(u->module->core, "module-bluetooth-device", args); commit 5c7672f79ebe1a2439a5befc1a48fc2effcd6395 Author: Mikel Astiz Date: Fri Jul 27 16:41:21 2012 +0200 bluetooth: Consider different input and output MTU Previous implementation assumes these values are equal, but this doesn't necessarily have to be so. diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index 95cde7b..19d62a6 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -171,8 +171,11 @@ struct userdata { int stream_fd; -size_t link_mtu; -size_t block_size; +size_t read_link_mtu; +size_t read_block_size; + +size_t write_link_mtu; +size_t write_block_size; struct a2dp_info a2dp; struct hsp_info hsp; @@ -226,13 +229,17 @@ static void a2dp_set_bitpool(struct userdata *u, uint8_t bitpool) pa_log_debug("Bitpool has changed to %u", a2dp->sbc.bitpool); -u->block_size = -(u->link_mtu - sizeof(struct rtp_header) - sizeof(struct rtp_payload)) +u->read_block_size = +(u->read_link_mtu - sizeof(struct rtp_header) - sizeof(struct rtp_payload)) +/ a2dp->frame_length * a2dp->codesize; + +u->write_block_size = +(u->write_link_mtu - sizeof(struct rtp_header) - sizeof(struct rtp_payload)) / a2dp->frame_length * a2dp->codesize; -pa_sink_set_max_request_within_thread(u->sink, u->block_size); +pa_sink_set_max_request_within_thread(u->sink, u->write_block_size); pa_sink_set_fixed_latency_within_thread(u->sink, -FIXED_LATENCY_PLAYBACK_A2DP + pa_bytes_to_usec(u->block_size, &u->sample_spec)); +FIXED_LATENCY_PLAYBACK_A2DP + pa_bytes_to_usec(u->write_block_size, &u->sample_spec)); } /* from IO thread, except in SCO over PCM */ @@ -327,8 +334,7 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t start) { return -1; } -/* FIXME: Handle in/out MTU properly when unix socket is not longer supported */ -u->stream_fd = pa_bluetooth_transport_acquire(t, accesstype, NULL, &u->link_mtu); +u->stream_fd = pa_bluetooth_transport_acquire(t, accesstype, &u->read_link_mtu, &u->write_link_mtu); if (u->stream_fd < 0) return -1; @@ -395,7 +401,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse pa_usec_t wi, ri; ri = pa_smoother_get(u->read_smoother, pa_rtclock_now()); -wi = pa_bytes_to_usec(u->write_index + u->block_size, &u->sample_spec); +wi = pa_bytes_to_usec(u->write_index + u->write_block_size, &u->sample_spec); *((pa_usec_t*) data) = wi > ri ? wi - ri : 0; } else { @@ -514,9 +520,9 @@ static int hsp_process_render(struct userdata *u) { /* First, render some data */ if (!u->write_memchunk.memblock) -pa_sink_render_full(u->sink, u->block_size, &u->write_memchunk); +pa_sink_render_full(u->sink, u->write_block_size, &u->write_memchunk); -pa_assert(u->write_memchunk.length == u->block_size); +pa_assert(u->write_memchunk.length == u->write_block_size); for (;;) { ssize_t l; @@ -578,7 +584,7 @@ static int hsp_process_push(struct userdata *u) { pa_assert(u->source); pa_assert(u->read_smoother); -memchunk.memblock =
[pulseaudio-commits] 3 commits - src/modules
src/modules/alsa/alsa-mixer.c | 37 - src/modules/alsa/alsa-mixer.h |4 - src/modules/alsa/alsa-sink.c | 14 +- src/modules/alsa/alsa-source.c | 15 +- src/modules/alsa/mixer/paths/analog-output.conf.common |3 + 5 files changed, 46 insertions(+), 27 deletions(-) New commits: commit 079569753e245393c3ce9ea8923a60fcd9799d34 Author: Jarkko Nikula Date: Thu Mar 22 11:29:12 2012 +0200 alsa: Merge pa_alsa_setting_select with pa_alsa_path_select As these functions are called together and are related, we might merge them and call setting_select from pa_alsa_path_select by passing optional pa_alsa_setting argument. Make also the setting_select static as it is not called outside of alsa-mixer.c after this change. [Additional note from Tanu Kaskinen: this change improves the mute-during-activation feature, because now the mixer changes related to selecting the setting happen while the hw is muted.] diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index 8423636..b46508c 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -50,6 +50,8 @@ #include "alsa-mixer.h" #include "alsa-util.h" +static int setting_select(pa_alsa_setting *s, snd_mixer_t *m); + struct description_map { const char *name; const char *description; @@ -1196,7 +1198,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { return r; } -int pa_alsa_path_select(pa_alsa_path *p, snd_mixer_t *m, bool device_is_muted) { +int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, bool device_is_muted) { pa_alsa_element *e; int r = 0; @@ -1257,6 +1259,9 @@ int pa_alsa_path_select(pa_alsa_path *p, snd_mixer_t *m, bool device_is_muted) { return -1; } +if (s) +setting_select(s, m); + /* Finally restore hw mute to the device mute status. */ if (p->mute_during_activation) { PA_LLIST_FOREACH(e, p->elements) { @@ -2228,7 +2233,7 @@ static int element_set_option(pa_alsa_element *e, snd_mixer_t *m, int alsa_idx) return r; } -int pa_alsa_setting_select(pa_alsa_setting *s, snd_mixer_t *m) { +static int setting_select(pa_alsa_setting *s, snd_mixer_t *m) { pa_alsa_option *o; uint32_t idx; diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h index 6fe9c32..ef2a02f 100644 --- a/src/modules/alsa/alsa-mixer.h +++ b/src/modules/alsa/alsa-mixer.h @@ -215,7 +215,6 @@ struct pa_alsa_path_set { pa_alsa_direction_t direction; }; -int pa_alsa_setting_select(pa_alsa_setting *s, snd_mixer_t *m); void pa_alsa_setting_dump(pa_alsa_setting *s); void pa_alsa_option_dump(pa_alsa_option *o); @@ -230,7 +229,7 @@ int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_ma int pa_alsa_path_get_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t *muted); int pa_alsa_path_set_volume(pa_alsa_path *path, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw); int pa_alsa_path_set_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t muted); -int pa_alsa_path_select(pa_alsa_path *p, snd_mixer_t *m, bool device_is_muted); +int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, bool device_is_muted); void pa_alsa_path_set_callback(pa_alsa_path *p, snd_mixer_t *m, snd_mixer_elem_callback_t cb, void *userdata); void pa_alsa_path_free(pa_alsa_path *p); diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 5fe397c..fcd2b0b 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1461,10 +1461,7 @@ static int sink_set_port_cb(pa_sink *s, pa_device_port *p) { data = PA_DEVICE_PORT_DATA(p); pa_assert_se(u->mixer_path = data->path); -pa_alsa_path_select(u->mixer_path, u->mixer_handle, s->muted); - -if (data->setting) -pa_alsa_setting_select(data->setting, u->mixer_handle); +pa_alsa_path_select(u->mixer_path, data->setting, u->mixer_handle, s->muted); mixer_volume_init(u); @@ -1905,10 +1902,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { data = PA_DEVICE_PORT_DATA(u->sink->active_port); u->mixer_path = data->path; -pa_alsa_path_select(data->path, u->mixer_handle, u->sink->muted); - -if (data->setting) -pa_alsa_setting_select(data->setting, u->mixer_handle); +pa_alsa_path_select(data->path, data->setting, u->mixer_handle, u->sink->muted); } else { @@ -1918,10 +1912,8 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { if (u->mixer_path) { /* Hmm, we have only a single path, then let's activate it */ -pa_alsa_path_select(u->mixer_path, u->mixer_han
[pulseaudio-commits] 3 commits - src/modules
src/modules/echo-cancel/module-echo-cancel.c | 167 ++- 1 file changed, 88 insertions(+), 79 deletions(-) New commits: commit a0879ac3f690190ff7d2825d255d093a8742242d Author: Tanu Kaskinen Date: Wed Apr 25 11:25:16 2012 +0300 echo-cancel: Clarify function call contexts. diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 297f19e..4510277 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -500,7 +500,7 @@ static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) { return 0; } -/* Called from I/O thread context */ +/* Called from source I/O thread context */ static void source_update_requested_latency_cb(pa_source *s) { struct userdata *u; @@ -519,7 +519,7 @@ static void source_update_requested_latency_cb(pa_source *s) { pa_source_get_requested_latency_within_thread(s)); } -/* Called from I/O thread context */ +/* Called from sink I/O thread context */ static void sink_update_requested_latency_cb(pa_sink *s) { struct userdata *u; @@ -538,7 +538,7 @@ static void sink_update_requested_latency_cb(pa_sink *s) { pa_sink_get_requested_latency_within_thread(s)); } -/* Called from I/O thread context */ +/* Called from sink I/O thread context */ static void sink_request_rewind_cb(pa_sink *s) { struct userdata *u; @@ -584,6 +584,7 @@ static void sink_set_volume_cb(pa_sink *s) { pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); } +/* Called from main context. */ static void source_get_volume_cb(pa_source *s) { struct userdata *u; pa_cvolume v; @@ -647,7 +648,7 @@ static void source_get_mute_cb(pa_source *s) { pa_source_output_get_mute(u->source_output); } -/* must be called from the input thread context */ +/* Called from source I/O thread context. */ static void apply_diff_time(struct userdata *u, int64_t diff_time) { int64_t diff; @@ -676,7 +677,7 @@ static void apply_diff_time(struct userdata *u, int64_t diff_time) { } } -/* must be called from the input thread */ +/* Called from source I/O thread context. */ static void do_resync(struct userdata *u) { int64_t diff_time; struct snapshot latency_snapshot; @@ -699,6 +700,8 @@ static void do_resync(struct userdata *u) { * 3. Push out capture samples in blocksize chunks * 4. ??? * 5. Profit + * + * Called from source I/O thread context. */ static void do_push_drift_comp(struct userdata *u) { size_t rlen, plen; @@ -792,7 +795,9 @@ static void do_push_drift_comp(struct userdata *u) { /* This one's simpler than the drift compensation case -- we just iterate over * the capture buffer, and pass the canceller blocksize bytes of playback and - * capture data. */ + * capture data. + * + * Called from source I/O thread context. */ static void do_push(struct userdata *u) { size_t rlen, plen; pa_memchunk rchunk, pchunk, cchunk; @@ -860,7 +865,7 @@ static void do_push(struct userdata *u) { } } -/* Called from input thread context */ +/* Called from source I/O thread context. */ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) { struct userdata *u; size_t rlen, plen, to_skip; @@ -944,7 +949,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) do_push(u); } -/* Called from I/O thread context */ +/* Called from sink I/O thread context. */ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk) { struct userdata *u; @@ -971,7 +976,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk return 0; } -/* Called from input thread context */ +/* Called from source I/O thread context. */ static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes) { struct userdata *u; @@ -991,7 +996,7 @@ static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes) (long long) pa_memblockq_get_length (u->source_memblockq)); } -/* Called from I/O thread context */ +/* Called from sink I/O thread context. */ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { struct userdata *u; @@ -1006,6 +1011,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { u->send_counter -= nbytes; } +/* Called from source I/O thread context. */ static void source_output_snapshot_within_thread(struct userdata *u, struct snapshot *snapshot) { size_t delay, rlen, plen; pa_usec_t now, latency; @@ -1026,8 +1032,7 @@ static void source_output_snapshot_within_thread(struct userdata *u, struct snap snapshot->plen = plen + u->source_skip; } - -/* Called from output thread context */ +/* Called from source I/O thread context. */ static int source_output_process_msg_cb(pa_msgobject *obj, i
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/alsa/mixer/profile-sets/maudio-fasttrack-pro.conf |4 +- src/modules/jack/module-jack-sink.c |9 - src/modules/jack/module-jack-source.c |9 - src/pulsecore/sink-input.c| 17 ++ src/pulsecore/source-output.c | 17 ++ 5 files changed, 53 insertions(+), 3 deletions(-) New commits: commit b7fab75fdde21569ef0be4c7c52887031393d75c Author: David Henningsson Date: Fri Mar 23 13:06:27 2012 +0100 sink-input/source-output: Prevent filter sink/source cycles Misbehaving clients can try to set a filter sink to output to itself, leading to crashes later on. This patch protects us from that. Thanks to Roman Beslik for testing and finding an error in the first version of this patch. Tested-by: Roman Beslik BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=44397 Signed-off-by: David Henningsson diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index b8412bd..f6f7324 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -1383,6 +1383,17 @@ pa_bool_t pa_sink_input_may_move(pa_sink_input *i) { return TRUE; } +static pa_bool_t find_filter_sink_input(pa_sink_input *target, pa_sink *s) { +int i = 0; +while (s && s->input_to_master) { +if (s->input_to_master == target) +return TRUE; +s = s->input_to_master->sink; +pa_assert(i++ < 100); +} +return FALSE; +} + /* Called from main context */ pa_bool_t pa_sink_input_may_move_to(pa_sink_input *i, pa_sink *dest) { pa_sink_input_assert_ref(i); @@ -1396,6 +1407,12 @@ pa_bool_t pa_sink_input_may_move_to(pa_sink_input *i, pa_sink *dest) { if (!pa_sink_input_may_move(i)) return FALSE; +/* Make sure we're not creating a filter sink cycle */ +if (find_filter_sink_input(i, dest)) { +pa_log_debug("Can't connect input to %s, as that would create a cycle.", dest->name); +return FALSE; +} + if (pa_idxset_size(dest->inputs) >= PA_MAX_INPUTS_PER_SINK) { pa_log_warn("Failed to move sink input: too many inputs per sink."); return FALSE; diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index fbfea9c..cd7981c 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -1160,6 +1160,17 @@ pa_bool_t pa_source_output_may_move(pa_source_output *o) { return TRUE; } +static pa_bool_t find_filter_source_output(pa_source_output *target, pa_source *s) { +int i = 0; +while (s && s->output_from_master) { +if (s->output_from_master == target) +return TRUE; +s = s->output_from_master->source; +pa_assert(i++ < 100); +} +return FALSE; +} + /* Called from main context */ pa_bool_t pa_source_output_may_move_to(pa_source_output *o, pa_source *dest) { pa_source_output_assert_ref(o); @@ -1172,6 +1183,12 @@ pa_bool_t pa_source_output_may_move_to(pa_source_output *o, pa_source *dest) { if (!pa_source_output_may_move(o)) return FALSE; +/* Make sure we're not creating a filter source cycle */ +if (find_filter_source_output(o, dest)) { +pa_log_debug("Can't connect output to %s, as that would create a cycle.", dest->name); +return FALSE; +} + if (pa_idxset_size(dest->outputs) >= PA_MAX_OUTPUTS_PER_SOURCE) { pa_log_warn("Failed to move source output: too many outputs per source."); return FALSE; commit 311654766207b3776e2618ae63ac35115db48bbd Author: Maarten Lankhorst Date: Mon Mar 26 23:12:24 2012 +0200 module-jack-sink/source: Set fixed latency correctly on creation Changes since v1: Use max value of jack_port_get_latency_range to calculate the latency and squash compiler warnings cased by using jack_port_get_total_latency Modifying latency only works inside a callback, and for hardware the latency is generally fixed on jack, so just take the max value. Signed-off-by: Maarten Lankhorst diff --git a/src/modules/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c index ba4ea95..017fbf6 100644 --- a/src/modules/jack/module-jack-sink.c +++ b/src/modules/jack/module-jack-sink.c @@ -168,10 +168,12 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse case PA_SINK_MESSAGE_GET_LATENCY: { jack_nframes_t l, ft, d; +jack_latency_range_t r; size_t n; /* This is the "worst-case" latency */ -l = jack_port_get_total_latency(u->client, u->port[0]) + u->frames_in_buffer; +jack_port_get_latency_range(u->port[0], JackPlaybackLatency, &r); +l = r.max + u->frames_in_buffer; if (u->saved_frame_time_valid) { /* Adjust the worst case latency by the
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/alsa/alsa-util.c |4 ++-- src/pulsecore/cpu-arm.h |2 +- src/pulsecore/svolume_arm.c |2 +- src/pulsecore/svolume_mmx.c |2 +- src/pulsecore/svolume_orc.c |2 +- src/pulsecore/svolume_sse.c |2 +- 6 files changed, 7 insertions(+), 7 deletions(-) New commits: commit d103f3a97a151682a1c4c1257e32d4affb4c162e Author: Peter Meerwald Date: Thu Jan 12 17:20:05 2012 +0100 core: svolume tests should generate realistic random volume data assuming RAND_MAX is around 1<<31, rand() >> 1 generates large numbers as random volume data; these likely causes saturated sample values after applying the volume function -- not a good test diff --git a/src/pulsecore/svolume_arm.c b/src/pulsecore/svolume_arm.c index 455d746..f938e57 100644 --- a/src/pulsecore/svolume_arm.c +++ b/src/pulsecore/svolume_arm.c @@ -151,7 +151,7 @@ static void run_test(void) { memcpy(samples_orig, samples, sizeof(samples)); for (i = 0; i < CHANNELS; i++) -volumes[i] = PA_CLAMP_VOLUME(rand() >> 1); +volumes[i] = PA_CLAMP_VOLUME(rand() >> 15); for (padding = 0; padding < PADDING; padding++, i++) volumes[i] = volumes[padding]; diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c index 43c1058..f9fc175 100644 --- a/src/pulsecore/svolume_mmx.c +++ b/src/pulsecore/svolume_mmx.c @@ -272,7 +272,7 @@ static void run_test(void) { memcpy(samples_orig, samples, sizeof(samples)); for (i = 0; i < CHANNELS; i++) -volumes[i] = PA_CLAMP_VOLUME(rand() >> 1); +volumes[i] = PA_CLAMP_VOLUME(rand() >> 15); /* volumes[i] = 0x; */ for (padding = 0; padding < PADDING; padding++, i++) volumes[i] = volumes[padding]; diff --git a/src/pulsecore/svolume_orc.c b/src/pulsecore/svolume_orc.c index 86f843e..b178bbf 100644 --- a/src/pulsecore/svolume_orc.c +++ b/src/pulsecore/svolume_orc.c @@ -75,7 +75,7 @@ static void run_test(void) { memcpy(samples_orig, samples, sizeof(samples)); for (i = 0; i < CHANNELS; i++) -volumes[i] = PA_CLAMP_VOLUME(rand() >> 1); +volumes[i] = PA_CLAMP_VOLUME(rand() >> 15); for (padding = 0; padding < PADDING; padding++, i++) volumes[i] = volumes[padding]; diff --git a/src/pulsecore/svolume_sse.c b/src/pulsecore/svolume_sse.c index 89414c6..fe08de4 100644 --- a/src/pulsecore/svolume_sse.c +++ b/src/pulsecore/svolume_sse.c @@ -282,7 +282,7 @@ static void run_test(void) { memcpy(samples_orig, samples, sizeof(samples)); for (i = 0; i < CHANNELS; i++) -volumes[i] = PA_CLAMP_VOLUME(rand() >> 1); +volumes[i] = PA_CLAMP_VOLUME(rand() >> 15); for (padding = 0; padding < PADDING; padding++, i++) volumes[i] = volumes[padding]; commit ee3e93c84106c61c33d15476a8847619f358a372 Author: Peter Meerwald Date: Thu Jan 12 17:20:04 2012 +0100 core: whitespace typo diff --git a/src/pulsecore/cpu-arm.h b/src/pulsecore/cpu-arm.h index 0e0c3e4..f0f49ef 100644 --- a/src/pulsecore/cpu-arm.h +++ b/src/pulsecore/cpu-arm.h @@ -35,7 +35,7 @@ typedef enum pa_cpu_arm_flag { PA_CPU_ARM_VFPV3= (1 << 5) } pa_cpu_arm_flag_t; -pa_bool_t pa_cpu_init_arm (pa_cpu_arm_flag_t *flags); +pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags); /* some optimized functions */ void pa_volume_func_init_arm(pa_cpu_arm_flag_t flags); commit db8fa449e48cbaff053f335fdfa733400615c4b0 Author: Peter Meerwald Date: Thu Jan 12 17:20:03 2012 +0100 alsa: fix comment diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index c30a722..d961fbc 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -310,8 +310,8 @@ int pa_alsa_set_hw_params( pa_log_debug("Maximum hw buffer size is %lu ms", (long unsigned) (max_frames * PA_MSEC_PER_SEC / _ss.rate)); /* Some ALSA drivers really don't like if we set the buffer - * size first and the number of periods second. (which would - * make a lot more sense to me) So, try a few combinations + * size first and the number of periods second (which would + * make a lot more sense to me). So, try a few combinations * before we give up. */ if (_buffer_size > 0 && _period_size > 0) { ___ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/bluetooth/module-bluetooth-proximity.c | 12 ++-- src/pulsecore/dbus-util.c | 16 +++- 2 files changed, 9 insertions(+), 19 deletions(-) New commits: commit 54ca23df6fb27b0874f72d8c747d8674c1028fb2 Author: Tanu Kaskinen Date: Sun Jan 1 19:44:28 2012 +0200 bluetooth: Change function name add_matches to update_matches. A function that is used for removing matches should not be called add_matches. diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c index 9ba3fd8..3247017 100644 --- a/src/modules/bluetooth/module-bluetooth-proximity.c +++ b/src/modules/bluetooth/module-bluetooth-proximity.c @@ -325,7 +325,7 @@ finish: return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static int add_matches(struct userdata *u, pa_bool_t add) { +static int update_matches(struct userdata *u, pa_bool_t add) { char *filter1, *filter2; DBusError e; int r = -1; @@ -401,7 +401,7 @@ int pa__init(pa_module*m) { goto fail; } -if (add_matches(u, TRUE) < 0) +if (update_matches(u, TRUE) < 0) goto fail; pa_assert_se(msg = dbus_message_new_method_call("org.bluez", u->hci_path, "org.bluez.Adapter", "ListBondings")); @@ -476,7 +476,7 @@ void pa__done(pa_module*m) { } if (u->dbus_connection) { -add_matches(u, FALSE); +update_matches(u, FALSE); pa_dbus_connection_unref(u->dbus_connection); } commit 8846239be730b3f99c982b54a4171b20e68bcc00 Author: Tanu Kaskinen Date: Sun Jan 1 19:44:27 2012 +0200 bluetooth: Remove the right match in the proximity module. The original intention of this code was probably that if adding filter1 succeeded but adding filter2 failed, then filter1 should be removed so that either both or none of the filters get added. diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c index 7560f5a..9ba3fd8 100644 --- a/src/modules/bluetooth/module-bluetooth-proximity.c +++ b/src/modules/bluetooth/module-bluetooth-proximity.c @@ -352,7 +352,7 @@ static int add_matches(struct userdata *u, pa_bool_t add) { if (dbus_error_is_set(&e)) { pa_log("dbus_bus_add_match(%s) failed: %s", filter2, e.message); -dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, NULL); +dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter1, NULL); goto finish; } } else commit 7e4eef2179f93fa99c110da65b497fec5996df2d Author: Tanu Kaskinen Date: Sun Jan 1 19:44:26 2012 +0200 dbus: Give NULL as the error parameter to dbus_bus_remove_match(). We didn't do anything anyway in case of failures. When we give NULL as the error, dbus_bus_remove_match() can act asynchronously, so it becomes faster. Also, the bus daemon can avoid sending any replies, which reduces the amount of traffic. diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c index 8c3a5b9..7560f5a 100644 --- a/src/modules/bluetooth/module-bluetooth-proximity.c +++ b/src/modules/bluetooth/module-bluetooth-proximity.c @@ -344,7 +344,7 @@ static int add_matches(struct userdata *u, pa_bool_t add) { goto finish; } } else -dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter1, &e); +dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter1, NULL); if (add) { @@ -352,11 +352,11 @@ static int add_matches(struct userdata *u, pa_bool_t add) { if (dbus_error_is_set(&e)) { pa_log("dbus_bus_add_match(%s) failed: %s", filter2, e.message); -dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, &e); +dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, NULL); goto finish; } } else -dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, &e); +dbus_bus_remove_match(pa_dbus_connection_get(u->dbus_connection), filter2, NULL); if (add) { pa_assert_se(dbus_connection_add_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u, NULL)); diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c index 3daf90f..adffa88 100644 --- a/src/pulsecore/dbus-util.c +++ b/src/pulsecore/dbus-util.c @@ -367,13 +367,8 @@ fail: va_end(ap); va_start(ap, error); for (; k > 0; k--) { -DBusError e; - pa_assert_se(t = va_arg(ap, const char*)); - -dbus_error_init(&e); -dbus_bus_remove_match(c, t, &e); -dbus_error_free(&e); +dbus_bus_remove_match(c, t, NULL); } va_end(ap); @@ -383,17 +378,12 @@ fail: void pa_dbus_remove_matches(DBusConnection
[pulseaudio-commits] 3 commits - src/modules src/pulse src/pulsecore
src/modules/bluetooth/bluetooth-util.c | 11 --- src/pulse/def.h|4 ++-- src/pulsecore/dbus-util.c | 14 ++ src/pulsecore/dbus-util.h |8 4 files changed, 28 insertions(+), 9 deletions(-) New commits: commit 717701aa7135d0c1bc60e74a70e756d7bc0ef5ef Author: Tanu Kaskinen Date: Tue Dec 13 21:57:03 2011 +0200 bluetooth: When receiving D-Bus errors, print also the error message. diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index c5befe3..15c544e 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -438,10 +438,7 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) { } if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) { - -if (!dbus_message_is_error(r, DBUS_ERROR_UNKNOWN_METHOD)) -pa_log("Error from GetProperties reply: %s", dbus_message_get_error_name(r)); - +pa_log("%s.GetProperties() failed: %s: %s", dbus_message_get_interface(p->message), dbus_message_get_error_name(r), pa_dbus_get_error_message(r)); goto finish; } @@ -548,7 +545,7 @@ static void register_endpoint_reply(DBusPendingCall *pending, void *userdata) { } if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) { -pa_log("Error from RegisterEndpoint reply: %s", dbus_message_get_error_name(r)); +pa_log("org.bluez.Media.RegisterEndpoint() failed: %s: %s", dbus_message_get_error_name(r), pa_dbus_get_error_message(r)); goto finish; } @@ -584,7 +581,7 @@ static void list_devices_reply(DBusPendingCall *pending, void *userdata) { } if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) { -pa_log("Error from ListDevices reply: %s", dbus_message_get_error_name(r)); +pa_log("org.bluez.Adapter.ListDevices() failed: %s: %s", dbus_message_get_error_name(r), pa_dbus_get_error_message(r)); goto finish; } @@ -689,7 +686,7 @@ static void list_adapters_reply(DBusPendingCall *pending, void *userdata) { } if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) { -pa_log("Error from ListAdapters reply: %s", dbus_message_get_error_name(r)); +pa_log("org.bluez.Manager.ListAdapters() failed: %s: %s", dbus_message_get_error_name(r), pa_dbus_get_error_message(r)); goto finish; } commit bec34c428cca88e6afed134c070b6f1916d394ab Author: Tanu Kaskinen Date: Tue Dec 13 21:57:02 2011 +0200 dbus: New helper function: pa_dbus_get_error_message(). diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c index b79b752..3daf90f 100644 --- a/src/pulsecore/dbus-util.c +++ b/src/pulsecore/dbus-util.c @@ -452,6 +452,20 @@ void pa_dbus_free_pending_list(pa_dbus_pending **p) { } } +const char *pa_dbus_get_error_message(DBusMessage *m) { +const char *message; + +pa_assert(m); +pa_assert(dbus_message_get_type(m) == DBUS_MESSAGE_TYPE_ERROR); + +if (dbus_message_get_signature(m)[0] != 's') +return ""; + +pa_assert_se(dbus_message_get_args(m, NULL, DBUS_TYPE_STRING, &message, DBUS_TYPE_INVALID)); + +return message; +} + void pa_dbus_send_error(DBusConnection *c, DBusMessage *in_reply_to, const char *name, const char *format, ...) { va_list ap; char *message; diff --git a/src/pulsecore/dbus-util.h b/src/pulsecore/dbus-util.h index 347f9f3..e3d6e4f 100644 --- a/src/pulsecore/dbus-util.h +++ b/src/pulsecore/dbus-util.h @@ -67,6 +67,14 @@ void pa_dbus_sync_pending_list(pa_dbus_pending **p); /* Free up a list of pa_dbus_pending_call objects */ void pa_dbus_free_pending_list(pa_dbus_pending **p); +/* When receiving a DBusMessage with type DBUS_MESSAGE_TYPE_ERROR, the + * DBusMessage may or may not contain an error message (a human-readable + * explanation of what went wrong). Extracting the error message from the + * DBusMessage object is a bit tedious, so here's a helper function that does + * that. If the DBusMessage doesn't contain any error message, + * "" is returned. */ +const char *pa_dbus_get_error_message(DBusMessage *m); + /* Sends an error message as the reply to the given message. */ void pa_dbus_send_error( DBusConnection *c, commit 910bc7c2b4c56f0a8d0c1ed2f9ab98bb8f51d579 Author: Peter Meerwald Date: Mon Dec 12 10:59:46 2011 +0100 pulse: Turn the anonymous error code enum into pa_error_code_t. The purpose is to make it possible to link to the enumeration in doxygen. diff --git a/src/pulse/def.h b/src/pulse/def.h index 98d3651..7ca0c4b 100644 --- a/src/pulse/def.h +++ b/src/pulse/def.h @@ -399,7 +399,7 @@ typedef struct pa_buffer_attr { } pa_buffer_attr; /** Error values as used by pa_context_errno(). Use pa_strerror() to convert these values to human readable strings */ -enum { +typedef enum pa_error_code { PA_OK = 0, /**<
[pulseaudio-commits] 3 commits - src/modules
src/modules/echo-cancel/module-echo-cancel.c | 32 src/modules/module-equalizer-sink.c |3 src/modules/module-filter-apply.c| 105 ++- 3 files changed, 79 insertions(+), 61 deletions(-) New commits: commit c30a68ebbda56aa1da0d0855f01d195f7d25d448 Author: Arun Raghavan Date: Fri Nov 11 15:08:24 2011 +0530 filters: Allow a filter to have both sink and source This sets the base for better representing module-echo-cancel. This patch itself should change no behaviour -- it only makes way for other changes. diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c index dd9a137..d1fb5df 100644 --- a/src/modules/module-filter-apply.c +++ b/src/modules/module-filter-apply.c @@ -57,9 +57,10 @@ static const char* const valid_modargs[] = { struct filter { char *name; uint32_t module_index; -pa_bool_t is_sink; -pa_object *parent_obj; /* source or sink that the filter is connected to */ -pa_object *obj; /* source or sink of the filter */ +pa_sink *sink; +pa_sink *sink_master; +pa_source *source; +pa_source *source_master; }; struct userdata { @@ -83,17 +84,19 @@ struct userdata { static unsigned filter_hash(const void *p) { const struct filter *f = p; -if (f->is_sink) -return (unsigned) (PA_SINK(f->parent_obj)->index + pa_idxset_string_hash_func(f->name)); +if (f->sink_master && !f->source_master) +return (unsigned) (f->sink_master->index + pa_idxset_string_hash_func(f->name)); +else if (!f->sink_master && f->source_master) +return (unsigned) ((f->source_master->index << 16) + pa_idxset_string_hash_func(f->name)); else -return (unsigned) ((PA_SOURCE(f->parent_obj)->index << 16) + pa_idxset_string_hash_func(f->name)); +pa_assert_not_reached(); } static int filter_compare(const void *a, const void *b) { const struct filter *fa = a, *fb = b; int r; -if (fa->parent_obj != fb->parent_obj) +if (fa->sink_master != fb->sink_master || fa->source_master != fb->source_master) return 1; if ((r = strcmp(fa->name, fb->name))) return r; @@ -101,15 +104,19 @@ static int filter_compare(const void *a, const void *b) { return 0; } -static struct filter *filter_new(const char *name, pa_object* parent_obj, pa_bool_t is_sink) { +static struct filter *filter_new(const char *name, pa_sink *sink, pa_source *source) { struct filter *f; +pa_assert(sink || source); + f = pa_xnew(struct filter, 1); f->name = pa_xstrdup(name); -pa_assert_se(f->parent_obj = parent_obj); -f->is_sink = is_sink; +f->sink_master = sink; +f->source_master = source; f->module_index = PA_INVALID_INDEX; -f->obj = NULL; +f->sink = NULL; +f->source = NULL; + return f; } @@ -140,12 +147,15 @@ static const char* should_filter(pa_object *o, pa_bool_t is_sink_input) { return NULL; } -static pa_bool_t nothing_attached(pa_object *obj, pa_bool_t is_sink) -{ -if (is_sink) -return pa_idxset_isempty(PA_SINK(obj)->inputs); -else -return pa_idxset_isempty(PA_SOURCE(obj)->outputs); +static pa_bool_t nothing_attached(struct filter *f) { +pa_bool_t no_si = TRUE, no_so = TRUE; + +if (f->sink) +no_si = pa_idxset_isempty(f->sink->inputs); +else if (f->source) +no_so = pa_idxset_isempty(f->source->outputs); + +return no_si && no_so; } static void housekeeping_time_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *t, void *userdata) { @@ -162,7 +172,7 @@ static void housekeeping_time_callback(pa_mainloop_api*a, pa_time_event* e, cons u->housekeeping_time_event = NULL; PA_HASHMAP_FOREACH(filter, u->filters, state) { -if (filter->obj && nothing_attached(filter->obj, filter->is_sink)) { +if (nothing_attached(filter)) { uint32_t idx; pa_log_debug("Detected filter %s as no longer used. Unloading.", filter->name); @@ -203,13 +213,13 @@ static void move_object_for_filter(pa_object *o, struct filter* filter, pa_bool_ pa_assert(o); pa_assert(filter); -pa_assert_se(parent = (restore ? filter->parent_obj : filter->obj)); - if (is_sink_input) { pl = PA_SINK_INPUT(o)->proplist; +pa_assert_se(parent = PA_OBJECT(restore ? filter->sink_master : filter->sink)); name = PA_SINK(parent)->name; } else { pl = PA_SOURCE_OUTPUT(o)->proplist; +pa_assert_se(parent = PA_OBJECT(restore ? filter->source_master : filter->source)); name = PA_SOURCE(parent)->name; } @@ -235,9 +245,9 @@ static void find_filters_for_module(struct userdata *u, pa_module *m, const char if (sink->module == m) { pa_assert(sink->input_to_master != NULL); -fltr = filter_new(name, PA_OBJECT(sink->input_to_master->sink), TRUE);
[pulseaudio-commits] 3 commits - src/modules src/pulse src/pulsecore
src/modules/alsa/alsa-sink.c | 10 +++--- src/pulse/stream.c |2 +- src/pulsecore/rtpoll.h |8 +--- 3 files changed, 9 insertions(+), 11 deletions(-) New commits: commit bcee830007594fb283f1d7c80355a9805b02d756 Author: Maarten Bosmans Date: Thu Oct 13 20:54:17 2011 +0200 rtpoll: Update comment to reflect changes made in 32e2cd6d3216f780c4cffed0f8eb3c30f2c8d732 core: get rid of rt sig/timer handling since modern Linux' ppoll() is finally fixed for granularity diff --git a/src/pulsecore/rtpoll.h b/src/pulsecore/rtpoll.h index bb3c860..1c8f8b0 100644 --- a/src/pulsecore/rtpoll.h +++ b/src/pulsecore/rtpoll.h @@ -34,13 +34,7 @@ * yet another wrapper around poll(). However it has certain * advantages over pa_mainloop and suchlike: * - * 1) It uses timer_create() and POSIX real time signals to guarantee - * optimal high-resolution timing. Starting with Linux 2.6.21 hrtimers - * are available, and since right now only nanosleep() and the POSIX - * clock and timer interfaces have been ported to hrtimers (and not - * ppoll/pselect!) we have to combine ppoll() with timer_create(). The - * fact that POSIX timers and POSIX rt signals are used internally is - * completely hidden. + * 1) High resolution timers are used * * 2) It allows raw access to the pollfd data to users * commit 7d05ac606bd5a86c94ab13f8d6c898ad86b6b78a Author: Antti-Ville Jansson Date: Fri Nov 11 16:22:24 2011 +0200 stream: Fix upload samples' cleanup In pa_create_stream_callback, a stream is inserted into s->context->record_streams only if it's a record stream. Otherwise it's inserted into s->context->playback_streams. However, in stream_unlink the stream is removed from s->context->playback_streams only if it's a playback stream and otherwise it's removed from s->context->record_streams. Thus, if the stream is an upload stream, we first insert it into s->context->playback_streams in pa_create_stream_callback and then try to remove it unsuccessfully from s->context->record_streams in stream_unlink. This means that we are leaking hashmap entries until the context is freed, constantly consuming more memory with applications that upload and unload a large number of samples through one context. Of course, this begs the question whether upload streams even belong in either of those hashmaps. I don't want to mess around with the code too much at this point though, so this patch should be a sufficient improvement. diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 3bf2d96..5433abf 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -258,7 +258,7 @@ static void stream_unlink(pa_stream *s) { pa_pdispatch_unregister_reply(s->context->pdispatch, s); if (s->channel_valid) { -pa_hashmap_remove((s->direction == PA_STREAM_PLAYBACK) ? s->context->playback_streams : s->context->record_streams, PA_UINT32_TO_PTR(s->channel)); +pa_hashmap_remove((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, PA_UINT32_TO_PTR(s->channel)); s->channel = 0; s->channel_valid = FALSE; } commit d320ae029b136bb54fcd19f9c29fa033106ca1b8 Author: Arun Raghavan Date: Sat Nov 12 11:18:25 2011 +0530 alsa: Minor debug code cleanup Remove a trap on underrun and uncomment a couple of useful debug prints (still enabled only when DEBUG_TIMING is defined). diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 1386196..93ecb28 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -457,7 +457,7 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o left_to_play = 0; underrun = TRUE; -#ifdef DEBUG_TIMING +#if 0 PA_DEBUG_TRAP; #endif @@ -1727,13 +1727,17 @@ static void thread_func(void *userdata) { /* OK, the playback buffer is now full, let's * calculate when to wake up next */ -/* pa_log_debug("Waking up in %0.2fms (sound card clock).", (double) sleep_usec / PA_USEC_PER_MSEC); */ +#ifdef DEBUG_TIMING +pa_log_debug("Waking up in %0.2fms (sound card clock).", (double) sleep_usec / PA_USEC_PER_MSEC); +#endif /* Convert from the sound card time domain to the * system time domain */ cusec = pa_smoother_translate(u->smoother, pa_rtclock_now(), sleep_usec); -/* pa_log_debug("Waking up in %0.2fms (system clock).", (double) cusec / PA_USEC_PER_MSEC); */ +#ifdef DEBUG_TIMING +pa_log_debug("Waking up in %0.2fms (system clock).", (double) cusec / PA_USEC_PER_MSEC); +#endif /* We don't trust the conversion, so we wake up whatever comes first */ rtpoll_sleep = PA_MIN(sleep_usec, cusec); __
[pulseaudio-commits] 3 commits - src/modules src/pulsecore
src/modules/alsa/alsa-sink.c | 23 +++ src/modules/alsa/alsa-source.c| 22 ++ src/modules/alsa/module-alsa-card.c |2 ++ src/modules/alsa/module-alsa-sink.c |4 +++- src/modules/alsa/module-alsa-source.c |4 +++- src/modules/module-udev-detect.c | 13 - src/pulsecore/protocol-native.c |4 7 files changed, 61 insertions(+), 11 deletions(-) New commits: commit 1e6eda8eda615ec1275a1f208e5f3c9b41238f10 Author: Lars R. Damerow Date: Thu Nov 3 21:31:48 2011 +0100 alsa: fixed_latency_range modarg for module-alsa-card diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index 5bf6480..344563f 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -64,6 +64,7 @@ PA_MODULE_USAGE( "tsched_buffer_size= " "tsched_buffer_watermark= " "profile= " +"fixed_latency_range= " "ignore_dB= " "deferred_volume= " "profile_set= " @@ -88,6 +89,7 @@ static const char* const valid_modargs[] = { "tsched", "tsched_buffer_size", "tsched_buffer_watermark", +"fixed_latency_range", "profile", "ignore_dB", "deferred_volume", commit c07c4b353dffe17607fee89e294181bb4e2da40d Author: Lars R. Damerow Date: Thu Nov 3 21:29:03 2011 +0100 alsa: fixed latency range handling for udev-detect diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c index c5312a8..1192194 100644 --- a/src/modules/module-udev-detect.c +++ b/src/modules/module-udev-detect.c @@ -45,6 +45,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_LOAD_ONCE(TRUE); PA_MODULE_USAGE( "tsched= " +"fixed_latency_range= " "ignore_dB= " "deferred_volume="); @@ -62,6 +63,7 @@ struct userdata { pa_hashmap *devices; pa_bool_t use_tsched:1; +pa_bool_t fixed_latency_range:1; pa_bool_t ignore_dB:1; pa_bool_t deferred_volume:1; @@ -75,6 +77,7 @@ struct userdata { static const char* const valid_modargs[] = { "tsched", +"fixed_latency_range", "ignore_dB", "deferred_volume", NULL @@ -388,6 +391,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) { "card_name=\"%s\" " "namereg_fail=false " "tsched=%s " +"fixed_latency_range=%s " "ignore_dB=%s " "deferred_volume=%s " "card_properties=\"module-udev-detect.discovered=1\"", @@ -395,6 +399,7 @@ static void card_changed(struct userdata *u, struct udev_device *dev) { n, d->card_name, pa_yes_no(u->use_tsched), +pa_yes_no(u->fixed_latency_range), pa_yes_no(u->ignore_dB), pa_yes_no(u->deferred_volume)); pa_xfree(n); @@ -665,7 +670,7 @@ int pa__init(pa_module *m) { struct udev_enumerate *enumerate = NULL; struct udev_list_entry *item = NULL, *first = NULL; int fd; -pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume; +pa_bool_t use_tsched = TRUE, fixed_latency_range = FALSE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume; pa_assert(m); @@ -686,6 +691,12 @@ int pa__init(pa_module *m) { } u->use_tsched = use_tsched; +if (pa_modargs_get_value_boolean(ma, "fixed_latency_range", &fixed_latency_range) < 0) { +pa_log("Failed to parse fixed_latency_range= argument."); +goto fail; +} +u->fixed_latency_range = fixed_latency_range; + if (pa_modargs_get_value_boolean(ma, "ignore_dB", &ignore_dB) < 0) { pa_log("Failed to parse ignore_dB= argument."); goto fail; commit 7a387fed36ed5bc0b925269fb76b5e8e3a738a5f Author: Lars R. Damerow Date: Thu Nov 3 21:14:45 2011 +0100 alsa: support fixed latency range in alsa modules This adds a boolean module parameter to disable automatic dynamic latency readjustments on underruns, but leaves automatic dynamic watermark readjustments untouched. diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 7b31b1b..1386196 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -134,7 +134,7 @@ struct userdata { char *device_name; /* name of the PCM device */ char *control_device; /* name of the control device */ -pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1; +pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1; pa_bool_t first, after_rewind; @@ -331,7 +331,12 @@ static void increase_watermark(struct
[pulseaudio-commits] 3 commits - src/modules src/pulse src/utils
src/modules/echo-cancel/module-echo-cancel.c |9 + src/pulse/utf8.c |7 ++- src/utils/pacat.c|5 + 3 files changed, 20 insertions(+), 1 deletion(-) New commits: commit 3c4d43d9dc30ec54fe934b4b1370423a98d575f5 Author: Maarten Bosmans Date: Mon Oct 10 09:27:17 2011 +0200 pacat: Fail early if the media name cannot be set Otherwise you get an "invalid argument" error from pa_stream_new later. diff --git a/src/utils/pacat.c b/src/utils/pacat.c index 3be1f6c..3c8e3c7 100644 --- a/src/utils/pacat.c +++ b/src/utils/pacat.c @@ -1103,6 +1103,11 @@ int main(int argc, char *argv[]) { if ((t = filename) || (t = pa_proplist_gets(proplist, PA_PROP_APPLICATION_NAME))) pa_proplist_sets(proplist, PA_PROP_MEDIA_NAME, t); + +if (!pa_proplist_contains(proplist, PA_PROP_MEDIA_NAME)) { +pa_log(_("Failed to set media name.")); +goto quit; +} } /* Set up a new main loop */ commit 3b7c6b21f4f0cd4df6b8cff44512b9640a189dc0 Author: Maarten Bosmans Date: Mon Oct 10 09:27:16 2011 +0200 Do something sensible when compiled without iconv support Without this fix, pacat won't start up, because it is unable to set the stream name. diff --git a/src/pulse/utf8.c b/src/pulse/utf8.c index fe7bcd2..773a1f8 100644 --- a/src/pulse/utf8.c +++ b/src/pulse/utf8.c @@ -249,11 +249,16 @@ char* pa_locale_to_utf8 (const char *str) { char* pa_utf8_to_locale (const char *str) { pa_assert(str); -return NULL; + +return pa_ascii_filter(str); } char* pa_locale_to_utf8 (const char *str) { pa_assert(str); + +if (pa_utf8_valid(str)) +return pa_xstrdup(str); + return NULL; } commit 518338ac0e781e13bd893ee2d585af40f3ce04ae Author: Arun Raghavan Date: Mon Oct 10 22:17:55 2011 +0530 echo-cancel: Close debug files on module unload diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index b17e18f..b1fa791 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -1773,6 +1773,15 @@ void pa__done(pa_module*m) { if (u->asyncmsgq) pa_asyncmsgq_unref(u->asyncmsgq); +if (u->save_aec) { +if (u->played_file) +fclose(u->played_file); +if (u->captured_file) +fclose(u->captured_file); +if (u->canceled_file) +fclose(u->canceled_file); +} + pa_xfree(u); } ___ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
[pulseaudio-commits] 3 commits - src/modules src/pulsecore src/tests
src/modules/alsa/mixer/profile-sets/90-pulseaudio.rules |1 src/modules/alsa/mixer/profile-sets/kinect-audio.conf | 39 ++ src/modules/raop/module-raop-discover.c |8 - src/pulsecore/modargs.c | 100 ++-- src/tests/proplist-test.c |2 5 files changed, 111 insertions(+), 39 deletions(-) New commits: commit 27343ed79a98e971c285b546ebb85495a334895b Author: Colin Guthrie Date: Tue Sep 6 11:45:24 2011 +0100 raop: Properly deal with the name coming from the device. We need to properly quote our proplist arguments passed to the module. diff --git a/src/modules/raop/module-raop-discover.c b/src/modules/raop/module-raop-discover.c index 1a7572c..4ebe5fc 100644 --- a/src/modules/raop/module-raop-discover.c +++ b/src/modules/raop/module-raop-discover.c @@ -156,7 +156,9 @@ static void resolver_cb( ++nicename; if (strlen(nicename) > 0) { pa_log_debug("Found RAOP: %s", nicename); -} +nicename = pa_escape(nicename, "\"'"); +} else +nicename = NULL; } for (l = txt; l; l = l->next) { @@ -189,11 +191,11 @@ static void resolver_cb( if (nicename) { args = pa_sprintf_malloc("server=[%s]:%u " "sink_name=%s " - "sink_properties=device.description=\"%s\"", + "sink_properties='device.description=\"%s\"'", avahi_address_snprint(at, sizeof(at), a), port, vname, nicename); - +pa_xfree(nicename); } else { args = pa_sprintf_malloc("server=[%s]:%u " "sink_name=%s", commit 3542112888c0dd563eda37a8be498dd5883fcb0e Author: Colin Guthrie Date: Tue Sep 6 11:35:33 2011 +0100 modargs: Ensure modargs can be accessed in their raw form. When dealing with proplists passed as modargs, we need the unescaped form in order to properly deal with quotes (ticks + double quotes). As the previous code always called pa_unescape() before adding it into the modarg hashmap, this was impossible. This modification simply stores two proplists. If the unescaped value is different from the raw value, we also keep the raw form. When parsing proplist arguments, we use this raw form and do the unescaping ourselves when processing it. This changes the current behaviour which required you to double escape proplists arguments. This double escape mechanism did allow you to mix and match what types of quotes you used to delimit the individial proplist values, but it made the actual data much harder to pass in. This approach has the drawback that you cannot mix and match the quotes you use, but this is a very minor issue and IMO pales in comparison to the general clarity gained. See the discussion on the mailing list for more background: http://lists.freedesktop.org/archives/pulseaudio-discuss/2011-September/011220.html diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c index 45ffba2..2211cba 100644 --- a/src/pulsecore/modargs.c +++ b/src/pulsecore/modargs.c @@ -36,18 +36,26 @@ #include "modargs.h" +struct pa_modargs { +pa_hashmap *raw; +pa_hashmap *unescaped; +}; + struct entry { char *key, *value; }; -static int add_key_value(pa_hashmap *map, char *key, char *value, const char* const valid_keys[]) { +static int add_key_value(pa_modargs *ma, char *key, char *value, const char* const valid_keys[]) { struct entry *e; +char *raw; -pa_assert(map); +pa_assert(ma); +pa_assert(ma->raw); +pa_assert(ma->unescaped); pa_assert(key); pa_assert(value); -if (pa_hashmap_get(map, key)) { +if (pa_hashmap_get(ma->unescaped, key)) { pa_xfree(key); pa_xfree(value); return -1; @@ -66,10 +74,21 @@ static int add_key_value(pa_hashmap *map, char *key, char *value, const char* co } } +raw = pa_xstrdup(value); + e = pa_xnew(struct entry, 1); e->key = key; -e->value = value; -pa_hashmap_put(map, key, e); +e->value = pa_unescape(value); +pa_hashmap_put(ma->unescaped, key, e); + +if (pa_streq(raw, value)) +pa_xfree(raw); +else { +e = pa_xnew(struct entry, 1); +e->key = pa_xstrdup(key); +e->value = raw; +pa_hashmap_put(ma->raw, key, e); +} return 0; } @@ -89,12 +108,13 @@ pa_modargs *pa_modargs_new(const char *args, const char* const* valid_keys) { const char *p, *key = NULL, *value = NULL; size_t key_len = 0, value_len = 0; -pa_hashmap *map; +pa_modargs *ma = pa_xnew(pa_modargs, 1); -map =
[pulseaudio-commits] 3 commits - src/modules src/pulse src/pulsecore
src/modules/alsa/alsa-sink.c |4 ++-- src/pulse/def.h | 10 ++ src/pulsecore/sink-input.c|2 +- src/pulsecore/source-output.c |2 +- 4 files changed, 6 insertions(+), 12 deletions(-) New commits: commit adbdb6259becab57fff893671e58fff5786420db Author: Arun Raghavan Date: Wed Aug 17 14:58:23 2011 +0530 formats: Use correct API to check for passthrough streams diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 22de3bc..4cd51d7 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -321,7 +321,7 @@ int pa_sink_input_new( pa_return_val_if_fail(pa_channel_map_compatible(&data->channel_map, &data->sample_spec), -PA_ERR_INVALID); /* Don't restore (or save) stream volume for passthrough streams */ -if (!pa_format_info_is_pcm(data->format)) { +if (!pa_sink_input_new_data_is_passthrough(data)) { data->volume_is_set = FALSE; data->volume_factor_is_set = FALSE; } diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index cd2e126..d99bafe 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -299,7 +299,7 @@ int pa_source_output_new( pa_return_val_if_fail(pa_channel_map_compatible(&data->channel_map, &data->sample_spec), -PA_ERR_INVALID); /* Don't restore (or save) stream volume for passthrough streams */ -if (!pa_format_info_is_pcm(data->format)) { +if (!pa_source_output_new_data_is_passthrough(data)) { data->volume_is_set = FALSE; data->volume_factor_is_set = FALSE; } commit dde09c7fac33de99f77fb90076bd4b45896d1dc5 Author: Arun Raghavan Date: Wed Aug 17 13:33:50 2011 +0530 alsa: Don't always suspend/unsuspend on sink-input removal If the sink was already suspended, this avoids and assert when calling suspend() again, and prevents an unnecessary unsuspend. diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index eec38d8..2bf19c6 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1106,12 +1106,12 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse break; /* .. we do */ -if ((r = suspend(u)) < 0) +if (PA_SINK_IS_OPENED(u->sink->thread_info.state) && ((r = suspend(u)) < 0)) return r; u->sink->sample_spec.rate = u->old_rate; -if ((r = unsuspend(u)) < 0) +if (PA_SINK_IS_OPENED(u->sink->thread_info.state) && ((r = unsuspend(u)) < 0)) return r; break; commit 2677911e927bab177a29bbf214c8a44660179ed8 Author: Arun Raghavan Date: Wed Aug 17 09:00:47 2011 +0530 source: Remove the PA_SOURCE_PASSTHROUGH flag This isn't actually used anywhere, and PA_SINK_PASSTHROUGH was also removed. diff --git a/src/pulse/def.h b/src/pulse/def.h index 96aea19..d14ebca 100644 --- a/src/pulse/def.h +++ b/src/pulse/def.h @@ -857,12 +857,7 @@ typedef enum pa_source_flags { /**< This source is in flat volume mode, i.e. always the maximum of * the volume of all connected outputs. \since 1.0 */ -PA_SOURCE_PASSTHROUGH = 0x0100U, -/**< This sink has support for passthrough mode. The data will be left - * as is and not reformatted, resampled, mixed. - * \since 1.0 */ - -PA_SOURCE_SYNC_VOLUME = 0x0200U, +PA_SOURCE_SYNC_VOLUME = 0x0100U, /**< The HW volume changes are syncronized with SW volume. * \since 1.0 */ @@ -871,7 +866,7 @@ typedef enum pa_source_flags { * The server will filter out these flags anyway, so you should never see * these flags in sources. */ -PA_SOURCE_SHARE_VOLUME_WITH_MASTER = 0x0400U, +PA_SOURCE_SHARE_VOLUME_WITH_MASTER = 0x0200U, /**< This source shares the volume with the master source (used by some filter * sources). */ } pa_source_flags_t; @@ -885,7 +880,6 @@ typedef enum pa_source_flags { #define PA_SOURCE_DECIBEL_VOLUME PA_SOURCE_DECIBEL_VOLUME #define PA_SOURCE_DYNAMIC_LATENCY PA_SOURCE_DYNAMIC_LATENCY #define PA_SOURCE_FLAT_VOLUME PA_SOURCE_FLAT_VOLUME -#define PA_SOURCE_PASSTHROUGH PA_SOURCE_PASSTHROUGH #define PA_SOURCE_SYNC_VOLUME PA_SOURCE_SYNC_VOLUME #define PA_SOURCE_SHARE_VOLUME_WITH_MASTER PA_SOURCE_SHARE_VOLUME_WITH_MASTER ___ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits
[pulseaudio-commits] 3 commits - src/modules
src/modules/echo-cancel/echo-cancel.h|2 + src/modules/echo-cancel/module-echo-cancel.c | 44 +++ src/modules/echo-cancel/speex.c |3 + 3 files changed, 42 insertions(+), 7 deletions(-) New commits: commit b0f5b8d2fab347a062fa6ed34ff2908a1c29a41d Author: Arun Raghavan Date: Sat May 28 07:51:35 2011 +0530 echo-cancel: Fix a crash is speex cleanup If module initialisation fails, the speex done() function might try to free a value that's not been allocated yet. Adding protection for this condition. diff --git a/src/modules/echo-cancel/speex.c b/src/modules/echo-cancel/speex.c index ce361fc..72c5268 100644 --- a/src/modules/echo-cancel/speex.c +++ b/src/modules/echo-cancel/speex.c @@ -109,6 +109,7 @@ void pa_speex_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *p } void pa_speex_ec_done(pa_echo_canceller *ec) { -speex_echo_state_destroy(ec->params.priv.speex.state); +if (ec->params.priv.speex.state) +speex_echo_state_destroy(ec->params.priv.speex.state); ec->params.priv.speex.state = NULL; } commit 9e78de2da27e882b8cd956ec859304629011a55b Author: Bart Cerneels Date: Sat May 28 07:57:22 2011 +0530 echo-cancel: Fix echo suppression, add some knobs The echo suppress attenuation value was being incorrectly modified. Fixed and added 2 arguments to change the attenuation of the residual echo filter. Default values of the speex preprocessor will be used when omitted. diff --git a/src/modules/echo-cancel/echo-cancel.h b/src/modules/echo-cancel/echo-cancel.h index 5f18053..aa40adc 100644 --- a/src/modules/echo-cancel/echo-cancel.h +++ b/src/modules/echo-cancel/echo-cancel.h @@ -68,6 +68,8 @@ struct pa_echo_canceller { pa_bool_t agc; pa_bool_t denoise; pa_bool_t echo_suppress; +int32_t echo_suppress_attenuation; +int32_t echo_suppress_attenuation_active; SpeexPreprocessState *pp_state; }; diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 90577d4..cb30832 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -79,7 +79,9 @@ PA_MODULE_USAGE( "aec_args= " "agc= " "denoise= " - "echo_suppress= " + "echo_suppress= " + "echo_suppress_attenuation= " + "echo_suppress_attenuation_active= " "save_aec= " "autoloaded= " )); @@ -112,6 +114,7 @@ static const pa_echo_canceller ec_table[] = { #define DEFAULT_AGC_ENABLED FALSE #define DEFAULT_DENOISE_ENABLED FALSE #define DEFAULT_ECHO_SUPPRESS_ENABLED FALSE +#define DEFAULT_ECHO_SUPPRESS_ATTENUATION 0 #define DEFAULT_SAVE_AEC 0 #define DEFAULT_AUTOLOADED FALSE @@ -221,6 +224,8 @@ static const char* const valid_modargs[] = { "agc", "denoise", "echo_suppress", +"echo_suppress_attenuation", +"echo_suppress_attenuation_active", "save_aec", "autoloaded", NULL @@ -1429,6 +1434,26 @@ int pa__init(pa_module*m) { goto fail; } +u->ec->echo_suppress_attenuation = DEFAULT_ECHO_SUPPRESS_ATTENUATION; +if (pa_modargs_get_value_s32(ma, "echo_suppress_attenuation", &u->ec->echo_suppress_attenuation) < 0) { +pa_log("Failed to parse echo_suppress_attenuation value"); +goto fail; +} +if (u->ec->echo_suppress_attenuation > 0) { +pa_log("echo_suppress_attenuation should be a negative dB value"); +goto fail; +} + +u->ec->echo_suppress_attenuation_active = DEFAULT_ECHO_SUPPRESS_ATTENUATION; +if (pa_modargs_get_value_s32(ma, "echo_suppress_attenuation_active", &u->ec->echo_suppress_attenuation_active) < 0) { +pa_log("Failed to parse echo_supress_attenuation_active value"); +goto fail; +} +if (u->ec->echo_suppress_attenuation_active > 0) { +pa_log("echo_suppress_attenuation_active should be a negative dB value"); +goto fail; +} + u->save_aec = DEFAULT_SAVE_AEC; if (pa_modargs_get_value_u32(ma, "save_aec", &u->save_aec) < 0) { pa_log("Failed to parse save_aec value"); @@ -1460,9 +1485,15 @@ int pa__init(pa_module*m) { speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_AGC, &u->ec->agc); speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_DENOISE, &u->ec->denoise); -speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS, &u->ec->echo_suppress); -if (u->ec->echo_suppress) +if (u->ec->echo_suppress) { +if (u->ec->echo_suppress_attenuation) +speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS, &u->ec->echo_suppress_attenuation); +if (u->ec->echo_suppress_attenuation_active) { +speex_preprocess_ctl(u->ec->pp_state, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE, +
[pulseaudio-commits] 3 commits - src/modules src/pulse src/pulsecore
src/modules/echo-cancel/adrian-aec.h |2 +- src/modules/echo-cancel/module-echo-cancel.c |1 - src/pulse/format.c | 13 +++-- src/pulsecore/sink-input.c |3 ++- 4 files changed, 10 insertions(+), 9 deletions(-) New commits: commit 117c7145944fb227703d72dd2f03e88d439c187d Author: Arun Raghavan Date: Fri May 20 19:21:02 2011 +0530 format: Fix channel map handling Channel map handling in the extended API was broken. Thanks for Milos_SD for pointing this out on IRC. diff --git a/src/pulse/format.c b/src/pulse/format.c index a1a0981..b256d72 100644 --- a/src/pulse/format.c +++ b/src/pulse/format.c @@ -193,11 +193,9 @@ pa_bool_t pa_format_info_to_sample_spec(pa_format_info *f, pa_sample_spec *ss, p if (map) { pa_channel_map_init(map); -if (!pa_format_info_get_prop_string(f, PA_PROP_FORMAT_CHANNEL_MAP, &m)) -goto out; - -if (m && pa_channel_map_parse(map, m) == NULL) -goto out; +if (pa_format_info_get_prop_string(f, PA_PROP_FORMAT_CHANNEL_MAP, &m)) +if (pa_channel_map_parse(map, m) == NULL) +goto out; } ret = TRUE; @@ -281,7 +279,10 @@ pa_bool_t pa_format_info_get_prop_string(pa_format_info *f, const char *key, cha pa_assert(key); pa_assert(v); -pa_return_val_if_fail(str = pa_proplist_gets(f->plist, key), FALSE); +str = pa_proplist_gets(f->plist, key), FALSE; +if (!str) +return FALSE; + o = json_tokener_parse(str); pa_return_val_if_fail(!is_error(o), FALSE); if (json_object_get_type(o) != json_type_string) { diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 300b728..f4f3258 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -262,7 +262,8 @@ int pa_sink_input_new( * to using the sample spec and channel map after all decisions w.r.t. * routing are complete. */ pa_idxset *tmp = pa_idxset_new(NULL, NULL); -pa_format_info *f = pa_format_info_from_sample_spec(&data->sample_spec, &data->channel_map); +pa_format_info *f = pa_format_info_from_sample_spec(&data->sample_spec, +data->channel_map_is_set ? &data->channel_map : NULL); pa_idxset_put(tmp, f, NULL); pa_sink_input_new_data_set_formats(data, tmp); } commit f4eccad1e64e1d494dbda30cccb86a848ceb1d1d Author: Arun Raghavan Date: Fri May 20 10:01:16 2011 +0530 echo-cancel: Remove extraneous debug message This was making it impossible to run in debug mode with save_aec=1 diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index a06e481..b0d3c68 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -720,7 +720,6 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) fwrite(pdata, 1, u->blocksize, u->played_file); if (u->canceled_file) fwrite(cdata, 1, u->blocksize, u->canceled_file); -pa_log_debug("AEC frame saved."); } pa_memblock_release(cchunk.memblock); commit 8305284cd22c76622d892d6ac74b4e92b8680fdb Author: Arun Raghavan Date: Sat May 14 17:44:23 2011 +0530 echo-cancel: Don't overpad variable The padding was to be 16 bytes, not 16 elements. diff --git a/src/modules/echo-cancel/adrian-aec.h b/src/modules/echo-cancel/adrian-aec.h index efb9e27..0efe53e 100644 --- a/src/modules/echo-cancel/adrian-aec.h +++ b/src/modules/echo-cancel/adrian-aec.h @@ -306,7 +306,7 @@ struct AEC { // NLMS-pw REAL x[NLMS_LEN + NLMS_EXT]; // tap delayed loudspeaker signal REAL xf[NLMS_LEN + NLMS_EXT]; // pre-whitening tap delayed signal - REAL w_arr[NLMS_LEN+16]; // tap weights + REAL w_arr[NLMS_LEN + (16 / sizeof(REAL))]; // tap weights REAL *w; // this will be a 16-byte aligned pointer into w_arr int j;// optimize: less memory copies double dotp_xf_xf;// double to avoid loss of precision ___ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits