mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
make sure we dispatch messages in order
This commit is contained in:
parent
77a1db16b9
commit
f5c8990d18
3 changed files with 20 additions and 16 deletions
|
|
@ -114,18 +114,18 @@ void pa_bluetooth_device_free(pa_bluetooth_device *d) {
|
|||
static pa_bool_t device_is_loaded(pa_bluetooth_device *d) {
|
||||
pa_assert(d);
|
||||
|
||||
/* FIXME: e83621724d7939b97b4f01f0d7e965d61ef8e55e, f1daa282f030e4e2381341e0f65faca47c4b891b is borked, probably needs to be reversed */
|
||||
|
||||
return d->device_info_valid && (d->audio_sink_info_valid || d->headset_info_valid);
|
||||
return
|
||||
d->device_info_valid &&
|
||||
d->audio_sink_info_valid &&
|
||||
d->headset_info_valid;
|
||||
}
|
||||
|
||||
static pa_bool_t device_is_audio(pa_bluetooth_device *d) {
|
||||
pa_assert(d);
|
||||
|
||||
pa_assert(d->device_info_valid);
|
||||
pa_assert(d->audio_sink_info_valid || d->headset_info_valid);
|
||||
|
||||
/* FIXME: e83621724d7939b97b4f01f0d7e965d61ef8e55e, f1daa282f030e4e2381341e0f65faca47c4b891b is borked, probably needs to be reversed */
|
||||
pa_assert(d->audio_sink_info_valid);
|
||||
pa_assert(d->headset_info_valid);
|
||||
|
||||
return d->device_info_valid > 0 &&
|
||||
(d->audio_sink_info_valid > 0 || d->headset_info_valid > 0);
|
||||
|
|
@ -303,7 +303,6 @@ static void run_callback(pa_bluetooth_discovery *y, pa_bluetooth_device *d, pa_b
|
|||
return;
|
||||
|
||||
y->callback(y->userdata, d, good);
|
||||
|
||||
}
|
||||
|
||||
static void get_properties_reply(DBusPendingCall *pending, void *userdata) {
|
||||
|
|
@ -395,7 +394,7 @@ static pa_dbus_pending* send_and_add_to_pending(pa_bluetooth_discovery *y, pa_bl
|
|||
|
||||
pa_assert_se(dbus_connection_send_with_reply(y->connection, m, &call, -1));
|
||||
|
||||
p = pa_dbus_pending_new(m, call, y, d);
|
||||
p = pa_dbus_pending_new(y->connection, m, call, y, d);
|
||||
PA_LLIST_PREPEND(pa_dbus_pending, y->pending, p);
|
||||
dbus_pending_call_set_notify(call, func, p, NULL);
|
||||
|
||||
|
|
@ -656,12 +655,10 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
|
|||
} else if (dbus_message_has_interface(m, "org.bluez.Headset")) {
|
||||
if (parse_audio_property(y, &d->headset_connected, &arg_i) < 0)
|
||||
goto fail;
|
||||
d->headset_info_valid = 1;
|
||||
|
||||
} else if (dbus_message_has_interface(m, "org.bluez.AudioSink")) {
|
||||
if (parse_audio_property(y, &d->audio_sink_connected, &arg_i) < 0)
|
||||
goto fail;
|
||||
d->audio_sink_info_valid = 1;
|
||||
}
|
||||
|
||||
pa_assert_se(y->mode == MODE_DISCOVER);
|
||||
|
|
|
|||
|
|
@ -383,12 +383,19 @@ void pa_dbus_remove_matches(DBusConnection *c, ...) {
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
pa_dbus_pending *pa_dbus_pending_new(DBusMessage *m, DBusPendingCall *pending, void *context_data, void *call_data) {
|
||||
pa_dbus_pending *pa_dbus_pending_new(
|
||||
DBusConnection *c,
|
||||
DBusMessage *m,
|
||||
DBusPendingCall *pending,
|
||||
void *context_data,
|
||||
void *call_data) {
|
||||
|
||||
pa_dbus_pending *p;
|
||||
|
||||
pa_assert(pending);
|
||||
|
||||
p = pa_xnew(pa_dbus_pending, 1);
|
||||
p->connection = c;
|
||||
p->message = m;
|
||||
p->pending = pending;
|
||||
p->context_data = context_data;
|
||||
|
|
@ -402,9 +409,8 @@ pa_dbus_pending *pa_dbus_pending_new(DBusMessage *m, DBusPendingCall *pending, v
|
|||
void pa_dbus_pending_free(pa_dbus_pending *p) {
|
||||
pa_assert(p);
|
||||
|
||||
if (p->pending) {
|
||||
if (p->pending)
|
||||
dbus_pending_call_cancel(p->pending); /* p->pending is freed by cancel() */
|
||||
}
|
||||
|
||||
if (p->message)
|
||||
dbus_message_unref(p->message);
|
||||
|
|
@ -415,8 +421,8 @@ void pa_dbus_pending_free(pa_dbus_pending *p) {
|
|||
void pa_dbus_sync_pending_list(pa_dbus_pending **p) {
|
||||
pa_assert(p);
|
||||
|
||||
while (*p)
|
||||
dbus_pending_call_block((*p)->pending);
|
||||
while (*p && dbus_connection_read_write_dispatch((*p)->connection, -1))
|
||||
;
|
||||
}
|
||||
|
||||
void pa_dbus_free_pending_list(pa_dbus_pending **p) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ typedef struct pa_dbus_pending pa_dbus_pending;
|
|||
struct userdata; /* We leave the actual definition to the caller */
|
||||
|
||||
struct pa_dbus_pending {
|
||||
DBusConnection *connection;
|
||||
DBusMessage *message;
|
||||
DBusPendingCall *pending;
|
||||
|
||||
|
|
@ -55,7 +56,7 @@ struct pa_dbus_pending {
|
|||
PA_LLIST_FIELDS(pa_dbus_pending);
|
||||
};
|
||||
|
||||
pa_dbus_pending *pa_dbus_pending_new(DBusMessage *m, DBusPendingCall *pending, void *context_data, void *call_data);
|
||||
pa_dbus_pending *pa_dbus_pending_new(DBusConnection *c, DBusMessage *m, DBusPendingCall *pending, void *context_data, void *call_data);
|
||||
void pa_dbus_pending_free(pa_dbus_pending *p);
|
||||
|
||||
/* Sync up a list of pa_dbus_pending_call objects */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue