[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -7,7 +7,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/pulseaudio-modules-droid.git</param>
<param name="branch">master</param>
- <param name="revision">adebe4792926ff8e5ab4682fcfda2518710ca914</param>
+ <param name="revision">90ca699176f9cb5e118f635ad4bedb9da7db7a5d</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.80.tar.bz2/src/droid/keepalive.c
^
|
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <signal.h>
-#include <stdio.h>
-
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-#include <valgrind/memcheck.h>
-#endif
-
-#include <pulse/rtclock.h>
-#include <pulse/timeval.h>
-#include <pulse/xmalloc.h>
-
-#include <pulsecore/core.h>
-#include <pulsecore/core-error.h>
-#include <pulsecore/dbus-shared.h>
-#include <pulsecore/dbus-util.h>
-#include <pulsecore/atomic.h>
-
-#include "keepalive.h"
-
-#define MCE_BUS (DBUS_BUS_SYSTEM)
-#define MCE_DBUS_NAME "com.nokia.mce"
-#define MCE_DBUS_PATH "/com/nokia/mce/request"
-#define MCE_DBUS_IFACE "com.nokia.mce.request"
-#define MCE_DBUS_KEEPALIVE_PERIOD_REQ "req_cpu_keepalive_period"
-#define MCE_DBUS_KEEPALIVE_START_REQ "req_cpu_keepalive_start"
-#define MCE_DBUS_KEEPALIVE_STOP_REQ "req_cpu_keepalive_stop"
-
-struct pa_droid_keepalive {
- pa_core *core;
- pa_dbus_connection *dbus_connection;
- DBusPendingCall *pending;
-
- pa_atomic_t started;
- pa_usec_t timeout;
- pa_time_event *timer_event;
-
-};
-
-pa_droid_keepalive* pa_droid_keepalive_new(pa_core *c) {
- pa_droid_keepalive *k;
- pa_dbus_connection *dbus;
- DBusError error;
-
- pa_assert(c);
-
- dbus_error_init(&error);
-
- dbus = pa_dbus_bus_get(c, MCE_BUS, &error);
- if (dbus_error_is_set(&error)) {
- pa_log("Failed to get %s bus: %s", MCE_BUS == DBUS_BUS_SESSION ? "session" : "system", error.message);
- dbus_error_free(&error);
- return NULL;
- }
-
- k = pa_xnew0(pa_droid_keepalive, 1);
- k->core = c;
- k->dbus_connection = dbus;
- k->timeout = 0;
- pa_atomic_store(&k->started, 0);
-
- return k;
-}
-
-static void send_dbus_signal(pa_dbus_connection *dbus) {
- DBusMessage *msg;
-
- pa_assert(dbus);
-
- /* pa_log_debug("Send keepalive heartbeat."); */
-
- pa_assert_se((msg = dbus_message_new_method_call(MCE_DBUS_NAME,
- MCE_DBUS_PATH,
- MCE_DBUS_IFACE,
- MCE_DBUS_KEEPALIVE_START_REQ)));
-
- dbus_connection_send(pa_dbus_connection_get(dbus), msg, NULL);
- dbus_message_unref(msg);
-}
-
-static void keepalive_cb(pa_mainloop_api *m, pa_time_event *e, const struct timeval *t, void *userdata) {
- pa_droid_keepalive *k = userdata;
-
- pa_assert(k);
- pa_assert(k->timer_event == e);
-
- send_dbus_signal(k->dbus_connection);
- pa_core_rttime_restart(k->core, k->timer_event, pa_rtclock_now() + k->timeout);
-}
-
-static void keepalive_start(pa_droid_keepalive *k) {
- pa_assert(k);
- pa_assert(k->timeout);
- pa_assert(!k->timer_event);
-
- pa_log_info("Start keepalive heartbeat with interval %lu seconds.", (unsigned long) (k->timeout / PA_USEC_PER_SEC));
-
- /* Send first keepalive heartbeat immediately. */
- send_dbus_signal(k->dbus_connection);
-
- k->timer_event = pa_core_rttime_new(k->core, pa_rtclock_now() + k->timeout, keepalive_cb, k);
-}
-
-static void pending_req_reply_cb(DBusPendingCall *pending, void *userdata) {
- pa_droid_keepalive *k = userdata;
- DBusMessage *msg;
- uint32_t period;
-
- pa_assert(pending);
- pa_assert(k);
- pa_assert(pending == k->pending);
-
- k->pending = NULL;
- pa_assert_se(msg = dbus_pending_call_steal_reply(pending));
-
- if (dbus_message_get_type(msg) == DBUS_MESSAGE_TYPE_ERROR) {
- pa_log("Failed to get %s", MCE_DBUS_KEEPALIVE_PERIOD_REQ);
- goto finish;
- }
-
- pa_assert_se(dbus_message_get_args(msg, NULL,
- DBUS_TYPE_INT32, &period,
- DBUS_TYPE_INVALID));
-
- k->timeout = PA_USEC_PER_SEC * period;
-
- keepalive_start(k);
-
-finish:
- dbus_message_unref(msg);
- dbus_pending_call_unref(pending);
-}
-
-void pa_droid_keepalive_start(pa_droid_keepalive *k) {
- DBusMessage *msg = NULL;
-
- pa_assert(k);
-
- /* Only allow first call go through. pa_atomic_inc() returns previous value before incrementing. */
- if (pa_atomic_inc(&k->started) > 0)
- return;
-
- pa_assert(!k->timer_event);
- pa_assert(!k->pending);
-
- /* Period time already requested, just start hearbeat. */
- if (k->timeout > 0) {
- keepalive_start(k);
- return;
- }
-
- pa_log_debug("Starting keepalive - Request keepalive period.");
- /* Send first keepalive heartbeat immediately. */
- send_dbus_signal(k->dbus_connection);
-
- pa_assert_se((msg = dbus_message_new_method_call(MCE_DBUS_NAME,
- MCE_DBUS_PATH,
- MCE_DBUS_IFACE,
- MCE_DBUS_KEEPALIVE_PERIOD_REQ)));
-
- dbus_connection_send_with_reply(pa_dbus_connection_get(k->dbus_connection), msg, &k->pending, -1);
- dbus_message_unref(msg);
-
- if (k->pending)
- dbus_pending_call_set_notify(k->pending, pending_req_reply_cb, k, NULL);
- else
- pa_log("D-Bus method call failed.");
-}
-
-void pa_droid_keepalive_stop(pa_droid_keepalive *k) {
- DBusMessage *msg;
-
- pa_assert(k);
-
- /* Only allow last call go through. pa_atomic_dec() returns previous value before decrementing. */
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.80.tar.bz2/src/droid/keepalive.h
^
|
@@ -1,44 +0,0 @@
-#ifndef foodroidkeepalivefoo
-#define foodroidkeepalivefoo
-
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pulsecore/core.h>
-#include <pulsecore/core-util.h>
-#include <pulsecore/macro.h>
-#include <pulsecore/dbus-shared.h>
-#include <pulsecore/atomic.h>
-
-typedef struct pa_droid_keepalive pa_droid_keepalive;
-
-pa_droid_keepalive* pa_droid_keepalive_new(pa_core *c);
-void pa_droid_keepalive_free(pa_droid_keepalive *k);
-
-void pa_droid_keepalive_start(pa_droid_keepalive *k);
-void pa_droid_keepalive_stop(pa_droid_keepalive *k);
-
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.80.tar.bz2/src/droid/module-droid-keepalive-symdef.h
^
|
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-#ifndef foomoduledroidkeepalivesymdeffoo
-#define foomoduledroidkeepalivesymdeffoo
-
-#include <pulsecore/core.h>
-#include <pulsecore/module.h>
-
-#define pa__init module_droid_keepalive_LTX_pa__init
-#define pa__done module_droid_keepalive_LTX_pa__done
-#define pa__get_author module_droid_keepalive_LTX_pa__get_author
-#define pa__get_description module_droid_keepalive_LTX_pa__get_description
-#define pa__get_usage module_droid_keepalive_LTX_pa__get_usage
-#define pa__get_version module_droid_keepalive_LTX_pa__get_version
-
-int pa__init(struct pa_module*m);
-void pa__done(struct pa_module*m);
-
-const char* pa__get_author(void);
-const char* pa__get_description(void);
-const char* pa__get_usage(void);
-const char* pa__get_version(void);
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:pulseaudio-modules-droid-12.2.80.tar.bz2/src/droid/module-droid-keepalive.c
^
|
@@ -1,198 +0,0 @@
-/*
- * Copyright (C) 2013-2018 Jolla Ltd.
- *
- * Contact: Juho Hämäläinen <juho.hamalainen@jolla.com>
- *
- * These PulseAudio Modules are free software; you can redistribute
- * it and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <signal.h>
-#include <stdio.h>
-
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-#include <valgrind/memcheck.h>
-#endif
-
-#include <pulse/xmalloc.h>
-
-#include <pulsecore/core.h>
-#include <pulsecore/i18n.h>
-#include <pulsecore/module.h>
-#include <pulsecore/sink.h>
-#include <pulsecore/source.h>
-#include <pulsecore/modargs.h>
-#include <pulsecore/core-util.h>
-#include <pulsecore/log.h>
-#include <pulsecore/macro.h>
-#include <pulsecore/idxset.h>
-
-#include "keepalive.h"
-
-#include "module-droid-keepalive-symdef.h"
-
-PA_MODULE_AUTHOR("Juho Hämäläinen");
-PA_MODULE_DESCRIPTION("Droid keepalive. Send cpu wakeup heartbeat while streams are active.");
-PA_MODULE_VERSION(PACKAGE_VERSION);
-PA_MODULE_USAGE(
- "-"
-);
-
-static const char* const valid_modargs[] = {
- NULL,
-};
-
-struct userdata {
- pa_core *core;
- pa_module *module;
-
- pa_droid_keepalive *keepalive;
- bool active;
- pa_hook_slot *sink_state_changed_slot;
- pa_hook_slot *source_state_changed_slot;
-};
-
-static void start(struct userdata *u) {
- if (u->active)
- return;
-
- u->active = true;
-
- pa_droid_keepalive_start(u->keepalive);
-}
-
-static void stop(struct userdata *u) {
- void *state = NULL;
- pa_sink *sink;
- pa_source *source;
-
- if (!u->active)
- return;
-
- while ((sink = pa_idxset_iterate(u->core->sinks, &state, NULL))) {
- if (pa_sink_get_state(sink) != PA_SINK_SUSPENDED)
- return;
- }
-
- state = NULL;
- while ((source = pa_idxset_iterate(u->core->sources, &state, NULL))) {
- if (source->monitor_of)
- continue;
- if (pa_source_get_state(source) != PA_SOURCE_SUSPENDED)
- return;
- }
-
- /* We get here if all sinks and sources are in suspended state. */
- pa_droid_keepalive_stop(u->keepalive);
- u->active = false;
-}
-
-static void update_sink(pa_sink *sink, struct userdata *u) {
- pa_assert(sink);
- pa_assert(u);
-
- if (pa_sink_get_state(sink) != PA_SINK_SUSPENDED)
- start(u);
- else
- stop(u);
-}
-
-static void update_source(pa_source *source, struct userdata *u) {
- pa_assert(source);
- pa_assert(u);
-
- /* Don't react on monitor state changes. */
- if (!source->monitor_of) {
- if (pa_source_get_state(source) != PA_SOURCE_SUSPENDED)
- start(u);
- else
- stop(u);
- }
-}
-
-static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, struct userdata *u) {
- pa_assert(c);
- pa_object_assert_ref(o);
- pa_assert(u);
-
- if (pa_source_isinstance(o))
- update_source(PA_SOURCE(o), u);
- else if (pa_sink_isinstance(o))
- update_sink(PA_SINK(o), u);
-
- return PA_HOOK_OK;
-}
-
-
-int pa__init(pa_module *m) {
- uint32_t idx = 0;
- pa_sink *sink;
- pa_source *source;
- struct userdata *u;
-
- pa_assert(m);
-
- u = pa_xnew0(struct userdata, 1);
- u->core = m->core;
- u->active = false;
- u->module = m;
- m->userdata = u;
-
- if (!(u->keepalive = pa_droid_keepalive_new(u->core))) {
- pa_log("Failed to create keepalive handler.");
- goto fail;
- }
-
- u->sink_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) device_state_changed_hook_cb, u);
- u->source_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) device_state_changed_hook_cb, u);
-
- PA_IDXSET_FOREACH(source, u->core->sources, idx)
- update_source(source, u);
-
- PA_IDXSET_FOREACH(sink, u->core->sinks, idx)
- update_sink(sink, u);
-
- return 0;
-
-fail:
- pa__done(m);
-
- return -1;
-}
-
-void pa__done(pa_module *m) {
- struct userdata *u;
-
- pa_assert(m);
-
- if ((u = m->userdata)) {
-
- if (u->sink_state_changed_slot)
- pa_hook_slot_free(u->sink_state_changed_slot);
- if (u->source_state_changed_slot)
- pa_hook_slot_free(u->source_state_changed_slot);
-
- if (u->keepalive) {
- pa_droid_keepalive_stop(u->keepalive);
- pa_droid_keepalive_free(u->keepalive);
- }
-
- pa_xfree(u);
- }
-}
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/README
^
|
@@ -15,6 +15,7 @@
* 6.0.x
* 7.x
* 8.x
+ * 9.x
Headers for defining devices and strings for different droid versions are in
src/common/droid-util-audio.h (legacy headers for Jolla 1 in droid-util-41qc.h).
@@ -80,10 +81,12 @@
By default files are tried in following order,
- /vendor/etc/audio_policy_configuration.xml (new xml format)
- /vendor/etc/audio_policy.conf (legacy format)
- /system/etc/audio_policy_configuration.xml (new xml format)
- /system/etc/audio_policy.conf (legacy format)
+ /odm/etc/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio_policy_configuration.xml (new xml format)
+ /vendor/etc/audio_policy.conf (legacy format)
+ /system/etc/audio_policy_configuration.xml (new xml format)
+ /system/etc/audio_policy.conf (legacy format)
module-droid-card
-----------------
@@ -369,6 +372,14 @@
* Some HAL module implementations get stuck in mutex or segfault when
trying to unload the module. To avoid confusing segfaults call
exit(0) instead of calling unload for the module.
+ * output_fast
+ * Enabled by default.
+ * Create separate sink if AUDIO_OUTPUT_FLAG_FAST is found. If this sink
+ is misbehaving try disabling this quirk.
+ * output_deep_buffer
+ * Enabled by default.
+ * Create separate sink if AUDIO_OUTPUT_FLAG_DEEP_BUFFER is found. If
+ this sink is misbehaving try disabling this quirk.
For example, to disable input_atoi and enable close_input quirks, use module
argument
@@ -406,6 +417,4 @@
module-droid-keepalive
----------------------
-Keepalive module is MCE (https://github.com/nemomobile/mce) specific module
-tracking sink/source activity and keeping a WAKELOCK when there are active
-streams.
+Module relocated to its own package pulseaudio-module-keepalive.
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/configure.ac
^
|
@@ -183,10 +183,6 @@
AC_SUBST(HYBRIS_CFLAGS)
AC_SUBST(HYBRIS_LIBS)
-PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.2])
-AC_SUBST(DBUS_CFLAGS)
-AC_SUBST(DBUS_LIBS)
-
#### expat (for xml config format parsing) (optional) ####
AC_ARG_ENABLE([xml],
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/common/config-parser-xml.c
^
|
@@ -343,86 +343,70 @@
return str;
}
-static void device_free(struct device *d) {
- pa_assert(d);
- pa_xfree(d->name);
- pa_xfree(d);
-}
+static void device_list_free(struct device *list) {
+ struct device *d;
-static void profile_free(struct profile *p) {
- pa_assert(p);
- pa_xfree(p->name);
- pa_xfree(p);
+ while (list) {
+ SLLIST_STEAL_FIRST(d, list);
+ pa_xfree(d->name);
+ pa_xfree(d);
+ }
}
-static void mix_port_free(struct mix_port *p) {
- struct profile *profile;
-
- pa_assert(p);
+static void profile_list_free(struct profile *list) {
+ struct profile *p;
- while (p->profiles) {
- SLLIST_STEAL_FIRST(profile, p->profiles);
- profile_free(profile);
+ while (list) {
+ SLLIST_STEAL_FIRST(p, list);
+ pa_xfree(p->name);
+ pa_xfree(p);
};
-
- pa_xfree(p->name);
- pa_xfree(p->role);
- pa_xfree(p);
}
-static void device_port_free(struct device_port *p) {
- pa_assert(p);
- pa_xfree(p->tag_name);
- pa_xfree(p->role);
- pa_xfree(p);
+static void mix_port_list_free(struct mix_port *list) {
+ struct mix_port *p;
+
+ while (list) {
+ SLLIST_STEAL_FIRST(p, list);
+ profile_list_free(p->profiles);
+ pa_xfree(p->name);
+ pa_xfree(p->role);
+ pa_xfree(p);
+ }
}
-static void route_free(struct route *r) {
- struct device *d;
+static void device_port_list_free(struct device_port *list) {
+ struct device_port *p;
- pa_assert(r);
+ while (list) {
+ SLLIST_STEAL_FIRST(p, list);
+ profile_list_free(p->profiles);
+ pa_xfree(p->tag_name);
+ pa_xfree(p->role);
+ pa_xfree(p);
+ }
+}
- while (r->sources) {
- SLLIST_STEAL_FIRST(d, r->sources);
- device_free(d);
- }
- pa_xfree(r->type);
- pa_xfree(r->sink);
- pa_xfree(r);
+static void route_list_free(struct route *list) {
+ struct route *r;
+
+ while (list) {
+ SLLIST_STEAL_FIRST(r, list);
+ device_list_free(r->sources);
+ pa_xfree(r->type);
+ pa_xfree(r->sink);
+ pa_xfree(r);
+ }
}
static void module_free(struct module *m) {
- struct device *dev;
- struct mix_port *mix_port;
- struct device_port *device_port;
- struct route *route;
-
pa_assert(m);
- while (m->attached_devices) {
- SLLIST_STEAL_FIRST(dev, m->attached_devices);
- device_free(dev);
- };
-
- while (m->default_output) {
- SLLIST_STEAL_FIRST(dev, m->default_output);
- device_free(dev);
- };
-
- while (m->mix_ports) {
- SLLIST_STEAL_FIRST(mix_port, m->mix_ports);
- mix_port_free(mix_port);
- };
-
- while (m->device_ports) {
- SLLIST_STEAL_FIRST(device_port, m->device_ports);
- device_port_free(device_port);
- };
-
- while (m->routes) {
- SLLIST_STEAL_FIRST(route, m->routes);
- route_free(route);
- };
+ device_list_free(m->attached_devices);
+ device_list_free(m->default_output);
+ mix_port_list_free(m->mix_ports);
+ device_port_list_free(m->device_ports);
+ route_list_free(m->routes);
pa_xfree(m->name);
pa_xfree(m);
@@ -679,7 +663,7 @@
data->current_mix_port = p;
} else {
pa_log("[%s:%u] Failed to parse element <" ELEMENT_mixPort ">", data->fn, data->lineno);
- mix_port_free(p);
+ mix_port_list_free(p);
}
return parsed;
@@ -759,15 +743,15 @@
if (!parsed) {
pa_log_error("[%s:%u] Failed to parse element <" ELEMENT_profile ">", data->fn, data->lineno);
- profile_free(p);
+ profile_list_free(p);
} else if (unknown_format) {
pa_log_info("[%s:%u] Ignore profile with unknown format.", data->fn, data->lineno);
- profile_free(p);
+ profile_list_free(p);
} else {
if (data->current_mix_port)
- SLLIST_APPEND(struct profile, data->current_module->mix_ports->profiles, p);
+ SLLIST_APPEND(struct profile, data->current_mix_port->profiles, p);
else if (data->current_device_port)
- SLLIST_APPEND(struct profile, data->current_module->device_ports->profiles, p);
+ SLLIST_APPEND(struct profile, data->current_device_port->profiles, p);
else
pa_assert_not_reached();
}
@@ -802,10 +786,10 @@
if (!parsed) {
pa_log("[%s:%u] Failed to parse element <" ELEMENT_devicePort ">", data->fn, data->lineno);
- device_port_free(d);
+ device_port_list_free(d);
} else if (unknown_device) {
pa_log_info("[%s:%u] Ignore <" ELEMENT_devicePort "> with unknown device.", data->fn, data->lineno);
- device_port_free(d);
+ device_port_list_free(d);
} else {
SLLIST_APPEND(struct device_port, data->current_module->device_ports, d);
data->current_device_port = d;
@@ -844,7 +828,7 @@
SLLIST_APPEND(struct route, data->current_module->routes, r);
} else {
pa_log("[%s:%u] Failed to parse element <" ELEMENT_route ">", data->fn, data->lineno);
- route_free(r);
+ route_list_free(r);
}
return parsed;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/common/conversion.c
^
|
@@ -117,6 +117,34 @@
return str;
}
+/* Generic conversion */
+bool pa_string_convert_num_to_str(pa_conversion_string_t type, uint32_t value, const char **to_str) {
+ switch (type) {
+ case CONV_STRING_FORMAT:
+ return string_convert_num_to_str(string_conversion_table_format, value, to_str);
+
+ case CONV_STRING_OUTPUT_CHANNELS:
+ return string_convert_num_to_str(string_conversion_table_output_channels, value, to_str);
+
+ case CONV_STRING_INPUT_CHANNELS:
+ return string_convert_num_to_str(string_conversion_table_input_channels, value, to_str);
+
+ case CONV_STRING_OUTPUT_DEVICE:
+ return string_convert_num_to_str(string_conversion_table_output_device, value, to_str);
+
+ case CONV_STRING_INPUT_DEVICE:
+ return string_convert_num_to_str(string_conversion_table_input_device, value, to_str);
+
+ case CONV_STRING_OUTPUT_FLAG:
+ return string_convert_num_to_str(string_conversion_table_output_flag, value, to_str);
+
+ case CONV_STRING_INPUT_FLAG:
+ return string_convert_num_to_str(string_conversion_table_input_flag, value, to_str);
+ }
+
+ pa_assert_not_reached();
+ return false;
+}
/* Output device */
bool pa_string_convert_output_device_num_to_str(audio_devices_t value, const char **to_str) {
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/common/droid-config.c
^
|
@@ -66,6 +66,8 @@
#include <hardware/audio.h>
#include <hardware_legacy/audio_policy_conf.h>
+#define ODM_AUDIO_POLICY_CONFIG_XML_FILE "/odm/etc/audio_policy_configuration.xml"
+#define VENDOR_AUDIO_AUDIO_POLICY_CONFIG_XML_FILE "/vendor/etc/audio/audio_policy_configuration.xml"
#define VENDOR_AUDIO_POLICY_CONFIG_XML_FILE "/vendor/etc/audio_policy_configuration.xml"
#define SYSTEM_AUDIO_POLICY_CONFIG_XML_FILE "/system/etc/audio_policy_configuration.xml"
@@ -74,6 +76,8 @@
pa_droid_config_audio *config = NULL;
const char *manual_config;
const char *config_location[] = {
+ ODM_AUDIO_POLICY_CONFIG_XML_FILE,
+ VENDOR_AUDIO_AUDIO_POLICY_CONFIG_XML_FILE,
VENDOR_AUDIO_POLICY_CONFIG_XML_FILE,
AUDIO_POLICY_VENDOR_CONFIG_FILE,
SYSTEM_AUDIO_POLICY_CONFIG_XML_FILE,
@@ -195,6 +199,28 @@
return NULL;
}
+static const pa_droid_config_device *find_device(const pa_droid_config_hw_module *module, bool output, const char* device_name) {
+ pa_droid_config_device *device;
+
+ pa_assert(module);
+ pa_assert(device_name);
+
+ SLLIST_FOREACH(device, output ? module->outputs : module->inputs) {
+ if (pa_streq(device_name, device->name))
+ return device;
+ }
+
+ return NULL;
+}
+
+const pa_droid_config_device *pa_droid_config_find_output(const pa_droid_config_hw_module *module, const char* output_name) {
+ return find_device(module, true, output_name);
+}
+
+const pa_droid_config_device *pa_droid_config_find_input(const pa_droid_config_hw_module *module, const char* input_name) {
+ return find_device(module, false, input_name);
+}
+
pa_droid_config_hw_module *pa_droid_config_hw_module_new(const pa_droid_config_audio *config, const char *name) {
pa_droid_config_hw_module *hw_module;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/common/droid-util.c
^
|
@@ -80,10 +80,13 @@
{ "output_make_writable", QUIRK_OUTPUT_MAKE_WRITABLE },
{ "realcall", QUIRK_REALCALL },
{ "unload_call_exit", QUIRK_UNLOAD_CALL_EXIT },
+ { "output_fast", QUIRK_OUTPUT_FAST },
+ { "output_deep_buffer", QUIRK_OUTPUT_DEEP_BUFFER },
};
-#define DEFAULT_PRIORITY (100)
+#define DEFAULT_PRIORITY (100)
+#define DEFAULT_AUDIO_FORMAT (AUDIO_FORMAT_PCM_16_BIT)
static const char * const droid_combined_auto_outputs[3] = { "primary", "low_latency", NULL };
@@ -91,8 +94,7 @@
static void droid_port_free(pa_droid_port *p);
-static pa_droid_stream *get_primary_output(pa_droid_hw_module *hw);
-static int input_stream_set_route(pa_droid_hw_module *hw_module);
+static int input_stream_set_route(pa_droid_hw_module *hw_module, pa_droid_stream *s);
static pa_droid_profile *profile_new(pa_droid_profile_set *ps,
const pa_droid_config_hw_module *module,
@@ -259,8 +261,8 @@
pa_assert(ps);
pa_assert(module);
pa_assert(!primary_output || primary_output->direction == PA_DIRECTION_OUTPUT);
- pa_assert(!low_latency_output || primary_output->direction == PA_DIRECTION_OUTPUT);
- pa_assert(!media_latency_output || primary_output->direction == PA_DIRECTION_OUTPUT);
+ pa_assert(!low_latency_output || low_latency_output->direction == PA_DIRECTION_OUTPUT);
+ pa_assert(!media_latency_output || media_latency_output->direction == PA_DIRECTION_OUTPUT);
pa_log_debug("New default profile");
@@ -709,8 +711,12 @@
static pa_droid_quirks *set_default_quirks(pa_droid_quirks *q) {
q = NULL;
-#if (ANDROID_VERSION_MAJOR >= 5) || defined(DROID_AUDIO_HAL_ATOI_FIX)
q = get_quirks(q);
+ q->enabled[QUIRK_CLOSE_INPUT] = true;
+ q->enabled[QUIRK_OUTPUT_FAST] = true;
+ q->enabled[QUIRK_OUTPUT_DEEP_BUFFER] = true;
+
+#if (ANDROID_VERSION_MAJOR >= 5) || defined(DROID_AUDIO_HAL_ATOI_FIX)
q->enabled[QUIRK_INPUT_ATOI] = true;
#endif
@@ -720,13 +726,9 @@
defined(DROID_DEVICE_MANGO) || defined(DROID_DEVICE_SATSUMA) ||\
defined(DROID_DEVICE_SMULTRON) || defined(DROID_DEVICE_URUSHI)
#warning Using set_parameters hack, originating from previous cm10 mako.
- q = get_quirks(q);
q->enabled[QUIRK_SET_PARAMETERS] = true;
#endif
- q = get_quirks(q);
- q->enabled[QUIRK_CLOSE_INPUT] = true;
-
return q;
}
@@ -797,10 +799,10 @@
if (s->output->flags & AUDIO_OUTPUT_FLAG_PRIMARY)
primary_sink = sink;
- if (s->output->flags & AUDIO_OUTPUT_FLAG_FAST)
+ if (pa_droid_quirk(hw, QUIRK_OUTPUT_FAST) && s->output->flags & AUDIO_OUTPUT_FLAG_FAST)
low_latency_sink = sink;
- if (s->output->flags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER)
+ if (pa_droid_quirk(hw, QUIRK_OUTPUT_DEEP_BUFFER) && s->output->flags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER)
media_latency_sink = sink;
#if defined(HAVE_ENUM_AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)
@@ -1044,13 +1046,15 @@
pa_mutex_unlock(hw->hw_mutex);
}
-static pa_droid_stream *droid_stream_new(pa_droid_hw_module *module) {
+static pa_droid_stream *droid_stream_new(pa_droid_hw_module *module,
+ const pa_droid_config_device *device_def) {
pa_droid_stream *s;
s = pa_xnew0(pa_droid_stream, 1);
PA_REFCNT_INIT(s);
s->module = pa_droid_hw_module_ref(module);
+ s->device_def = device_def;
return s;
}
@@ -1060,10 +1064,37 @@
}
static pa_droid_input_stream *droid_input_stream_new(void) {
- return pa_xnew0(pa_droid_input_stream, 1);
+ pa_droid_input_stream *input = pa_xnew0(pa_droid_input_stream, 1);
+ input->first = true;
+
+ return input;
+}
+
+static int stream_standby(pa_droid_stream *s) {
+ int ret = 0;
+
+ pa_assert(s);
+ pa_assert(s->output || s->input);
+
+ if ((s->output && !s->output->stream) ||
+ (s->input && !s->input->stream))
+ return ret;
+
+ if (s->output) {
+ pa_mutex_lock(s->module->output_mutex);
+ ret = s->output->stream->common.standby(&s->output->stream->common);
+ pa_mutex_unlock(s->module->output_mutex);
+ } else {
+ pa_mutex_lock(s->module->input_mutex);
+ ret = s->input->stream->common.standby(&s->input->stream->common);
+ pa_mutex_unlock(s->module->input_mutex);
+ }
+
+ return ret;
}
-static bool stream_config_fill(audio_devices_t devices,
+static bool stream_config_fill(const pa_droid_config_device *device_def,
+ audio_devices_t devices,
pa_sample_spec *sample_spec,
pa_channel_map *channel_map,
struct audio_config *config) {
@@ -1071,6 +1102,7 @@
audio_channel_mask_t hal_channel_mask = 0;
bool voicecall_record = false;
bool output = true;
+ int i;
pa_assert(sample_spec);
pa_assert(channel_map);
@@ -1085,15 +1117,12 @@
output = !(devices & AUDIO_DEVICE_IN_ALL);
#endif
- if (devices & AUDIO_DEVICE_IN_VOICE_CALL)
+ if (devices & AUDIO_DEVICE_IN_VOICE_CALL) {
+ pa_log_debug("Fill config: Use voice call");
voicecall_record = true;
-
- if (!pa_convert_format(sample_spec->format, CONV_FROM_PA, &hal_audio_format)) {
- pa_log("Sample spec format %u not supported.", sample_spec->format);
- goto fail;
}
- for (int i = 0; i < channel_map->channels; i++) {
+ for (i = 0; i < channel_map->channels; i++) {
bool found;
audio_channel_mask_t c;
@@ -1127,8 +1156,81 @@
sample_spec->channels = 1;
hal_channel_mask = AUDIO_CHANNEL_IN_MONO;
#endif
+ pa_log_debug("Fill config: Use %d channel(s) for voice call.", sample_spec->channels);
+ }
+
+ if (!pa_convert_format(sample_spec->format, CONV_FROM_PA, &hal_audio_format)) {
+ pa_log_warn("Sample spec format %u not supported.", sample_spec->format);
+ goto fail;
}
+ /* As input sample metrics are based on user request we need to make sure that the sample
+ * format requested is actually usable with the input route. */
+ if (!output) {
+ const pa_droid_config_device *ddef;
+ uint32_t tmp;
+ const char *fmt;
+ uint32_t format_found = 0;
+
+ pa_log_debug("Fill config: Try to use format %s, sample rate %u",
+ pa_string_convert_num_to_str(CONV_STRING_FORMAT, hal_audio_format, &fmt) ? fmt : "<unknown>",
+ sample_spec->rate);
+
+ SLLIST_FOREACH(ddef, device_def) {
+ format_found |= ddef->formats & hal_audio_format;
+
+ if (!(ddef->formats & hal_audio_format) ||
+ !(ddef->devices & devices))
+ continue;
+
+ for (i = 0; i < AUDIO_MAX_SAMPLING_RATES && ddef->sampling_rates[i]; i++) {
+ if (ddef->sampling_rates[i] == (uint32_t) -1 ||
+ ddef->sampling_rates[i] == sample_spec->rate) {
+ goto format_found;
+ }
+ }
+ }
+
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/common/include/droid/conversion.h
^
|
@@ -55,6 +55,8 @@
CONV_STRING_INPUT_FLAG
} pa_conversion_string_t;
+bool pa_string_convert_num_to_str(pa_conversion_string_t type, uint32_t value, const char **to_str);
+
bool pa_convert_output_channel(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
bool pa_convert_input_channel(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
bool pa_convert_format(uint32_t value, pa_conversion_field_t from, uint32_t *to_value);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/common/include/droid/droid-config.h
^
|
@@ -91,6 +91,8 @@
pa_droid_config_audio *pa_parse_droid_audio_config(const char *filename);
const pa_droid_config_hw_module *pa_droid_config_find_module(const pa_droid_config_audio *config, const char* module_id);
+const pa_droid_config_device *pa_droid_config_find_output(const pa_droid_config_hw_module *module, const char* output_name);
+const pa_droid_config_device *pa_droid_config_find_input(const pa_droid_config_hw_module *module, const char* input_name);
pa_droid_config_hw_module *pa_droid_config_hw_module_new(const pa_droid_config_audio *config, const char *name);
void pa_droid_config_hw_module_free(pa_droid_config_hw_module *hw_module);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/common/include/droid/droid-util.h
^
|
@@ -116,18 +116,22 @@
struct pa_droid_input_stream {
struct audio_stream_in *stream;
+ pa_sample_spec default_sample_spec;
+ pa_channel_map default_channel_map;
pa_sample_spec sample_spec;
pa_channel_map channel_map;
pa_sample_spec req_sample_spec;
pa_channel_map req_channel_map;
uint32_t flags;
uint32_t device;
+ bool first;
};
struct pa_droid_stream {
PA_REFCNT_DECLARE;
pa_droid_hw_module *module;
+ const pa_droid_config_device *device_def;
size_t buffer_size;
void *data;
@@ -222,6 +226,8 @@
QUIRK_OUTPUT_MAKE_WRITABLE,
QUIRK_REALCALL,
QUIRK_UNLOAD_CALL_EXIT,
+ QUIRK_OUTPUT_FAST,
+ QUIRK_OUTPUT_DEEP_BUFFER,
QUIRK_COUNT
};
@@ -275,6 +281,7 @@
/* Module operations */
int pa_droid_set_parameters(pa_droid_hw_module *hw, const char *parameters);
+pa_droid_stream *pa_droid_hw_primary_output_stream(pa_droid_hw_module *hw);
/* Stream operations */
pa_droid_stream *pa_droid_stream_ref(pa_droid_stream *s);
@@ -286,7 +293,7 @@
pa_droid_stream *pa_droid_open_output_stream(pa_droid_hw_module *module,
const pa_sample_spec *spec,
const pa_channel_map *map,
- audio_output_flags_t flags,
+ const char *module_output_name,
audio_devices_t devices);
/* Set routing to the input or output stream, with following side-effects:
@@ -303,8 +310,11 @@
/* Open input stream with currently active routing, sample_spec and channel_map
* are requests and may change when opening the stream. */
pa_droid_stream *pa_droid_open_input_stream(pa_droid_hw_module *hw_module,
- const pa_sample_spec *requested_sample_spec,
- const pa_channel_map *requested_channel_map);
+ const pa_sample_spec *default_sample_spec,
+ const pa_channel_map *default_channel_map);
+bool pa_droid_stream_reconfigure_input(pa_droid_stream *s,
+ const pa_sample_spec *requested_sample_spec,
+ const pa_channel_map *requested_channel_map);
bool pa_droid_hw_set_input_device(pa_droid_hw_module *hw_module,
audio_devices_t device);
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/droid/Makefile.am
^
|
@@ -15,17 +15,11 @@
modlibexec_LTLIBRARIES = \
libdroid-sink.la \
libdroid-source.la \
- module-droid-keepalive.la \
module-droid-sink.la \
module-droid-source.la \
module-droid-card.la
-noinst_HEADERS = module-droid-sink-symdef.h module-droid-source-symdef.h module-droid-card-symdef.h module-droid-keepalive-symdef.h
-
-module_droid_keepalive_la_SOURCES = keepalive.c keepalive.h module-droid-keepalive.c
-module_droid_keepalive_la_LDFLAGS = -module -avoid-version -Wl,-z,noexecstack
-module_droid_keepalive_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS)
-module_droid_keepalive_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
+noinst_HEADERS = module-droid-sink-symdef.h module-droid-source-symdef.h module-droid-card-symdef.h
libdroid_sink_la_SOURCES = droid-sink.c droid-sink.h
libdroid_sink_la_LDFLAGS = -avoid-version -Wl,-z,noexecstack -lhybris-common
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/droid/droid-sink.c
^
|
@@ -54,6 +54,7 @@
#include <pulsecore/time-smoother.h>
#include <pulsecore/hashmap.h>
#include <pulsecore/core-subscribe.h>
+#include <pulse/version.h>
#include "droid-sink.h"
#include <droid/droid-util.h>
@@ -371,7 +372,11 @@
pa_log_debug("Thread starting up.");
if (u->core->realtime_scheduling)
+#if PA_CHECK_VERSION(13,0,0)
+ pa_thread_make_realtime(u->core->realtime_priority);
+#else
pa_make_realtime(u->core->realtime_priority);
+#endif
pa_thread_mq_install(&u->thread_mq);
@@ -1041,6 +1046,7 @@
pa_card *card) {
struct userdata *u = NULL;
+ const pa_droid_config_device *output = NULL;
bool deferred_volume = false;
char *thread_name = NULL;
pa_sink_new_data data;
@@ -1063,15 +1069,18 @@
pa_assert(ma);
pa_assert(driver);
+ pa_log_info("Create new droid-sink");
+
deferred_volume = m->core->deferred_volume;
if (pa_modargs_get_value_boolean(ma, "deferred_volume", &deferred_volume) < 0) {
pa_log("Failed to parse deferred_volume argument.");
goto fail;
}
- if (card && am)
- module_id = am->output->module->name;
- else
+ if (card && am) {
+ output = am->output;
+ module_id = output->module->name;
+ } else
module_id = pa_modargs_get_value(ma, "module_id", DEFAULT_MODULE_ID);
sample_spec = m->core->default_sample_spec;
@@ -1145,6 +1154,18 @@
pa_assert(card);
pa_assert_se((u->hw_module = pa_droid_hw_module_get(u->core, NULL, card_data->module_id)));
} else {
+ const char *output_name;
+
+ if (!(output_name = pa_modargs_get_value(ma, "output", NULL))) {
+ pa_log("No output name defined.");
+ goto fail;
+ }
+
+ if (!(output = pa_droid_config_find_output(u->hw_module->enabled_module, output_name))) {
+ pa_log("Could not find output %s from module %s.", output_name, u->hw_module->enabled_module->name);
+ goto fail;
+ }
+
/* Sink wasn't created from inside card module, so we'll need to open
* hw module ourself.
*
@@ -1164,8 +1185,8 @@
}
/* Default routing */
- dev_out = (am && am->output->module->global_config) ? am->output->module->global_config->default_output_device
- : u->hw_module->config->global_config->default_output_device;
+ dev_out = output->module->global_config ? output->module->global_config->default_output_device
+ : u->hw_module->config->global_config->default_output_device;
if ((tmp = pa_modargs_get_value(ma, "output_devices", NULL))) {
audio_devices_t tmp_dev;
@@ -1176,10 +1197,9 @@
pa_log_debug("Set initial devices %s", tmp);
}
- if (am)
- flags = am->output->flags;
+ flags = output->flags;
- u->stream = pa_droid_open_output_stream(u->hw_module, &sample_spec, &channel_map, flags, dev_out);
+ u->stream = pa_droid_open_output_stream(u->hw_module, &sample_spec, &channel_map, output->name, dev_out);
if (!u->stream) {
pa_log("Failed to open output stream.");
@@ -1194,7 +1214,7 @@
pa_log_info("Using buffer size %u.", u->buffer_size);
if ((prewrite_resume = pa_modargs_get_value(ma, "prewrite_on_resume", NULL))) {
- if (!parse_prewrite_on_resume(u, prewrite_resume, am ? am->output->name : module_id)) {
+ if (!parse_prewrite_on_resume(u, prewrite_resume, output->name)) {
pa_log("Failed to parse prewrite_on_resume (%s)", prewrite_resume);
goto fail;
}
@@ -1211,10 +1231,7 @@
data.module = m;
data.card = card;
- if (am)
- set_sink_name(ma, &data, am->output->name);
- else
- set_sink_name(ma, &data, module_id);
+ set_sink_name(ma, &data, output->name);
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_CLASS, "sound");
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_API, PROP_DROID_API_STRING);
@@ -1280,10 +1297,7 @@
/* Rewind internal memblockq */
pa_sink_set_max_rewind(u->sink, 0);
- if (am)
- thread_name = pa_sprintf_malloc("droid-sink-%s", am->output->name);
- else
- thread_name = pa_sprintf_malloc("droid-sink-%s", module_id);
+ thread_name = pa_sprintf_malloc("droid-sink-%s", output->name);
if (!(u->thread = pa_thread_new(thread_name, thread_func, u))) {
pa_log("Failed to create thread.");
goto fail;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/droid/droid-source.c
^
|
@@ -51,6 +51,7 @@
#include <pulsecore/rtpoll.h>
#include <pulsecore/time-smoother.h>
#include <pulsecore/resampler.h>
+#include <pulse/version.h>
#include "droid-source.h"
#include <droid/droid-util.h>
@@ -81,10 +82,6 @@
bool stream_valid;
};
-enum {
- SOURCE_MESSAGE_DO_ROUTING = PA_SOURCE_MESSAGE_MAX
-};
-
#define DEFAULT_MODULE_ID "primary"
#define DROID_AUDIO_SOURCE "droid.audio_source"
@@ -93,6 +90,10 @@
static void userdata_free(struct userdata *u);
static int suspend(struct userdata *u);
static void unsuspend(struct userdata *u);
+static void source_reconfigure(struct userdata *u,
+ const pa_sample_spec *reconfigure_sample_spec,
+ const pa_channel_map *reconfigure_channel_map,
+ audio_devices_t update_device);
/* Our droid source may be left in a state of not having an input stream
* if reconfiguration fails and fallback to previously active values fails
@@ -211,7 +212,11 @@
pa_log_debug("Thread starting up.");
if (u->core->realtime_scheduling)
+#if PA_CHECK_VERSION(13,0,0)
+ pa_thread_make_realtime(u->core->realtime_priority);
+#else
pa_make_realtime(u->core->realtime_priority);
+#endif
pa_thread_mq_install(&u->thread_mq);
@@ -321,28 +326,17 @@
/* Called from IO context */
static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
+#if PULSEAUDIO_VERSION < 12
struct userdata *u = PA_SOURCE(o)->userdata;
switch (code) {
- case SOURCE_MESSAGE_DO_ROUTING: {
- audio_devices_t device = PA_PTR_TO_UINT(data);
-
- pa_assert(PA_SOURCE_IS_OPENED(u->source->thread_info.state));
-
- suspend(u);
- do_routing(u, device);
- unsuspend(u);
- break;
- }
-
-#if PULSEAUDIO_VERSION < 12
case PA_SOURCE_MESSAGE_SET_STATE: {
int r;
if ((r = source_set_state_in_io_thread_cb(u->source, PA_PTR_TO_UINT(data), 0)) < 0)
return r;
}
-#endif
}
+#endif
return pa_source_process_msg(o, code, data, offset, chunk);
}
@@ -366,11 +360,10 @@
pa_log_debug("Source set port %#010x", data->device);
- if (!PA_SOURCE_IS_OPENED(pa_source_get_state(u->source)))
+ if (!PA_SOURCE_IS_OPENED(u->source->state))
do_routing(u, data->device);
- else {
- pa_asyncmsgq_post(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_DO_ROUTING, PA_UINT_TO_PTR(data->device), 0, NULL, NULL);
- }
+ else
+ source_reconfigure(u, NULL, NULL, data->device);
return 0;
}
@@ -449,23 +442,16 @@
pa_log_debug("Set fixed latency %" PRIu64 " usec", pa_bytes_to_usec(u->buffer_size, pa_droid_stream_sample_spec(u->stream)));
}
-static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_output_new_data *new_data, struct userdata *u) {
+static void source_reconfigure(struct userdata *u,
+ const pa_sample_spec *reconfigure_sample_spec,
+ const pa_channel_map *reconfigure_channel_map,
+ audio_devices_t update_device) {
pa_channel_map old_channel_map;
pa_sample_spec old_sample_spec;
pa_channel_map new_channel_map;
pa_sample_spec new_sample_spec;
pa_queue *source_outputs = NULL;
- /* Not meant for us */
- if (new_data->source != u->source)
- return PA_HOOK_OK;
-
- if (pa_sample_spec_equal(&new_data->sample_spec, pa_droid_stream_sample_spec(u->stream)) &&
- pa_channel_map_equal(&new_data->channel_map, pa_droid_stream_channel_map(u->stream)))
- return PA_HOOK_OK;
-
- pa_log_info("New source-output connecting and our source needs to be reconfigured.");
-
if (pa_source_used_by(u->source)) {
/* If we already have connected source outputs detach those
* so that when re-attaching them to our source resampling etc.
@@ -477,25 +463,26 @@
old_channel_map = *pa_droid_stream_channel_map(u->stream);
old_sample_spec = *pa_droid_stream_sample_spec(u->stream);
- new_channel_map = new_data->channel_map;
- new_sample_spec = new_data->sample_spec;
+ new_channel_map = reconfigure_channel_map ? *reconfigure_channel_map : old_channel_map;
+ new_sample_spec = reconfigure_sample_spec ? *reconfigure_sample_spec : old_sample_spec;
+
+ if (update_device)
+ do_routing(u, update_device);
- pa_droid_stream_unref(u->stream);
- if (!(u->stream = pa_droid_open_input_stream(u->hw_module, &new_sample_spec, &new_channel_map)))
- u->stream = pa_droid_open_input_stream(u->hw_module, &old_sample_spec, &old_channel_map);
-
- if (u->stream) {
- /* We need to be really careful here as we are modifying
- * quite profound internal structures. */
- new_sample_spec = *pa_droid_stream_sample_spec(u->stream);
- new_channel_map = *pa_droid_stream_channel_map(u->stream);
- u->source->channel_map = new_channel_map;
- u->source->sample_spec = new_sample_spec;
- pa_assert_se(pa_cvolume_remap(&u->source->reference_volume, &old_channel_map, &new_channel_map));
- pa_assert_se(pa_cvolume_remap(&u->source->real_volume, &old_channel_map, &new_channel_map));
- pa_assert_se(pa_cvolume_remap(&u->source->soft_volume, &old_channel_map, &new_channel_map));
+ if (pa_droid_stream_reconfigure_input(u->stream, &new_sample_spec, &new_channel_map))
pa_log_info("Source reconfigured.");
- }
+ else
+ pa_log_info("Failed to reconfigure input stream, no worries, using defaults.");
+
+ /* We need to be really careful here as we are modifying
+ * quite profound internal structures. */
+ new_sample_spec = *pa_droid_stream_sample_spec(u->stream);
+ new_channel_map = *pa_droid_stream_channel_map(u->stream);
+ u->source->channel_map = new_channel_map;
+ u->source->sample_spec = new_sample_spec;
+ pa_assert_se(pa_cvolume_remap(&u->source->reference_volume, &old_channel_map, &new_channel_map));
+ pa_assert_se(pa_cvolume_remap(&u->source->real_volume, &old_channel_map, &new_channel_map));
+ pa_assert_se(pa_cvolume_remap(&u->source->soft_volume, &old_channel_map, &new_channel_map));
update_latency(u);
pa_source_suspend(u->source, false, PA_SUSPEND_UNAVAILABLE);
@@ -503,10 +490,71 @@
if (source_outputs && u->source) {
pa_source_move_all_finish(u->source, source_outputs, false);
}
+}
+
+static pa_hook_result_t source_output_new_hook_callback(void *hook_data,
+ void *call_data,
+ void *slot_data) {
+ pa_source_output_new_data *new_data = call_data;
+ struct userdata *u = slot_data;
+ pa_droid_stream *primary_output;
+
+ /* Not meant for us */
+ if (new_data->source != u->source)
+ return PA_HOOK_OK;
+
+ if (pa_sample_spec_equal(&new_data->sample_spec, pa_droid_stream_sample_spec(u->stream)) &&
+ pa_channel_map_equal(&new_data->channel_map, pa_droid_stream_channel_map(u->stream)))
+ return PA_HOOK_OK;
+
+ pa_log_info("New source-output connecting and our source needs to be reconfigured.");
+
+ /* Workaround for fm-radio loopback */
+ if (pa_safe_streq(pa_proplist_gets(new_data->proplist, "media.name"), "fmradio-loopback-source") &&
+ (primary_output = pa_droid_hw_primary_output_stream(u->hw_module))) {
+ pa_log_debug("Workaround for fm-radio loopback.");
+ source_reconfigure(u,
+ pa_droid_stream_sample_spec(primary_output),
+ pa_droid_stream_channel_map(primary_output),
+ 0);
+
+ } else
+ source_reconfigure(u, &new_data->sample_spec, &new_data->channel_map, 0);
return PA_HOOK_OK;
}
+static void source_reconfigure_after_changes(struct userdata *u) {
+ pa_source_output *so = NULL;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/droid/module-droid-card.c
^
|
@@ -300,6 +300,19 @@
data->namereg_fail = false;
}
+static bool output_enabled(struct userdata *u, pa_droid_mapping *am) {
+ pa_assert(u);
+ pa_assert(am);
+
+ if (!pa_droid_quirk(u->hw_module, QUIRK_OUTPUT_FAST) && am->output->flags & AUDIO_OUTPUT_FLAG_FAST)
+ return false;
+
+ if (!pa_droid_quirk(u->hw_module, QUIRK_OUTPUT_DEEP_BUFFER) && am->output->flags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER)
+ return false;
+
+ return true;
+}
+
static void add_profile(struct userdata *u, pa_hashmap *h, pa_hashmap *ports, pa_droid_profile *ap) {
pa_card_profile *cp;
struct profile_data *d;
@@ -320,6 +333,9 @@
max_channels = 0;
PA_IDXSET_FOREACH(am, ap->output_mappings, idx) {
+ if (!output_enabled(u, am))
+ continue;
+
cp->n_sinks++;
pa_droid_add_card_ports(cp, ports, am, u->core);
max_channels = popcount(am->output->channel_masks) > max_channels
@@ -373,6 +389,9 @@
if (d->droid_profile && pa_idxset_size(d->droid_profile->output_mappings) > 0) {
PA_IDXSET_FOREACH(am, d->droid_profile->output_mappings, idx) {
+ if (!output_enabled(u, am))
+ continue;
+
am->sink = pa_droid_sink_new(u->module, u->modargs, __FILE__, &u->card_data, 0, am, u->card);
}
}
@@ -661,6 +680,9 @@
if (next->droid_profile && pa_idxset_size(next->droid_profile->output_mappings) > 0) {
PA_IDXSET_FOREACH(am, next->droid_profile->output_mappings, idx) {
+ if (!output_enabled(u, am))
+ continue;
+
if (!am->sink)
am->sink = pa_droid_sink_new(u->module, u->modargs, __FILE__, &u->card_data, 0, am, u->card);
@@ -711,6 +733,8 @@
pa_assert(m);
+ pa_log_info("Create new droid-card");
+
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments.");
goto fail;
|
[-]
[+]
|
Changed |
_service:tar_git:pulseaudio-modules-droid-12.2.83.tar.bz2/src/droid/module-droid-sink.c
^
|
@@ -60,6 +60,7 @@
"sink_channel_map",
"sink_mix_route",
"flags",
+ "output",
"output_devices",
"sink_name",
"module_id",
|