mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -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
|
|
@ -1423,6 +1423,8 @@ static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *b
|
|||
return -1;
|
||||
}
|
||||
|
||||
pa_log_debug("%s of sink %s requested via CLI.", suspend ? "Suspending" : "Resuming", sink->name);
|
||||
|
||||
if ((r = pa_sink_suspend(sink, suspend, PA_SUSPEND_USER)) < 0)
|
||||
pa_strbuf_printf(buf, "Failed to resume/suspend sink: %s\n", pa_strerror(r));
|
||||
|
||||
|
|
@ -1459,6 +1461,8 @@ static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf
|
|||
return -1;
|
||||
}
|
||||
|
||||
pa_log_debug("%s of source %s requested via CLI.", suspend ? "Suspending" : "Resuming", source->name);
|
||||
|
||||
if ((r = pa_source_suspend(source, suspend, PA_SUSPEND_USER)) < 0)
|
||||
pa_strbuf_printf(buf, "Failed to resume/suspend source: %s\n", pa_strerror(r));
|
||||
|
||||
|
|
@ -1484,6 +1488,8 @@ static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, p
|
|||
return -1;
|
||||
}
|
||||
|
||||
pa_log_debug("%s of all sinks and sources requested via CLI.", suspend ? "Suspending" : "Resuming");
|
||||
|
||||
if ((r = pa_sink_suspend_all(c, suspend, PA_SUSPEND_USER)) < 0)
|
||||
pa_strbuf_printf(buf, "Failed to resume/suspend all sinks: %s\n", pa_strerror(r));
|
||||
|
||||
|
|
|
|||
|
|
@ -949,6 +949,9 @@ static int esd_proto_standby_or_resume(connection *c, esd_proto_t request, const
|
|||
connection_write_prepare(c, sizeof(int32_t) * 2);
|
||||
connection_write(c, &ok, sizeof(int32_t));
|
||||
|
||||
pa_log_debug("%s of all sinks and sources requested by client %" PRIu32 ".",
|
||||
request == ESD_PROTO_STANDBY ? "Suspending" : "Resuming", c->client->index);
|
||||
|
||||
if (request == ESD_PROTO_STANDBY) {
|
||||
ok = pa_sink_suspend_all(c->protocol->core, true, PA_SUSPEND_USER) >= 0;
|
||||
ok &= pa_source_suspend_all(c->protocol->core, true, PA_SUSPEND_USER) >= 0;
|
||||
|
|
|
|||
|
|
@ -4552,6 +4552,9 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
|
|||
|
||||
CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY);
|
||||
|
||||
pa_log_debug("%s of sink %s requested by client %" PRIu32 ".",
|
||||
b ? "Suspending" : "Resuming", sink->name, c->client->index);
|
||||
|
||||
if (pa_sink_suspend(sink, b, PA_SUSPEND_USER) < 0) {
|
||||
pa_pstream_send_error(c->pstream, tag, PA_ERR_INVALID);
|
||||
return;
|
||||
|
|
@ -4580,6 +4583,9 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
|
|||
|
||||
CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY);
|
||||
|
||||
pa_log_debug("%s of source %s requested by client %" PRIu32 ".",
|
||||
b ? "Suspending" : "Resuming", source->name, c->client->index);
|
||||
|
||||
if (pa_source_suspend(source, b, PA_SUSPEND_USER) < 0) {
|
||||
pa_pstream_send_error(c->pstream, tag, PA_ERR_INVALID);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1395,6 +1395,7 @@ pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough)
|
|||
if (!passthrough && pa_sink_used_by(s) > 0)
|
||||
return FALSE;
|
||||
|
||||
pa_log_debug("Suspending sink %s due to changing the sample rate.", s->name);
|
||||
pa_sink_suspend(s, TRUE, PA_SUSPEND_IDLE); /* needed before rate update, will be resumed automatically */
|
||||
|
||||
if (s->update_rate(s, desired_rate) == TRUE) {
|
||||
|
|
@ -1531,8 +1532,10 @@ void pa_sink_enter_passthrough(pa_sink *s) {
|
|||
pa_cvolume volume;
|
||||
|
||||
/* disable the monitor in passthrough mode */
|
||||
if (s->monitor_source)
|
||||
if (s->monitor_source) {
|
||||
pa_log_debug("Suspending monitor source %s, because the sink is entering the passthrough mode.", s->monitor_source->name);
|
||||
pa_source_suspend(s->monitor_source, TRUE, PA_SUSPEND_PASSTHROUGH);
|
||||
}
|
||||
|
||||
/* set the volume to NORM */
|
||||
s->saved_volume = *pa_sink_get_volume(s, TRUE);
|
||||
|
|
@ -1545,8 +1548,10 @@ void pa_sink_enter_passthrough(pa_sink *s) {
|
|||
/* Called from main context */
|
||||
void pa_sink_leave_passthrough(pa_sink *s) {
|
||||
/* Unsuspend monitor */
|
||||
if (s->monitor_source)
|
||||
if (s->monitor_source) {
|
||||
pa_log_debug("Resuming monitor source %s, because the sink is leaving the passthrough mode.", s->monitor_source->name);
|
||||
pa_source_suspend(s->monitor_source, FALSE, PA_SUSPEND_PASSTHROUGH);
|
||||
}
|
||||
|
||||
/* Restore sink volume to what it was before we entered passthrough mode */
|
||||
pa_sink_set_volume(s, &s->saved_volume, TRUE, s->saved_save_volume);
|
||||
|
|
|
|||
|
|
@ -1006,6 +1006,7 @@ pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrou
|
|||
if (!passthrough && pa_source_used_by(s) > 0)
|
||||
return FALSE;
|
||||
|
||||
pa_log_debug("Suspending source %s due to changing the sample rate.", s->name);
|
||||
pa_source_suspend(s, TRUE, PA_SUSPEND_IDLE); /* needed before rate update, will be resumed automatically */
|
||||
|
||||
if (s->update_rate(s, desired_rate) == TRUE) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue