media-session: don't emit busy when we are acquiring

This commit is contained in:
Wim Taymans 2020-09-23 10:22:22 +02:00
parent 136f556d79
commit f4bf7bc7e6

View file

@ -75,6 +75,7 @@ struct rd_device {
unsigned int filtering:1; unsigned int filtering:1;
unsigned int registered:1; unsigned int registered:1;
unsigned int acquiring:1;
unsigned int owning:1; unsigned int owning:1;
}; };
@ -312,7 +313,7 @@ static DBusHandlerResult filter_handler(DBusConnection *c, DBusMessage *m, void
pw_log_debug(NAME" %p: changed %s: %s -> %s", d, name, old, new); pw_log_debug(NAME" %p: changed %s: %s -> %s", d, name, old, new);
if (old == NULL || *old == 0) { if (old == NULL || *old == 0) {
if (d->callbacks->busy) if (d->callbacks->busy && !d->acquiring)
d->callbacks->busy(d->data, d, name, 0); d->callbacks->busy(d->data, d, name, 0);
} else { } else {
if (d->callbacks->available) if (d->callbacks->available)
@ -394,6 +395,8 @@ int rd_device_acquire(struct rd_device *d)
pw_log_debug(NAME"%p: reserve %s", d, d->service_name); pw_log_debug(NAME"%p: reserve %s", d, d->service_name);
d->acquiring = true;
if ((res = dbus_bus_request_name(d->connection, if ((res = dbus_bus_request_name(d->connection,
d->service_name, d->service_name,
(d->priority < INT32_MAX ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT : 0), (d->priority < INT32_MAX ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT : 0),
@ -471,6 +474,7 @@ void rd_device_release(struct rd_device *d)
d->service_name, &error); d->service_name, &error);
dbus_error_free(&error); dbus_error_free(&error);
} }
d->acquiring = false;
} }
void rd_device_destroy(struct rd_device *d) void rd_device_destroy(struct rd_device *d)