mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-09 13:29:59 -05:00
Log the reason for every suspend/resume.
I was looking at a log that showed that a suspend happened (at a strange time), but the log didn't tell me why the suspend was done. This patch tries to make sure that that won't happen again.
This commit is contained in:
parent
28c49a12fc
commit
0f44b1e820
12 changed files with 76 additions and 25 deletions
|
|
@ -923,19 +923,30 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat
|
|||
static void handle_suspend(DBusConnection *conn, DBusMessage *msg, void *userdata) {
|
||||
pa_dbusiface_device *d = userdata;
|
||||
dbus_bool_t suspend = FALSE;
|
||||
pa_client *client;
|
||||
|
||||
pa_assert(conn);
|
||||
pa_assert(msg);
|
||||
pa_assert(d);
|
||||
|
||||
pa_assert_se(dbus_message_get_args(msg, NULL, DBUS_TYPE_BOOLEAN, &suspend, DBUS_TYPE_INVALID));
|
||||
pa_assert_se(client = pa_dbus_protocol_get_client(d->dbus_protocol, conn));
|
||||
|
||||
if ((d->type == PA_DEVICE_TYPE_SINK) && (pa_sink_suspend(d->sink, suspend, PA_SUSPEND_USER) < 0)) {
|
||||
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Internal error in PulseAudio: pa_sink_suspend() failed.");
|
||||
return;
|
||||
} else if ((d->type == PA_DEVICE_TYPE_SOURCE) && (pa_source_suspend(d->source, suspend, PA_SUSPEND_USER) < 0)) {
|
||||
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Internal error in PulseAudio: pa_source_suspend() failed.");
|
||||
return;
|
||||
if (d->type == PA_DEVICE_TYPE_SINK) {
|
||||
pa_log_debug("%s sink %s requested by client %" PRIu32 ".", suspend ? "Suspending" : "Resuming", d->sink->name, client->index);
|
||||
|
||||
if (pa_sink_suspend(d->sink, suspend, PA_SUSPEND_USER) < 0) {
|
||||
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Internal error in PulseAudio: pa_sink_suspend() failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
pa_log_debug("%s source %s requested by client %" PRIu32 ".", suspend ? "Suspending" : "Resuming", d->source->name, client->index);
|
||||
|
||||
if (pa_source_suspend(d->source, suspend, PA_SUSPEND_USER) < 0) {
|
||||
pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Internal error in PulseAudio: pa_source_suspend() failed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pa_dbus_send_empty_reply(conn, msg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue