summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2009-08-30 20:07:31 +0300
committerTanu Kaskinen <tanuk@iki.fi>2009-08-30 20:07:31 +0300
commit0ad2d55cbe86d13d5cd355f2b5d59360d681ccc2 (patch)
tree42c290cd1f1c05c687d8134e40b63244d4fba4e9 /src/modules
parent0e096632c53b746b9f4b4c0249d9e5a18c1c543d (diff)
parent8bf2e3fe94e0dcd0a39a67c461b787d79adcd0dd (diff)
Merge branch 'master' of git://0pointer.de/pulseaudio into dbus-work
Conflicts: src/modules/module-stream-restore.c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/bluetooth/bluetooth-util.c17
-rw-r--r--src/modules/bluetooth/module-bluetooth-discover.c1
-rw-r--r--src/modules/module-combine.c3
-rw-r--r--src/modules/module-ladspa-sink.c2
-rw-r--r--src/modules/module-loopback.c7
-rw-r--r--src/modules/module-remap-sink.c3
-rw-r--r--src/modules/module-sine.c2
-rw-r--r--src/modules/module-stream-restore.c8
-rw-r--r--src/modules/module-suspend-on-idle.c30
-rw-r--r--src/modules/rtp/module-rtp-recv.c3
-rw-r--r--src/modules/rtp/module-rtp-send.c3
-rw-r--r--src/modules/rtp/rtsp_client.c10
12 files changed, 62 insertions, 27 deletions
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index d0c89aab..f8c5b778 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -662,6 +662,21 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ } else if (dbus_message_is_signal(m, "org.bluez.Device", "DisconnectRequested")) {
+ pa_bluetooth_device *d;
+
+ if ((d = pa_hashmap_get(y->devices, dbus_message_get_path(m)))) {
+ /* Device will disconnect in 2 sec */
+ d->audio_state = PA_BT_AUDIO_STATE_DISCONNECTED;
+ d->audio_sink_state = PA_BT_AUDIO_STATE_DISCONNECTED;
+ d->audio_source_state = PA_BT_AUDIO_STATE_DISCONNECTED;
+ d->headset_state = PA_BT_AUDIO_STATE_DISCONNECTED;
+
+ run_callback(y, d, FALSE);
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
} else if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameOwnerChanged")) {
const char *name, *old_owner, *new_owner;
@@ -775,6 +790,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'",
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceCreated'",
"type='signal',sender='org.bluez',interface='org.bluez.Device',member='PropertyChanged'",
+ "type='signal',sender='org.bluez',interface='org.bluez.Device',member='DisconnectRequested'",
"type='signal',sender='org.bluez',interface='org.bluez.Audio',member='PropertyChanged'",
"type='signal',sender='org.bluez',interface='org.bluez.Headset',member='PropertyChanged'",
"type='signal',sender='org.bluez',interface='org.bluez.AudioSink',member='PropertyChanged'",
@@ -828,6 +844,7 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'",
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceCreated'",
"type='signal',sender='org.bluez',interface='org.bluez.Device',member='PropertyChanged'",
+ "type='signal',sender='org.bluez',interface='org.bluez.Device',member='DisconnectRequested'",
"type='signal',sender='org.bluez',interface='org.bluez.Audio',member='PropertyChanged'",
"type='signal',sender='org.bluez',interface='org.bluez.Headset',member='PropertyChanged'",
"type='signal',sender='org.bluez',interface='org.bluez.AudioSink',member='PropertyChanged'",
diff --git a/src/modules/bluetooth/module-bluetooth-discover.c b/src/modules/bluetooth/module-bluetooth-discover.c
index 7571e48a..02fd4240 100644
--- a/src/modules/bluetooth/module-bluetooth-discover.c
+++ b/src/modules/bluetooth/module-bluetooth-discover.c
@@ -83,7 +83,6 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const
mi = pa_hashmap_get(u->hashmap, d->path);
- pa_log("dead: %d, device_connected: %d, audio_state: %d, audio_source_state: %d", d->dead, d->device_connected, d->audio_state, d->audio_source_state);
if (!d->dead &&
d->device_connected > 0 && (d->audio_state >= PA_BT_AUDIO_STATE_CONNECTED || d->audio_source_state >= PA_BT_AUDIO_STATE_CONNECTED)) {
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index 4a57ce2d..a186c899 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -844,8 +844,9 @@ static int output_create_sink_input(struct output *o) {
pa_sink_input_new_data_set_channel_map(&data, &o->userdata->sink->channel_map);
data.module = o->userdata->module;
data.resample_method = o->userdata->resample_method;
+ data.flags = PA_SINK_INPUT_VARIABLE_RATE|PA_SINK_INPUT_DONT_MOVE|PA_SINK_INPUT_NO_CREATE_ON_SUSPEND;
- pa_sink_input_new(&o->sink_input, o->userdata->core, &data, PA_SINK_INPUT_VARIABLE_RATE|PA_SINK_INPUT_DONT_MOVE|PA_SINK_INPUT_NO_CREATE_ON_SUSPEND);
+ pa_sink_input_new(&o->sink_input, o->userdata->core, &data);
pa_sink_input_new_data_done(&data);
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index aa28f7fd..933fb182 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -812,7 +812,7 @@ int pa__init(pa_module*m) {
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
- pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, 0);
+ pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
pa_sink_input_new_data_done(&sink_input_data);
if (!u->sink_input)
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index d9edbac0..29c3ddab 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -172,7 +172,7 @@ static void adjust_rates(struct userdata *u) {
(double) u->latency_snapshot.source_latency / PA_USEC_PER_MSEC,
((double) u->latency_snapshot.sink_latency + buffer_latency + u->latency_snapshot.source_latency) / PA_USEC_PER_MSEC);
- pa_log_info("Should buffer %lu bytes, buffered at minimum %lu bytes",
+ pa_log_info("Should buffer %zu bytes, buffered at minimum %zu bytes",
u->latency_snapshot.max_request*2,
u->latency_snapshot.min_memblockq_length);
@@ -676,8 +676,9 @@ int pa__init(pa_module *m) {
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "abstract");
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
pa_sink_input_new_data_set_channel_map(&sink_input_data, &map);
+ sink_input_data.flags = PA_SINK_INPUT_VARIABLE_RATE;
- pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, PA_SINK_INPUT_VARIABLE_RATE);
+ pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
pa_sink_input_new_data_done(&sink_input_data);
if (!u->sink_input)
@@ -709,7 +710,7 @@ 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);
- pa_source_output_new(&u->source_output, m->core, &source_output_data, 0);
+ pa_source_output_new(&u->source_output, m->core, &source_output_data);
pa_source_output_new_data_done(&source_output_data);
if (!u->source_output)
diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c
index becff55c..6cfd0d15 100644
--- a/src/modules/module-remap-sink.c
+++ b/src/modules/module-remap-sink.c
@@ -406,8 +406,9 @@ int pa__init(pa_module*m) {
pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter");
pa_sink_input_new_data_set_sample_spec(&sink_input_data, &ss);
pa_sink_input_new_data_set_channel_map(&sink_input_data, &stream_map);
+ sink_input_data.flags = (remix ? 0 : PA_SINK_INPUT_NO_REMIX);
- pa_sink_input_new(&u->sink_input, m->core, &sink_input_data, (remix ? 0 : PA_SINK_INPUT_NO_REMIX));
+ pa_sink_input_new(&u->sink_input, m->core, &sink_input_data);
pa_sink_input_new_data_done(&sink_input_data);
if (!u->sink_input)
diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c
index 0be1d722..69b20028 100644
--- a/src/modules/module-sine.c
+++ b/src/modules/module-sine.c
@@ -163,7 +163,7 @@ int pa__init(pa_module*m) {
pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency);
pa_sink_input_new_data_set_sample_spec(&data, &ss);
- pa_sink_input_new(&u->sink_input, m->core, &data, 0);
+ pa_sink_input_new(&u->sink_input, m->core, &data);
pa_sink_input_new_data_done(&data);
if (!u->sink_input)
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index d45cf792..8389be67 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -1834,6 +1834,10 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
data.data = &entry;
data.size = sizeof(entry);
+ pa_log_debug("Client %s changes entry %s.",
+ pa_strnull(pa_proplist_gets(pa_native_connection_get_client(c)->proplist, PA_PROP_APPLICATION_PROCESS_BINARY)),
+ name);
+
if (pa_database_set(u->database, &key, &data, mode == PA_UPDATE_REPLACE) == 0) {
#ifdef HAVE_DBUS
struct dbus_entry *de;
@@ -1846,8 +1850,8 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
send_device_updated_signal(de, &entry);
if ((old->volume_valid != entry.volume_valid)
- || (entry.volume_valid
- && (!pa_cvolume_equal(&entry.volume, &old->volume) || !pa_channel_map_equal(&entry.channel_map, &old->channel_map))))
+ || (entry.volume_valid && (!pa_cvolume_equal(&entry.volume, &old->volume)
+ || !pa_channel_map_equal(&entry.channel_map, &old->channel_map))))
send_volume_updated_signal(de, &entry);
if (!old->muted_valid || (entry.muted != old->muted))
diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c
index 70a7b049..7adaa0b1 100644
--- a/src/modules/module-suspend-on-idle.c
+++ b/src/modules/module-suspend-on-idle.c
@@ -145,6 +145,9 @@ static pa_hook_result_t sink_input_fixate_hook_cb(pa_core *c, pa_sink_input_new_
pa_assert(data);
pa_assert(u);
+ if (data->flags & PA_SINK_INPUT_START_CORKED)
+ return PA_HOOK_OK;
+
if ((d = pa_hashmap_get(u->device_infos, data->sink)))
resume(d);
@@ -158,6 +161,9 @@ static pa_hook_result_t source_output_fixate_hook_cb(pa_core *c, pa_source_outpu
pa_assert(data);
pa_assert(u);
+ if (data->flags & PA_SOURCE_OUTPUT_START_CORKED)
+ return PA_HOOK_OK;
+
if (data->source->monitor_of)
d = pa_hashmap_get(u->device_infos, data->source->monitor_of);
else
@@ -226,11 +232,16 @@ static pa_hook_result_t sink_input_move_start_hook_cb(pa_core *c, pa_sink_input
static pa_hook_result_t sink_input_move_finish_hook_cb(pa_core *c, pa_sink_input *s, struct userdata *u) {
struct device_info *d;
+ pa_sink_input_state_t state;
pa_assert(c);
pa_sink_input_assert_ref(s);
pa_assert(u);
+ state = pa_sink_input_get_state(s);
+ if (state != PA_SINK_INPUT_RUNNING && state != PA_SINK_INPUT_DRAINED)
+ return PA_HOOK_OK;
+
if ((d = pa_hashmap_get(u->device_infos, s->sink)))
resume(d);
@@ -265,6 +276,9 @@ static pa_hook_result_t source_output_move_finish_hook_cb(pa_core *c, pa_source_
pa_source_output_assert_ref(s);
pa_assert(u);
+ if (pa_source_output_get_state(s) != PA_SOURCE_OUTPUT_RUNNING)
+ return PA_HOOK_OK;
+
if (s->source->monitor_of)
d = pa_hashmap_get(u->device_infos, s->source->monitor_of);
else
@@ -279,6 +293,7 @@ static pa_hook_result_t source_output_move_finish_hook_cb(pa_core *c, pa_source_
static pa_hook_result_t sink_input_state_changed_hook_cb(pa_core *c, pa_sink_input *s, struct userdata *u) {
struct device_info *d;
pa_sink_input_state_t state;
+
pa_assert(c);
pa_sink_input_assert_ref(s);
pa_assert(u);
@@ -292,15 +307,11 @@ static pa_hook_result_t sink_input_state_changed_hook_cb(pa_core *c, pa_sink_inp
}
static pa_hook_result_t source_output_state_changed_hook_cb(pa_core *c, pa_source_output *s, struct userdata *u) {
- pa_source_output_state_t state;
-
pa_assert(c);
pa_source_output_assert_ref(s);
pa_assert(u);
- state = pa_source_output_get_state(s);
-
- if (state == PA_SOURCE_OUTPUT_RUNNING) {
+ if (pa_source_output_get_state(s) == PA_SOURCE_OUTPUT_RUNNING) {
struct device_info *d;
if (s->source->monitor_of)
@@ -387,22 +398,17 @@ static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, s
pa_sink *s = PA_SINK(o);
pa_sink_state_t state = pa_sink_get_state(s);
- if (pa_sink_check_suspend(s) <= 0) {
-
+ if (pa_sink_check_suspend(s) <= 0)
if (PA_SINK_IS_OPENED(state))
restart(d);
- }
-
} else if (pa_source_isinstance(o)) {
pa_source *s = PA_SOURCE(o);
pa_source_state_t state = pa_source_get_state(s);
- if (pa_source_check_suspend(s) <= 0) {
-
+ if (pa_source_check_suspend(s) <= 0)
if (PA_SOURCE_IS_OPENED(state))
restart(d);
- }
}
return PA_HOOK_OK;
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index c195c045..1a05f57d 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -501,8 +501,9 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in
pa_proplist_setf(data.proplist, "rtp.payload", "%u", (unsigned) sdp_info->payload);
data.module = u->module;
pa_sink_input_new_data_set_sample_spec(&data, &sdp_info->sample_spec);
+ data.flags = PA_SINK_INPUT_VARIABLE_RATE;
- pa_sink_input_new(&s->sink_input, u->module->core, &data, PA_SINK_INPUT_VARIABLE_RATE);
+ pa_sink_input_new(&s->sink_input, u->module->core, &data);
pa_sink_input_new_data_done(&data);
if (!s->sink_input) {
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index f147364d..8e1cfe36 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -330,8 +330,9 @@ int pa__init(pa_module*m) {
data.source = s;
pa_source_output_new_data_set_sample_spec(&data, &ss);
pa_source_output_new_data_set_channel_map(&data, &cm);
+ data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND;
- pa_source_output_new(&o, m->core, &data, PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND);
+ pa_source_output_new(&o, m->core, &data);
pa_source_output_new_data_done(&data);
if (!o) {
diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index 72d304e8..ba657f74 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -214,11 +214,13 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
/* End of headers */
/* We will have a header left from our looping iteration, so add it in :) */
if (c->last_header) {
+ char *tmp = pa_strbuf_tostring_free(c->header_buffer);
/* This is not a continuation header so let's dump it into our proplist */
- pa_headerlist_puts(c->response_headers, c->last_header, pa_strbuf_tostring_free(c->header_buffer));
+ pa_headerlist_puts(c->response_headers, c->last_header, tmp);
+ pa_xfree(tmp);
pa_xfree(c->last_header);
c->last_header = NULL;
- c->header_buffer= NULL;
+ c->header_buffer = NULL;
}
pa_log_debug("Full response received. Dispatching");
@@ -240,9 +242,11 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
}
if (c->last_header) {
+ char *tmp = pa_strbuf_tostring_free(c->header_buffer);
/* This is not a continuation header so let's dump the full
header/value into our proplist */
- pa_headerlist_puts(c->response_headers, c->last_header, pa_strbuf_tostring_free(c->header_buffer));
+ pa_headerlist_puts(c->response_headers, c->last_header, tmp);
+ pa_xfree(tmp);
pa_xfree(c->last_header);
c->last_header = NULL;
c->header_buffer = NULL;