summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/alsa/alsa-sink.c62
-rw-r--r--src/modules/alsa/alsa-source.c4
-rw-r--r--src/modules/bluetooth/bluetooth-util.c2
-rw-r--r--src/modules/bluetooth/bluetooth-util.h16
-rw-r--r--src/modules/bluetooth/sbc.c8
-rw-r--r--src/modules/module-loopback.c27
-rw-r--r--src/modules/module-tunnel.c4
-rw-r--r--src/modules/module-udev-detect.c2
8 files changed, 79 insertions, 46 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 53c14b80..9ed4d4d9 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -440,7 +440,7 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o
#endif
if (!u->first && !u->after_rewind)
- if (pa_log_ratelimit())
+ if (pa_log_ratelimit(PA_LOG_INFO))
pa_log_info("Underrun!");
}
@@ -1281,15 +1281,17 @@ static void sink_write_volume_cb(pa_sink *s) {
(pa_cvolume_max(&tmp_vol) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
if (!accurate_enough) {
- char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX];
- char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
+ union {
+ char db[2][PA_SW_CVOLUME_SNPRINT_DB_MAX];
+ char pcnt[2][PA_CVOLUME_SNPRINT_MAX];
+ } vol;
pa_log_debug("Written HW volume did not match with the request: %s (request) != %s",
- pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &s->thread_info.current_hw_volume),
- pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &hw_vol));
+ pa_cvolume_snprint(vol.pcnt[0], sizeof(vol.pcnt[0]), &s->thread_info.current_hw_volume),
+ pa_cvolume_snprint(vol.pcnt[1], sizeof(vol.pcnt[1]), &hw_vol));
pa_log_debug(" in dB: %s (request) != %s",
- pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &s->thread_info.current_hw_volume),
- pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &hw_vol));
+ pa_sw_cvolume_snprint_dB(vol.db[0], sizeof(vol.db[0]), &s->thread_info.current_hw_volume),
+ pa_sw_cvolume_snprint_dB(vol.db[1], sizeof(vol.db[1]), &hw_vol));
}
}
}
@@ -1509,7 +1511,7 @@ static void thread_func(void *userdata) {
* we have filled the buffer at least once
* completely.*/
- if (pa_log_ratelimit())
+ if (pa_log_ratelimit(PA_LOG_DEBUG))
pa_log_debug("Cutting sleep time for the initial iterations by half.");
sleep_usec /= 2;
}
@@ -1573,7 +1575,7 @@ static void thread_func(void *userdata) {
u->first = TRUE;
u->since_start = 0;
- } else if (revents && u->use_tsched && pa_log_ratelimit())
+ } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG))
pa_log_debug("Wakeup from ALSA!");
} else
@@ -1670,8 +1672,6 @@ fail:
}
static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_volume) {
- int (*mixer_callback)(snd_mixer_elem_t *, unsigned int);
-
pa_assert(u);
if (!u->mixer_handle)
@@ -1760,29 +1760,31 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB, pa_bool_t sync_v
pa_log_info("Using hardware mute control.");
}
- if (sync_volume) {
- u->mixer_pd = pa_alsa_mixer_pdata_new();
- mixer_callback = io_mixer_callback;
-
- if (pa_alsa_set_mixer_rtpoll(u->mixer_pd, u->mixer_handle, u->rtpoll) < 0) {
- pa_log("Failed to initialize file descriptor monitoring");
- return -1;
- }
+ if (u->sink->flags & (PA_SINK_HW_VOLUME_CTRL|PA_SINK_HW_MUTE_CTRL)) {
+ int (*mixer_callback)(snd_mixer_elem_t *, unsigned int);
+ if (u->sink->flags & PA_SINK_SYNC_VOLUME) {
+ u->mixer_pd = pa_alsa_mixer_pdata_new();
+ mixer_callback = io_mixer_callback;
- } else {
- u->mixer_fdl = pa_alsa_fdlist_new();
- mixer_callback = ctl_mixer_callback;
+ if (pa_alsa_set_mixer_rtpoll(u->mixer_pd, u->mixer_handle, u->rtpoll) < 0) {
+ pa_log("Failed to initialize file descriptor monitoring");
+ return -1;
+ }
+ } else {
+ u->mixer_fdl = pa_alsa_fdlist_new();
+ mixer_callback = ctl_mixer_callback;
- if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, u->core->mainloop) < 0) {
- pa_log("Failed to initialize file descriptor monitoring");
- return -1;
+ if (pa_alsa_fdlist_set_mixer(u->mixer_fdl, u->mixer_handle, u->core->mainloop) < 0) {
+ pa_log("Failed to initialize file descriptor monitoring");
+ return -1;
+ }
}
- }
- if (u->mixer_path_set)
- pa_alsa_path_set_set_callback(u->mixer_path_set, u->mixer_handle, mixer_callback, u);
- else
- pa_alsa_path_set_callback(u->mixer_path, u->mixer_handle, mixer_callback, u);
+ if (u->mixer_path_set)
+ pa_alsa_path_set_set_callback(u->mixer_path_set, u->mixer_handle, mixer_callback, u);
+ else
+ pa_alsa_path_set_callback(u->mixer_path, u->mixer_handle, mixer_callback, u);
+ }
return 0;
}
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index d2147498..45a7af39 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -428,7 +428,7 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t
PA_DEBUG_TRAP;
#endif
- if (pa_log_ratelimit())
+ if (pa_log_ratelimit(PA_LOG_INFO))
pa_log_info("Overrun!");
}
@@ -1323,7 +1323,7 @@ static void thread_func(void *userdata) {
goto fail;
u->first = TRUE;
- } else if (revents && u->use_tsched && pa_log_ratelimit())
+ } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG))
pa_log_debug("Wakeup from ALSA!");
} else
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 53545209..47e0fd50 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -955,12 +955,14 @@ int pa_bluetooth_transport_acquire(const pa_bluetooth_transport *t, const char *
return -1;
}
+#ifdef DBUS_TYPE_UNIX_FD
if (!dbus_message_get_args(r, &err, DBUS_TYPE_UNIX_FD, &ret, DBUS_TYPE_INVALID)) {
pa_log("Failed to parse org.bluez.MediaTransport.Acquire(): %s", err.message);
ret = -1;
dbus_error_free(&err);
goto fail;
}
+#endif
fail:
dbus_message_unref(r);
diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h
index ce551967..f141209d 100644
--- a/src/modules/bluetooth/bluetooth-util.h
+++ b/src/modules/bluetooth/bluetooth-util.h
@@ -30,18 +30,18 @@
#include <pulsecore/core-util.h>
/* UUID copied from bluez/audio/device.h */
-#define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805F9B34FB"
+#define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805f9b34fb"
-#define HSP_HS_UUID "00001108-0000-1000-8000-00805F9B34FB"
-#define HSP_AG_UUID "00001112-0000-1000-8000-00805F9B34FB"
+#define HSP_HS_UUID "00001108-0000-1000-8000-00805f9b34fb"
+#define HSP_AG_UUID "00001112-0000-1000-8000-00805f9b34fb"
-#define HFP_HS_UUID "0000111E-0000-1000-8000-00805F9B34FB"
-#define HFP_AG_UUID "0000111F-0000-1000-8000-00805F9B34FB"
+#define HFP_HS_UUID "0000111e-0000-1000-8000-00805f9b34fb"
+#define HFP_AG_UUID "0000111f-0000-1000-8000-00805f9b34fb"
-#define ADVANCED_AUDIO_UUID "0000110D-0000-1000-8000-00805F9B34FB"
+#define ADVANCED_AUDIO_UUID "0000110d-0000-1000-8000-00805f9b34fb"
-#define A2DP_SOURCE_UUID "0000110A-0000-1000-8000-00805F9B34FB"
-#define A2DP_SINK_UUID "0000110B-0000-1000-8000-00805F9B34FB"
+#define A2DP_SOURCE_UUID "0000110a-0000-1000-8000-00805f9b34fb"
+#define A2DP_SINK_UUID "0000110b-0000-1000-8000-00805f9b34fb"
typedef struct pa_bluetooth_uuid pa_bluetooth_uuid;
typedef struct pa_bluetooth_device pa_bluetooth_device;
diff --git a/src/modules/bluetooth/sbc.c b/src/modules/bluetooth/sbc.c
index 779be4bd..5157c70f 100644
--- a/src/modules/bluetooth/sbc.c
+++ b/src/modules/bluetooth/sbc.c
@@ -1005,7 +1005,8 @@ ssize_t sbc_decode(sbc_t *sbc, const void *input, size_t input_len,
priv->frame.codesize = sbc_get_codesize(sbc);
priv->frame.length = framelen;
- }
+ } else if (priv->frame.bitpool != sbc->bitpool)
+ sbc->bitpool = priv->frame.bitpool;
if (!output)
return framelen;
@@ -1076,6 +1077,9 @@ ssize_t sbc_encode(sbc_t *sbc, const void *input, size_t input_len,
sbc_encoder_init(&priv->enc_state, &priv->frame);
priv->init = 1;
+ } else if (priv->frame.bitpool != sbc->bitpool) {
+ priv->frame.length = sbc_get_frame_length(sbc);
+ priv->frame.bitpool = sbc->bitpool;
}
/* input must be large enough to encode a complete frame */
@@ -1140,7 +1144,7 @@ size_t sbc_get_frame_length(sbc_t *sbc)
struct sbc_priv *priv;
priv = sbc->priv;
- if (priv->init)
+ if (priv->init && priv->frame.bitpool == sbc->bitpool)
return priv->frame.length;
subbands = sbc->subbands ? 8 : 4;
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 2b1f5055..8cabf71b 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -57,7 +57,9 @@ PA_MODULE_USAGE(
"sink_input_name=<custom name for the sink input> "
"source_output_name=<custom name for the source output> "
"sink_input_role=<media.role for the sink input> "
- "source_output_role=<media.role for the source output>");
+ "source_output_role=<media.role for the source output> "
+ "source_dont_move=<boolean> "
+ "sink_dont_move=<boolean>");
#define DEFAULT_LATENCY_MSEC 200
@@ -116,6 +118,8 @@ static const char* const valid_modargs[] = {
"source_output_name",
"sink_input_role",
"source_output_role",
+ "source_dont_move",
+ "sink_dont_move",
NULL,
};
@@ -631,8 +635,10 @@ int pa__init(pa_module *m) {
struct userdata *u;
pa_sink *sink;
pa_sink_input_new_data sink_input_data;
+ pa_bool_t sink_dont_move;
pa_source *source;
pa_source_output_new_data source_output_data;
+ pa_bool_t source_dont_move;
uint32_t latency_msec;
pa_sample_spec ss;
pa_channel_map map;
@@ -709,6 +715,15 @@ int pa__init(pa_module *m) {
pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
sink_input_data.flags = PA_SINK_INPUT_VARIABLE_RATE;
+ sink_dont_move = FALSE;
+ if (pa_modargs_get_value_boolean(ma, "sink_dont_move", &sink_dont_move) < 0) {
+ pa_log("sink_dont_move= expects a boolean argument.");
+ goto fail;
+ }
+
+ if (sink_dont_move)
+ sink_input_data.flags |= PA_SINK_INPUT_DONT_MOVE;
+
pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
pa_sink_input_new_data_done(&sink_input_data);
@@ -750,6 +765,16 @@ int pa__init(pa_module *m) {
pa_source_output_new_data_set_sample_spec(&source_output_data, &ss);
pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
+ source_output_data.flags = (pa_source_output_flags_t)0;
+
+ source_dont_move = FALSE;
+ if (pa_modargs_get_value_boolean(ma, "source_dont_move", &source_dont_move) < 0) {
+ pa_log("source_dont_move= expects a boolean argument.");
+ goto fail;
+ }
+
+ if (source_dont_move)
+ source_output_data.flags |= PA_SOURCE_OUTPUT_DONT_MOVE;
pa_source_output_new(&u->source_output, m->core, &source_output_data);
pa_source_output_new_data_done(&source_output_data);
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index ce5f8d55..176c2c00 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -1919,7 +1919,7 @@ int pa__init(pa_module*m) {
#ifdef TUNNEL_SINK
if (!(dn = pa_xstrdup(pa_modargs_get_value(ma, "sink_name", NULL))))
- dn = pa_sprintf_malloc("tunnel.%s", u->server_name);
+ dn = pa_sprintf_malloc("tunnel-sink.%s", u->server_name);
pa_sink_new_data_init(&data);
data.driver = __FILE__;
@@ -1963,7 +1963,7 @@ int pa__init(pa_module*m) {
#else
if (!(dn = pa_xstrdup(pa_modargs_get_value(ma, "source_name", NULL))))
- dn = pa_sprintf_malloc("tunnel.%s", u->server_name);
+ dn = pa_sprintf_malloc("tunnel-source.%s", u->server_name);
pa_source_new_data_init(&data);
data.driver = __FILE__;
diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c
index 2eecc25a..1eaa84fd 100644
--- a/src/modules/module-udev-detect.c
+++ b/src/modules/module-udev-detect.c
@@ -324,7 +324,7 @@ static void verify_access(struct userdata *u, struct device *d) {
* during opening was canceled by a "try again"
* failure or a "fatal" failure. */
- if (pa_ratelimit_test(&d->ratelimit)) {
+ if (pa_ratelimit_test(&d->ratelimit, PA_LOG_DEBUG)) {
pa_log_debug("Loading module-alsa-card with arguments '%s'", d->args);
m = pa_module_load(u->core, "module-alsa-card", d->args);