summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/alsa/alsa-sink.c2
-rw-r--r--src/modules/alsa/alsa-source.c2
-rw-r--r--src/modules/alsa/alsa-util.c16
-rw-r--r--src/modules/dbus/iface-card.c30
-rw-r--r--src/modules/dbus/iface-client.c16
-rw-r--r--src/modules/dbus/iface-core.c272
-rw-r--r--src/modules/dbus/iface-device.c72
-rw-r--r--src/modules/dbus/iface-module.c16
-rw-r--r--src/modules/dbus/iface-sample.c16
-rw-r--r--src/modules/dbus/iface-stream.c100
-rw-r--r--src/modules/dbus/module-dbus-protocol.c14
-rw-r--r--src/modules/module-device-manager.c14
-rw-r--r--src/modules/module-equalizer-sink.c87
-rw-r--r--src/modules/module-pipe-sink.c7
-rw-r--r--src/modules/module-pipe-source.c7
-rw-r--r--src/modules/module-solaris.c2
-rw-r--r--src/modules/module-stream-restore.c50
17 files changed, 389 insertions, 334 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 856adb14..ed16c834 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -983,7 +983,7 @@ static int unsuspend(struct userdata *u) {
buffer_size*u->frame_size != u->hwbuf_size) {
pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %lu/%lu, New %lu/%lu)",
(unsigned long) u->hwbuf_size, (unsigned long) u->fragment_size,
- (unsigned long) (buffer_size*u->fragment_size), (unsigned long) (period_size*u->frame_size));
+ (unsigned long) (buffer_size*u->frame_size), (unsigned long) (period_size*u->frame_size));
goto fail;
}
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index e775b20c..157698e3 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -930,7 +930,7 @@ static int unsuspend(struct userdata *u) {
buffer_size*u->frame_size != u->hwbuf_size) {
pa_log_warn("Resume failed, couldn't restore original fragment settings. (Old: %lu/%lu, New %lu/%lu)",
(unsigned long) u->hwbuf_size, (unsigned long) u->fragment_size,
- (unsigned long) (buffer_size*u->fragment_size), (unsigned long) (period_size*u->frame_size));
+ (unsigned long) (buffer_size*u->frame_size), (unsigned long) (period_size*u->frame_size));
goto fail;
}
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index b8d13575..52f12599 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -259,6 +259,10 @@ int pa_alsa_set_hw_params(
goto finish;
}
+ /* We ignore very small sampling rate deviations */
+ if (_ss.rate >= ss->rate*.95 && _ss.rate <= ss->rate*1.05)
+ _ss.rate = ss->rate;
+
if (require_exact_channel_number) {
if ((ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, _ss.channels)) < 0) {
pa_log_debug("snd_pcm_hw_params_set_channels(%u) failed: %s", _ss.channels, pa_alsa_strerror(ret));
@@ -303,7 +307,7 @@ int pa_alsa_set_hw_params(
if (set_buffer_size(pcm_handle, hwparams_copy, _buffer_size) >= 0 &&
set_period_size(pcm_handle, hwparams_copy, _period_size) >= 0 &&
snd_pcm_hw_params(pcm_handle, hwparams_copy) >= 0) {
- pa_log_debug("Set buffer size first, period size second.");
+ pa_log_debug("Set buffer size first (to %lu samples), period size second (to %lu samples).", (unsigned long) _buffer_size, (unsigned long) _period_size);
goto success;
}
@@ -311,7 +315,7 @@ int pa_alsa_set_hw_params(
if (set_period_size(pcm_handle, hwparams_copy, _period_size) >= 0 &&
set_buffer_size(pcm_handle, hwparams_copy, _buffer_size) >= 0 &&
snd_pcm_hw_params(pcm_handle, hwparams_copy) >= 0) {
- pa_log_debug("Set period size first, buffer size second.");
+ pa_log_debug("Set period size first (to %lu samples), buffer size second (to %lu samples).", (unsigned long) _period_size, (unsigned long) _buffer_size);
goto success;
}
}
@@ -322,7 +326,7 @@ int pa_alsa_set_hw_params(
/* Third try: set only buffer size */
if (set_buffer_size(pcm_handle, hwparams_copy, _buffer_size) >= 0 &&
snd_pcm_hw_params(pcm_handle, hwparams_copy) >= 0) {
- pa_log_debug("Set only buffer size second.");
+ pa_log_debug("Set only buffer size (to %lu samples).", (unsigned long) _buffer_size);
goto success;
}
}
@@ -333,7 +337,7 @@ int pa_alsa_set_hw_params(
/* Fourth try: set only period size */
if (set_period_size(pcm_handle, hwparams_copy, _period_size) >= 0 &&
snd_pcm_hw_params(pcm_handle, hwparams_copy) >= 0) {
- pa_log_debug("Set only period size second.");
+ pa_log_debug("Set only period size (to %lu samples).", (unsigned long) _period_size);
goto success;
}
}
@@ -374,9 +378,7 @@ success:
goto finish;
}
- /* If the sample rate deviates too much, we need to resample */
- if (_ss.rate < ss->rate*.95 || _ss.rate > ss->rate*1.05)
- ss->rate = _ss.rate;
+ ss->rate = _ss.rate;
ss->channels = _ss.channels;
ss->format = _ss.format;
diff --git a/src/modules/dbus/iface-card.c b/src/modules/dbus/iface-card.c
index 1714df36..d99c8b95 100644
--- a/src/modules/dbus/iface-card.c
+++ b/src/modules/dbus/iface-card.c
@@ -452,7 +452,7 @@ static void handle_get_profile_by_name(DBusConnection *conn, DBusMessage *msg, v
static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
pa_dbusiface_card *c = userdata;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
pa_assert(core);
pa_assert((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_CARD);
@@ -472,14 +472,14 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
c->active_profile = c->card->active_profile;
object_path = pa_dbusiface_card_profile_get_path(pa_hashmap_get(c->profiles, c->active_profile->name));
- pa_assert_se(signal = dbus_message_new_signal(c->path,
- PA_DBUSIFACE_CARD_INTERFACE,
- signals[SIGNAL_ACTIVE_PROFILE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se(signal_msg = dbus_message_new_signal(c->path,
+ PA_DBUSIFACE_CARD_INTERFACE,
+ signals[SIGNAL_ACTIVE_PROFILE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
if (!pa_proplist_equal(c->proplist, c->card->proplist)) {
@@ -487,15 +487,15 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
pa_proplist_update(c->proplist, PA_UPDATE_SET, c->card->proplist);
- pa_assert_se(signal = dbus_message_new_signal(c->path,
- PA_DBUSIFACE_CARD_INTERFACE,
- signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(c->path,
+ PA_DBUSIFACE_CARD_INTERFACE,
+ signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
pa_dbus_append_proplist(&msg_iter, c->proplist);
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
diff --git a/src/modules/dbus/iface-client.c b/src/modules/dbus/iface-client.c
index 546370f9..31924487 100644
--- a/src/modules/dbus/iface-client.c
+++ b/src/modules/dbus/iface-client.c
@@ -391,7 +391,7 @@ static void handle_remove_properties(DBusConnection *conn, DBusMessage *msg, voi
static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
pa_dbusiface_client *c = userdata;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
pa_assert(core);
pa_assert((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_CLIENT);
@@ -410,15 +410,15 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
pa_proplist_update(c->proplist, PA_UPDATE_SET, c->client->proplist);
- pa_assert_se(signal = dbus_message_new_signal(c->path,
- PA_DBUSIFACE_CLIENT_INTERFACE,
- signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(c->path,
+ PA_DBUSIFACE_CLIENT_INTERFACE,
+ signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
pa_dbus_append_proplist(&msg_iter, c->proplist);
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c
index 169e8e55..497b59b5 100644
--- a/src/modules/dbus/iface-core.c
+++ b/src/modules/dbus/iface-core.c
@@ -1488,7 +1488,7 @@ static void handle_exit(DBusConnection *conn, DBusMessage *msg, void *userdata)
static void handle_listen_for_signal(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_core *c = userdata;
- const char *signal;
+ const char *signal_str;
char **objects = NULL;
int n_objects;
@@ -1497,11 +1497,11 @@ static void handle_listen_for_signal(DBusConnection *conn, DBusMessage *msg, voi
pa_assert(c);
pa_assert_se(dbus_message_get_args(msg, NULL,
- DBUS_TYPE_STRING, &signal,
+ DBUS_TYPE_STRING, &signal_str,
DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &objects, &n_objects,
DBUS_TYPE_INVALID));
- pa_dbus_protocol_add_signal_listener(c->dbus_protocol, conn, *signal ? signal : NULL, objects, n_objects);
+ pa_dbus_protocol_add_signal_listener(c->dbus_protocol, conn, *signal_str ? signal_str : NULL, objects, n_objects);
pa_dbus_send_empty_reply(conn, msg);
@@ -1510,15 +1510,15 @@ static void handle_listen_for_signal(DBusConnection *conn, DBusMessage *msg, voi
static void handle_stop_listening_for_signal(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_dbusiface_core *c = userdata;
- const char *signal;
+ const char *signal_str;
pa_assert(conn);
pa_assert(msg);
pa_assert(c);
- pa_assert_se(dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &signal, DBUS_TYPE_INVALID));
+ pa_assert_se(dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &signal_str, DBUS_TYPE_INVALID));
- pa_dbus_protocol_remove_signal_listener(c->dbus_protocol, conn, *signal ? signal : NULL);
+ pa_dbus_protocol_remove_signal_listener(c->dbus_protocol, conn, *signal_str ? signal_str : NULL);
pa_dbus_send_empty_reply(conn, msg);
}
@@ -1531,7 +1531,7 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
pa_dbusiface_sample *sample_iface = NULL;
pa_dbusiface_module *module_iface = NULL;
pa_dbusiface_client *client_iface = NULL;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
const char *object_path = NULL;
pa_sink *new_fallback_sink = NULL;
pa_source *new_fallback_source = NULL;
@@ -1552,21 +1552,21 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
&& (device_iface = pa_hashmap_get(c->sinks_by_index, PA_UINT32_TO_PTR(new_fallback_sink->index)))) {
object_path = pa_dbusiface_device_get_path(device_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_FALLBACK_SINK_UPDATED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_FALLBACK_SINK_UPDATED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
} else if (!new_fallback_sink) {
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_FALLBACK_SINK_UNSET].name)));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_FALLBACK_SINK_UNSET].name)));
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
@@ -1579,21 +1579,21 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
&& (device_iface = pa_hashmap_get(c->sources_by_index, PA_UINT32_TO_PTR(new_fallback_source->index)))) {
object_path = pa_dbusiface_device_get_path(device_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_FALLBACK_SOURCE_UPDATED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_FALLBACK_SOURCE_UPDATED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
} else if (!new_fallback_source) {
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_FALLBACK_SOURCE_UNSET].name)));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_FALLBACK_SOURCE_UNSET].name)));
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
break;
@@ -1612,10 +1612,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_card_get_path(card_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_CARD].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_CARD].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
} else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
if (!(card_iface = pa_hashmap_remove(c->cards, PA_UINT32_TO_PTR(idx))))
@@ -1623,10 +1623,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_card_get_path(card_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_CARD_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_CARD_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
pa_dbusiface_card_free(card_iface);
}
@@ -1647,28 +1647,28 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_device_get_path(device_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_SINK].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_SINK].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
if (c->fallback_sink && pa_streq(c->fallback_sink->name, sink->name)) {
/* We have got default sink change event, but at that point
* the D-Bus sink object wasn't created yet. Now that the
* object is created, let's send the fallback sink change
* signal. */
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_FALLBACK_SINK_UPDATED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
-
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_FALLBACK_SINK_UPDATED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
} else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
@@ -1678,10 +1678,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_device_get_path(device_iface);
pa_assert_se(pa_hashmap_remove(c->sinks_by_path, object_path));
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_SINK_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_SINK_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
pa_dbusiface_device_free(device_iface);
}
@@ -1702,28 +1702,28 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_device_get_path(device_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_SOURCE].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_SOURCE].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
if (c->fallback_source && pa_streq(c->fallback_source->name, source->name)) {
/* We have got default source change event, but at that
* point the D-Bus source object wasn't created yet. Now
* that the object is created, let's send the fallback
* source change signal. */
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_FALLBACK_SOURCE_UPDATED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
-
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_FALLBACK_SOURCE_UPDATED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
} else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
@@ -1733,10 +1733,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_device_get_path(device_iface);
pa_assert_se(pa_hashmap_remove(c->sources_by_path, object_path));
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_SOURCE_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_SOURCE_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
pa_dbusiface_device_free(device_iface);
}
@@ -1756,10 +1756,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_stream_get_path(stream_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_PLAYBACK_STREAM].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_PLAYBACK_STREAM].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
} else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
if (!(stream_iface = pa_hashmap_remove(c->playback_streams, PA_UINT32_TO_PTR(idx))))
@@ -1767,10 +1767,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_stream_get_path(stream_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_PLAYBACK_STREAM_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_PLAYBACK_STREAM_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
pa_dbusiface_stream_free(stream_iface);
}
@@ -1790,10 +1790,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_stream_get_path(stream_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_RECORD_STREAM].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_RECORD_STREAM].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
} else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
if (!(stream_iface = pa_hashmap_remove(c->record_streams, PA_UINT32_TO_PTR(idx))))
@@ -1801,10 +1801,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_stream_get_path(stream_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_RECORD_STREAM_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_RECORD_STREAM_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
pa_dbusiface_stream_free(stream_iface);
}
@@ -1824,10 +1824,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_sample_get_path(sample_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_SAMPLE].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_SAMPLE].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
} else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
if (!(sample_iface = pa_hashmap_remove(c->samples, PA_UINT32_TO_PTR(idx))))
@@ -1835,10 +1835,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_sample_get_path(sample_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_SAMPLE_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_SAMPLE_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
pa_dbusiface_sample_free(sample_iface);
}
@@ -1858,10 +1858,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_module_get_path(module_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_MODULE].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_MODULE].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
} else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
if (!(module_iface = pa_hashmap_remove(c->modules, PA_UINT32_TO_PTR(idx))))
@@ -1869,10 +1869,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_module_get_path(module_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_MODULE_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_MODULE_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
pa_dbusiface_module_free(module_iface);
}
@@ -1892,10 +1892,10 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_client_get_path(client_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_CLIENT].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_CLIENT].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
} else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
if (!(client_iface = pa_hashmap_remove(c->clients, PA_UINT32_TO_PTR(idx))))
@@ -1903,37 +1903,37 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
object_path = pa_dbusiface_client_get_path(client_iface);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_CLIENT_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_CLIENT_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
pa_dbusiface_client_free(client_iface);
}
break;
}
- if (signal) {
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
+ if (signal_msg) {
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
}
}
static pa_hook_result_t extension_registered_cb(void *hook_data, void *call_data, void *slot_data) {
pa_dbusiface_core *c = slot_data;
const char *ext_name = call_data;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
pa_assert(c);
pa_assert(ext_name);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_NEW_EXTENSION].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_STRING, &ext_name, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_NEW_EXTENSION].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_STRING, &ext_name, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
return PA_HOOK_OK;
}
@@ -1941,18 +1941,18 @@ static pa_hook_result_t extension_registered_cb(void *hook_data, void *call_data
static pa_hook_result_t extension_unregistered_cb(void *hook_data, void *call_data, void *slot_data) {
pa_dbusiface_core *c = slot_data;
const char *ext_name = call_data;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
pa_assert(c);
pa_assert(ext_name);
- pa_assert_se((signal = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
- PA_DBUS_CORE_INTERFACE,
- signals[SIGNAL_EXTENSION_REMOVED].name)));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_STRING, &ext_name, DBUS_TYPE_INVALID));
+ pa_assert_se((signal_msg = dbus_message_new_signal(PA_DBUS_CORE_OBJECT_PATH,
+ PA_DBUS_CORE_INTERFACE,
+ signals[SIGNAL_EXTENSION_REMOVED].name)));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_STRING, &ext_name, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(c->dbus_protocol, signal);
- dbus_message_unref(signal);
+ pa_dbus_protocol_send_signal(c->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
return PA_HOOK_OK;
}
diff --git a/src/modules/dbus/iface-device.c b/src/modules/dbus/iface-device.c
index 3a747a44..bb91d71f 100644
--- a/src/modules/dbus/iface-device.c
+++ b/src/modules/dbus/iface-device.c
@@ -1063,7 +1063,7 @@ static void handle_source_get_all(DBusConnection *conn, DBusMessage *msg, void *
static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
pa_dbusiface_device *d = userdata;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
const pa_cvolume *new_volume = NULL;
pa_bool_t new_mute = FALSE;
pa_sink_state_t new_sink_state = 0;
@@ -1099,16 +1099,16 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
for (i = 0; i < d->volume.channels; ++i)
volume[i] = d->volume.values[i];
- pa_assert_se(signal = dbus_message_new_signal(d->path,
- PA_DBUSIFACE_DEVICE_INTERFACE,
- signals[SIGNAL_VOLUME_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal,
+ pa_assert_se(signal_msg = dbus_message_new_signal(d->path,
+ PA_DBUSIFACE_DEVICE_INTERFACE,
+ signals[SIGNAL_VOLUME_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg,
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &volume_ptr, d->volume.channels,
DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(d->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(d->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
new_mute = (d->type == DEVICE_TYPE_SINK) ? pa_sink_get_mute(d->sink, FALSE) : pa_source_get_mute(d->source, FALSE);
@@ -1116,14 +1116,14 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
if (d->mute != new_mute) {
d->mute = new_mute;
- pa_assert_se(signal = dbus_message_new_signal(d->path,
- PA_DBUSIFACE_DEVICE_INTERFACE,
- signals[SIGNAL_MUTE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_BOOLEAN, &d->mute, DBUS_TYPE_INVALID));
+ pa_assert_se(signal_msg = dbus_message_new_signal(d->path,
+ PA_DBUSIFACE_DEVICE_INTERFACE,
+ signals[SIGNAL_MUTE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_BOOLEAN, &d->mute, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(d->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(d->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
if (d->type == DEVICE_TYPE_SINK)
@@ -1142,14 +1142,14 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
state = (d->type == DEVICE_TYPE_SINK) ? d->sink_state : d->source_state;
- pa_assert_se(signal = dbus_message_new_signal(d->path,
- PA_DBUSIFACE_DEVICE_INTERFACE,
- signals[SIGNAL_STATE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INVALID));
+ pa_assert_se(signal_msg = dbus_message_new_signal(d->path,
+ PA_DBUSIFACE_DEVICE_INTERFACE,
+ signals[SIGNAL_STATE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(d->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(d->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
new_active_port = (d->type == DEVICE_TYPE_SINK) ? d->sink->active_port : d->source->active_port;
@@ -1160,14 +1160,14 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
d->active_port = new_active_port;
object_path = pa_dbusiface_device_port_get_path(pa_hashmap_get(d->ports, d->active_port->name));
- pa_assert_se(signal = dbus_message_new_signal(d->path,
- PA_DBUSIFACE_DEVICE_INTERFACE,
- signals[SIGNAL_ACTIVE_PORT_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
+ pa_assert_se(signal_msg = dbus_message_new_signal(d->path,
+ PA_DBUSIFACE_DEVICE_INTERFACE,
+ signals[SIGNAL_ACTIVE_PORT_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(d->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(d->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
new_proplist = (d->type == DEVICE_TYPE_SINK) ? d->sink->proplist : d->source->proplist;
@@ -1177,15 +1177,15 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
pa_proplist_update(d->proplist, PA_UPDATE_SET, new_proplist);
- pa_assert_se(signal = dbus_message_new_signal(d->path,
- PA_DBUSIFACE_DEVICE_INTERFACE,
- signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(d->path,
+ PA_DBUSIFACE_DEVICE_INTERFACE,
+ signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
pa_dbus_append_proplist(&msg_iter, d->proplist);
- pa_dbus_protocol_send_signal(d->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(d->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
diff --git a/src/modules/dbus/iface-module.c b/src/modules/dbus/iface-module.c
index e8aea50f..9973166c 100644
--- a/src/modules/dbus/iface-module.c
+++ b/src/modules/dbus/iface-module.c
@@ -268,7 +268,7 @@ static void handle_unload(DBusConnection *conn, DBusMessage *msg, void *userdata
static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
pa_dbusiface_module *m = userdata;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
pa_assert(core);
pa_assert((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_MODULE);
@@ -287,15 +287,15 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t t, uint3
pa_proplist_update(m->proplist, PA_UPDATE_SET, m->module->proplist);
- pa_assert_se(signal = dbus_message_new_signal(m->path,
- PA_DBUSIFACE_MODULE_INTERFACE,
- signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(m->path,
+ PA_DBUSIFACE_MODULE_INTERFACE,
+ signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
pa_dbus_append_proplist(&msg_iter, m->proplist);
- pa_dbus_protocol_send_signal(m->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(m->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
diff --git a/src/modules/dbus/iface-sample.c b/src/modules/dbus/iface-sample.c
index b0542a60..c1fa193c 100644
--- a/src/modules/dbus/iface-sample.c
+++ b/src/modules/dbus/iface-sample.c
@@ -450,7 +450,7 @@ static void handle_remove(DBusConnection *conn, DBusMessage *msg, void *userdata
static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
pa_dbusiface_sample *s = userdata;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
pa_assert(c);
pa_assert(s);
@@ -468,15 +468,15 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
pa_proplist_update(s->proplist, PA_UPDATE_SET, s->sample->proplist);
- pa_assert_se(signal = dbus_message_new_signal(s->path,
- PA_DBUSIFACE_SAMPLE_INTERFACE,
- signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(s->path,
+ PA_DBUSIFACE_SAMPLE_INTERFACE,
+ signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
pa_dbus_append_proplist(&msg_iter, s->proplist);
- pa_dbus_protocol_send_signal(s->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(s->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
diff --git a/src/modules/dbus/iface-stream.c b/src/modules/dbus/iface-stream.c
index 04a45e6c..0255be4b 100644
--- a/src/modules/dbus/iface-stream.c
+++ b/src/modules/dbus/iface-stream.c
@@ -632,7 +632,7 @@ static void handle_kill(DBusConnection *conn, DBusMessage *msg, void *userdata)
static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
pa_dbusiface_stream *s = userdata;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
const char *new_device_path = NULL;
uint32_t new_sample_rate = 0;
pa_proplist *new_proplist = NULL;
@@ -662,14 +662,14 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
new_device_path = pa_dbusiface_core_get_sink_path(s->core, new_sink);
- pa_assert_se(signal = dbus_message_new_signal(s->path,
- PA_DBUSIFACE_STREAM_INTERFACE,
- signals[SIGNAL_DEVICE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &new_device_path, DBUS_TYPE_INVALID));
+ pa_assert_se(signal_msg = dbus_message_new_signal(s->path,
+ PA_DBUSIFACE_STREAM_INTERFACE,
+ signals[SIGNAL_DEVICE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &new_device_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(s->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(s->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
} else {
pa_source *new_source = s->source_output->source;
@@ -680,14 +680,14 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
new_device_path = pa_dbusiface_core_get_source_path(s->core, new_source);
- pa_assert_se(signal = dbus_message_new_signal(s->path,
- PA_DBUSIFACE_STREAM_INTERFACE,
- signals[SIGNAL_DEVICE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &new_device_path, DBUS_TYPE_INVALID));
+ pa_assert_se(signal_msg = dbus_message_new_signal(s->path,
+ PA_DBUSIFACE_STREAM_INTERFACE,
+ signals[SIGNAL_DEVICE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &new_device_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(s->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(s->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
@@ -696,14 +696,14 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
if (s->sample_rate != new_sample_rate) {
s->sample_rate = new_sample_rate;
- pa_assert_se(signal = dbus_message_new_signal(s->path,
- PA_DBUSIFACE_STREAM_INTERFACE,
- signals[SIGNAL_SAMPLE_RATE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_UINT32, &s->sample_rate, DBUS_TYPE_INVALID));
+ pa_assert_se(signal_msg = dbus_message_new_signal(s->path,
+ PA_DBUSIFACE_STREAM_INTERFACE,
+ signals[SIGNAL_SAMPLE_RATE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_UINT32, &s->sample_rate, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(s->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(s->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
if (s->type == STREAM_TYPE_PLAYBACK) {
@@ -721,16 +721,16 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
for (i = 0; i < s->volume.channels; ++i)
volume[i] = s->volume.values[i];
- pa_assert_se(signal = dbus_message_new_signal(s->path,
- PA_DBUSIFACE_STREAM_INTERFACE,
- signals[SIGNAL_VOLUME_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal,
+ pa_assert_se(signal_msg = dbus_message_new_signal(s->path,
+ PA_DBUSIFACE_STREAM_INTERFACE,
+ signals[SIGNAL_VOLUME_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg,
DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &volume_ptr, s->volume.channels,
DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(s->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(s->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
new_mute = pa_sink_input_get_mute(s->sink_input);
@@ -738,14 +738,14 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
if (s->mute != new_mute) {
s->mute = new_mute;
- pa_assert_se(signal = dbus_message_new_signal(s->path,
- PA_DBUSIFACE_STREAM_INTERFACE,
- signals[SIGNAL_MUTE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_BOOLEAN, &s->mute, DBUS_TYPE_INVALID));
+ pa_assert_se(signal_msg = dbus_message_new_signal(s->path,
+ PA_DBUSIFACE_STREAM_INTERFACE,
+ signals[SIGNAL_MUTE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_BOOLEAN, &s->mute, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(s->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(s->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
@@ -756,21 +756,21 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t
pa_proplist_update(s->proplist, PA_UPDATE_SET, new_proplist);
- pa_assert_se(signal = dbus_message_new_signal(s->path,
- PA_DBUSIFACE_STREAM_INTERFACE,
- signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(s->path,
+ PA_DBUSIFACE_STREAM_INTERFACE,
+ signals[SIGNAL_PROPERTY_LIST_UPDATED].name));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
pa_dbus_append_proplist(&msg_iter, s->proplist);
- pa_dbus_protocol_send_signal(s->dbus_protocol, signal);
- dbus_message_unref(signal);
- signal = NULL;
+ pa_dbus_protocol_send_signal(s->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
+ signal_msg = NULL;
}
}
static pa_hook_result_t send_event_cb(void *hook_data, void *call_data, void *slot_data) {
pa_dbusiface_stream *s = slot_data;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
DBusMessageIter msg_iter;
const char *name = NULL;
pa_proplist *property_list = NULL;
@@ -796,15 +796,15 @@ static pa_hook_result_t send_event_cb(void *hook_data, void *call_data, void *sl
property_list = data->data;
}
- pa_assert_se(signal = dbus_message_new_signal(s->path,
- PA_DBUSIFACE_STREAM_INTERFACE,
- signals[SIGNAL_STREAM_EVENT].name));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(s->path,
+ PA_DBUSIFACE_STREAM_INTERFACE,
+ signals[SIGNAL_STREAM_EVENT].name));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
pa_assert_se(dbus_message_iter_append_basic(&msg_iter, DBUS_TYPE_STRING, &name));
pa_dbus_append_proplist(&msg_iter, property_list);
- pa_dbus_protocol_send_signal(s->dbus_protocol, signal);
- dbus_message_unref(signal);
+ pa_dbus_protocol_send_signal(s->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
return PA_HOOK_OK;
}
diff --git a/src/modules/dbus/module-dbus-protocol.c b/src/modules/dbus/module-dbus-protocol.c
index 11064c33..acc6ca04 100644
--- a/src/modules/dbus/module-dbus-protocol.c
+++ b/src/modules/dbus/module-dbus-protocol.c
@@ -126,7 +126,7 @@ static void client_kill_cb(pa_client *c) {
/* Called from pa_client_send_event(). */
static void client_send_event_cb(pa_client *c, const char *name, pa_proplist *data) {
struct connection *conn = NULL;
- DBusMessage *signal = NULL;
+ DBusMessage *signal_msg = NULL;
DBusMessageIter msg_iter;
pa_assert(c);
@@ -136,15 +136,15 @@ static void client_send_event_cb(pa_client *c, const char *name, pa_proplist *da
conn = c->userdata;
- pa_assert_se(signal = dbus_message_new_signal(pa_dbusiface_core_get_client_path(conn->server->userdata->core_iface, c),
- PA_DBUSIFACE_CLIENT_INTERFACE,
- "ClientEvent"));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(pa_dbusiface_core_get_client_path(conn->server->userdata->core_iface, c),
+ PA_DBUSIFACE_CLIENT_INTERFACE,
+ "ClientEvent"));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
pa_assert_se(dbus_message_iter_append_basic(&msg_iter, DBUS_TYPE_STRING, &name));
pa_dbus_append_proplist(&msg_iter, data);
- pa_assert_se(dbus_connection_send(pa_dbus_wrap_connection_get(conn->wrap_conn), signal, NULL));
- dbus_message_unref(signal);
+ pa_assert_se(dbus_connection_send(pa_dbus_wrap_connection_get(conn->wrap_conn), signal_msg, NULL));
+ dbus_message_unref(signal_msg);
}
/* Called by D-Bus at the authentication phase. */
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index 3991043d..8d61ff4c 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -1032,27 +1032,27 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
if ((e = read_entry(u, name))) {
uint32_t idx;
- char *devname;
+ char *device_name;
uint32_t found_index = PA_INVALID_INDEX;
- if ((devname = get_name(name, "sink:"))) {
+ if ((device_name = get_name(name, "sink:"))) {
pa_sink* s;
PA_IDXSET_FOREACH(s, u->core->sinks, idx) {
- if (strcmp(s->name, devname) == 0) {
+ if (strcmp(s->name, device_name) == 0) {
found_index = s->index;
break;
}
}
- pa_xfree(devname);
- } else if ((devname = get_name(name, "source:"))) {
+ pa_xfree(device_name);
+ } else if ((device_name = get_name(name, "source:"))) {
pa_source* s;
PA_IDXSET_FOREACH(s, u->core->sources, idx) {
- if (strcmp(s->name, devname) == 0) {
+ if (strcmp(s->name, device_name) == 0) {
found_index = s->index;
break;
}
}
- pa_xfree(devname);
+ pa_xfree(device_name);
}
pa_tagstruct_puts(reply, name);
diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c
index 7c0ccd3a..0a2860b0 100644
--- a/src/modules/module-equalizer-sink.c
+++ b/src/modules/module-equalizer-sink.c
@@ -113,8 +113,11 @@ struct userdata {
float **Xs;
float ***Hs;//thread updatable copies of the freq response filters (magintude based)
pa_aupdate **a_H;
- pa_memchunk conv_buffer;
pa_memblockq *input_q;
+ char *output_buffer;
+ size_t output_buffer_length;
+ size_t output_buffer_max_length;
+ pa_memblockq *output_q;
pa_bool_t first_iteration;
pa_dbus_protocol *dbus_protocol;
@@ -250,10 +253,11 @@ static int sink_process_msg_cb(pa_msgobject *o, int code, void *data, int64_t of
pa_sink_get_latency_within_thread(u->sink_input->sink) +
/* Add the latency internal to our sink input on top */
- pa_bytes_to_usec(pa_memblockq_get_length(u->sink_input->thread_info.render_memblockq), &u->sink_input->sink->sample_spec);
+ pa_bytes_to_usec(pa_memblockq_get_length(u->output_q), &u->sink_input->sink->sample_spec) +
+ pa_bytes_to_usec(pa_memblockq_get_length(u->sink_input->thread_info.render_memblockq), &u->sink_input->sink->sample_spec) +
+ pa_bytes_to_usec(pa_memblockq_get_length(u->input_q), &u->sink_input->sink->sample_spec);
// pa_bytes_to_usec(u->samples_gathered * fs, &u->sink->sample_spec);
//+ pa_bytes_to_usec(u->latency * fs, ss)
- //+ pa_bytes_to_usec(pa_memblockq_get_length(u->input_q), ss);
return 0;
}
}
@@ -337,7 +341,7 @@ static void sink_set_mute_cb(pa_sink *s) {
pa_sink_input_set_mute(u->sink_input, s->muted, s->save_muted);
}
-#ifndef __SSE2__
+#if 1
//reference implementation
static void dsp_logic(
float * restrict dst,//used as a temp array too, needs to be fft_length!
@@ -489,18 +493,42 @@ static void dsp_logic(
}
#endif
-static void process_samples(struct userdata *u, pa_memchunk *tchunk){
+static void flatten_to_memblockq(struct userdata *u){
+ size_t mbs = pa_mempool_block_size_max(u->sink->core->mempool);
+ pa_memchunk tchunk;
+ char *dst;
+ size_t i = 0;
+ while(i < u->output_buffer_length){
+ tchunk.index = 0;
+ tchunk.length = PA_MIN((u->output_buffer_length - i), mbs);
+ tchunk.memblock = pa_memblock_new(u->sink->core->mempool, tchunk.length);
+ //pa_log_debug("pushing %ld into the q", tchunk.length);
+ dst = pa_memblock_acquire(tchunk.memblock);
+ memcpy(dst, u->output_buffer + i, tchunk.length);
+ pa_memblock_release(tchunk.memblock);
+ pa_memblockq_push(u->output_q, &tchunk);
+ pa_memblock_unref(tchunk.memblock);
+ i += tchunk.length;
+ }
+}
+
+static void process_samples(struct userdata *u){
size_t fs = pa_frame_size(&(u->sink->sample_spec));
- float *dst;
unsigned a_i;
float *H, X;
size_t iterations, offset;
pa_assert(u->samples_gathered >= u->window_size);
iterations = (u->samples_gathered - u->overlap_size) / u->R;
- tchunk->index = 0;
- tchunk->length = iterations * u->R * fs;
- tchunk->memblock = pa_memblock_new(u->sink->core->mempool, tchunk->length);
- dst = ((float*) pa_memblock_acquire(tchunk->memblock));
+ //make sure there is enough buffer memory allocated
+ if(iterations * u->R * fs > u->output_buffer_max_length){
+ u->output_buffer_max_length = iterations * u->R * fs;
+ if(u->output_buffer){
+ pa_xfree(u->output_buffer);
+ }
+ u->output_buffer = pa_xmalloc(u->output_buffer_max_length);
+ }
+ u->output_buffer_length = iterations * u->R * fs;
+
for(size_t iter = 0; iter < iterations; ++iter){
offset = iter * u->R * fs;
for(size_t c = 0;c < u->channels; c++) {
@@ -526,14 +554,14 @@ static void process_samples(struct userdata *u, pa_memchunk *tchunk){
u->work_buffer[i] = u->W[i] <= FLT_EPSILON ? u->work_buffer[i] : u->work_buffer[i] / u->W[i];
}
}
- pa_sample_clamp(PA_SAMPLE_FLOAT32NE, (uint8_t *) (dst + c) + offset, fs, u->work_buffer, sizeof(float), u->R);
+ pa_sample_clamp(PA_SAMPLE_FLOAT32NE, (uint8_t *) (((float *)u->output_buffer) + c) + offset, fs, u->work_buffer, sizeof(float), u->R);
}
if(u->first_iteration){
u->first_iteration = FALSE;
}
u->samples_gathered -= u->R;
}
- pa_memblock_release(tchunk->memblock);
+ flatten_to_memblockq(u);
}
static void input_buffer(struct userdata *u, pa_memchunk *in){
@@ -556,7 +584,8 @@ static void input_buffer(struct userdata *u, pa_memchunk *in){
/* Called from I/O thread context */
static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk) {
struct userdata *u;
- size_t fs, target_samples, mbs;
+ size_t fs, target_samples;
+ size_t mbs;
//struct timeval start, end;
pa_memchunk tchunk;
pa_sink_input_assert_ref(i);
@@ -564,13 +593,17 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
pa_assert(chunk);
pa_assert(u->sink);
fs = pa_frame_size(&(u->sink->sample_spec));
- nbytes = PA_MIN(nbytes, pa_mempool_block_size_max(u->sink->core->mempool));
- target_samples = PA_ROUND_UP(nbytes / fs, u->R);
mbs = pa_mempool_block_size_max(u->sink->core->mempool);
- //pa_log_debug("vanilla mbs = %ld",mbs);
- mbs = PA_ROUND_DOWN(mbs / fs, u->R);
- mbs = PA_MAX(mbs, u->R);
- target_samples = PA_MAX(target_samples, mbs);
+ if(pa_memblockq_get_length(u->output_q) > 0){
+ //pa_log_debug("qsize is %ld", pa_memblockq_get_length(u->output_q));
+ goto END;
+ }
+ //nbytes = PA_MIN(nbytes, pa_mempool_block_size_max(u->sink->core->mempool));
+ target_samples = PA_ROUND_UP(nbytes / fs, u->R);
+ ////pa_log_debug("vanilla mbs = %ld",mbs);
+ //mbs = PA_ROUND_DOWN(mbs / fs, u->R);
+ //mbs = PA_MAX(mbs, u->R);
+ //target_samples = PA_MAX(target_samples, mbs);
//pa_log_debug("target samples: %ld", target_samples);
if(u->first_iteration){
//allocate request_size
@@ -594,7 +627,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
pa_assert(input_remaining > 0);
while(pa_memblockq_peek(u->input_q, &tchunk) < 0){
//pa_sink_render(u->sink, input_remaining * fs, &tchunk);
- pa_sink_render_full(u->sink, input_remaining * fs, &tchunk);
+ pa_sink_render_full(u->sink, PA_MIN(input_remaining * fs, mbs), &tchunk);
pa_assert(tchunk.memblock);
pa_memblockq_push(u->input_q, &tchunk);
pa_memblock_unref(tchunk.memblock);
@@ -619,11 +652,13 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
pa_assert(u->R < u->window_size);
//pa_rtclock_get(&start);
/* process a block */
- process_samples(u, chunk);
+ process_samples(u);
//pa_rtclock_get(&end);
//pa_log_debug("Took %0.6f seconds to process", (double) pa_timeval_diff(&end, &start) / PA_USEC_PER_SEC);
-
+END:
+ pa_assert_se(pa_memblockq_peek(u->output_q, chunk) >= 0);
pa_assert(chunk->memblock);
+ pa_memblockq_drop(u->output_q, chunk->length);
//pa_log_debug("gave %ld", chunk->length/fs);
//pa_log_debug("end pop");
return 0;
@@ -1143,6 +1178,10 @@ int pa__init(pa_module*m) {
u->sink->set_mute = sink_set_mute_cb;
u->sink->userdata = u;
u->input_q = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, fs, 1, 1, 0, &u->sink->silence);
+ u->output_q = pa_memblockq_new(0, MEMBLOCKQ_MAXLENGTH, 0, fs, 1, 1, 0, NULL);
+ u->output_buffer = NULL;
+ u->output_buffer_length = 0;
+ u->output_buffer_max_length = 0;
pa_sink_set_asyncmsgq(u->sink, master->asyncmsgq);
//pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->R*fs, &ss));
@@ -1255,6 +1294,10 @@ void pa__done(pa_module*m) {
if (u->sink)
pa_sink_unref(u->sink);
+ if(u->output_buffer){
+ pa_xfree(u->output_buffer);
+ }
+ pa_memblockq_free(u->output_q);
pa_memblockq_free(u->input_q);
fftwf_destroy_plan(u->inverse_plan);
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 10cc3415..7a4e730f 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -34,6 +34,10 @@
#include <sys/ioctl.h>
#include <poll.h>
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
#include <pulse/xmalloc.h>
#include <pulsecore/core-error.h>
@@ -101,9 +105,10 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
case PA_SINK_MESSAGE_GET_LATENCY: {
size_t n = 0;
- int l;
#ifdef FIONREAD
+ int l;
+
if (ioctl(u->fd, FIONREAD, &l) >= 0 && l > 0)
n = (size_t) l;
#endif
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index de680933..933f0294 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -34,6 +34,10 @@
#include <sys/ioctl.h>
#include <sys/poll.h>
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
#include <pulse/xmalloc.h>
#include <pulsecore/core-error.h>
@@ -105,9 +109,10 @@ static int source_process_msg(
case PA_SOURCE_MESSAGE_GET_LATENCY: {
size_t n = 0;
- int l;
#ifdef FIONREAD
+ int l;
+
if (ioctl(u->fd, FIONREAD, &l) >= 0 && l > 0)
n = (size_t) l;
#endif
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index 955997ba..396094ce 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -327,7 +327,7 @@ static int open_audio_device(struct userdata *u, pa_sample_spec *ss) {
pa_assert(u);
pa_assert(ss);
- if ((u->fd = pa_open_cloexec(u->device_name, u->mode | O_NONBLOCK)) < 0) {
+ if ((u->fd = pa_open_cloexec(u->device_name, u->mode | O_NONBLOCK, 0)) < 0) {
pa_log_warn("open %s failed (%s)", u->device_name, pa_cstrerror(errno));
return -1;
}
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 788f458b..02c312e3 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -433,29 +433,29 @@ static void append_volume_variant(DBusMessageIter *iter, struct entry *e) {
}
static void send_new_entry_signal(struct dbus_entry *entry) {
- DBusMessage *signal;
+ DBusMessage *signal_msg;
pa_assert(entry);
- pa_assert_se(signal = dbus_message_new_signal(OBJECT_PATH, INTERFACE_STREAM_RESTORE, signals[SIGNAL_NEW_ENTRY].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &entry->object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(entry->userdata->dbus_protocol, signal);
- dbus_message_unref(signal);
+ pa_assert_se(signal_msg = dbus_message_new_signal(OBJECT_PATH, INTERFACE_STREAM_RESTORE, signals[SIGNAL_NEW_ENTRY].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &entry->object_path, DBUS_TYPE_INVALID));
+ pa_dbus_protocol_send_signal(entry->userdata->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
}
static void send_entry_removed_signal(struct dbus_entry *entry) {
- DBusMessage *signal;
+ DBusMessage *signal_msg;
pa_assert(entry);
- pa_assert_se(signal = dbus_message_new_signal(OBJECT_PATH, INTERFACE_STREAM_RESTORE, signals[SIGNAL_ENTRY_REMOVED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_OBJECT_PATH, &entry->object_path, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(entry->userdata->dbus_protocol, signal);
- dbus_message_unref(signal);
+ pa_assert_se(signal_msg = dbus_message_new_signal(OBJECT_PATH, INTERFACE_STREAM_RESTORE, signals[SIGNAL_ENTRY_REMOVED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_OBJECT_PATH, &entry->object_path, DBUS_TYPE_INVALID));
+ pa_dbus_protocol_send_signal(entry->userdata->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
}
static void send_device_updated_signal(struct dbus_entry *de, struct entry *e) {
- DBusMessage *signal;
+ DBusMessage *signal_msg;
const char *device;
pa_assert(de);
@@ -463,28 +463,28 @@ static void send_device_updated_signal(struct dbus_entry *de, struct entry *e) {
device = e->device_valid ? e->device : "";
- pa_assert_se(signal = dbus_message_new_signal(de->object_path, INTERFACE_ENTRY, entry_signals[ENTRY_SIGNAL_DEVICE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_STRING, &device, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(de->userdata->dbus_protocol, signal);
- dbus_message_unref(signal);
+ pa_assert_se(signal_msg = dbus_message_new_signal(de->object_path, INTERFACE_ENTRY, entry_signals[ENTRY_SIGNAL_DEVICE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_STRING, &device, DBUS_TYPE_INVALID));
+ pa_dbus_protocol_send_signal(de->userdata->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
}
static void send_volume_updated_signal(struct dbus_entry *de, struct entry *e) {
- DBusMessage *signal;
+ DBusMessage *signal_msg;
DBusMessageIter msg_iter;
pa_assert(de);
pa_assert(e);
- pa_assert_se(signal = dbus_message_new_signal(de->object_path, INTERFACE_ENTRY, entry_signals[ENTRY_SIGNAL_VOLUME_UPDATED].name));
- dbus_message_iter_init_append(signal, &msg_iter);
+ pa_assert_se(signal_msg = dbus_message_new_signal(de->object_path, INTERFACE_ENTRY, entry_signals[ENTRY_SIGNAL_VOLUME_UPDATED].name));
+ dbus_message_iter_init_append(signal_msg, &msg_iter);
append_volume(&msg_iter, e);
- pa_dbus_protocol_send_signal(de->userdata->dbus_protocol, signal);
- dbus_message_unref(signal);
+ pa_dbus_protocol_send_signal(de->userdata->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
}
static void send_mute_updated_signal(struct dbus_entry *de, struct entry *e) {
- DBusMessage *signal;
+ DBusMessage *signal_msg;
dbus_bool_t muted;
pa_assert(de);
@@ -494,10 +494,10 @@ static void send_mute_updated_signal(struct dbus_entry *de, struct entry *e) {
muted = e->muted;
- pa_assert_se(signal = dbus_message_new_signal(de->object_path, INTERFACE_ENTRY, entry_signals[ENTRY_SIGNAL_MUTE_UPDATED].name));
- pa_assert_se(dbus_message_append_args(signal, DBUS_TYPE_BOOLEAN, &muted, DBUS_TYPE_INVALID));
- pa_dbus_protocol_send_signal(de->userdata->dbus_protocol, signal);
- dbus_message_unref(signal);
+ pa_assert_se(signal_msg = dbus_message_new_signal(de->object_path, INTERFACE_ENTRY, entry_signals[ENTRY_SIGNAL_MUTE_UPDATED].name));
+ pa_assert_se(dbus_message_append_args(signal_msg, DBUS_TYPE_BOOLEAN, &muted, DBUS_TYPE_INVALID));
+ pa_dbus_protocol_send_signal(de->userdata->dbus_protocol, signal_msg);
+ dbus_message_unref(signal_msg);
}
static void handle_get_interface_revision(DBusConnection *conn, DBusMessage *msg, void *userdata) {