mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
sink, source: improve suspend cause logging
Previously the suspend cause was logged as a hexadecimal number, now it's logged as a human-friendly string. Also, the command line interface handled only a subset of causes when printing them, now all suspend causes are printed.
This commit is contained in:
parent
eeee5664fa
commit
f176443181
5 changed files with 80 additions and 15 deletions
|
|
@ -840,11 +840,17 @@ void pa_sink_set_mixer_dirty(pa_sink *s, bool is_dirty) {
|
|||
|
||||
/* Called from main context */
|
||||
int pa_sink_suspend(pa_sink *s, bool suspend, pa_suspend_cause_t cause) {
|
||||
pa_suspend_cause_t old_cause;
|
||||
char old_cause_buf[PA_SUSPEND_CAUSE_TO_STRING_BUF_SIZE];
|
||||
char new_cause_buf[PA_SUSPEND_CAUSE_TO_STRING_BUF_SIZE];
|
||||
|
||||
pa_sink_assert_ref(s);
|
||||
pa_assert_ctl_context();
|
||||
pa_assert(PA_SINK_IS_LINKED(s->state));
|
||||
pa_assert(cause != 0);
|
||||
|
||||
old_cause = s->suspend_cause;
|
||||
|
||||
if (suspend) {
|
||||
s->suspend_cause |= cause;
|
||||
s->monitor_source->suspend_cause |= cause;
|
||||
|
|
@ -853,6 +859,11 @@ int pa_sink_suspend(pa_sink *s, bool suspend, pa_suspend_cause_t cause) {
|
|||
s->monitor_source->suspend_cause &= ~cause;
|
||||
}
|
||||
|
||||
if (s->suspend_cause != old_cause) {
|
||||
pa_log_debug("%s: suspend_cause: %s -> %s", s->name, pa_suspend_cause_to_string(old_cause, old_cause_buf),
|
||||
pa_suspend_cause_to_string(s->suspend_cause, new_cause_buf));
|
||||
}
|
||||
|
||||
if (!(s->suspend_cause & PA_SUSPEND_SESSION) && (pa_atomic_load(&s->mixer_dirty) != 0)) {
|
||||
/* This might look racy but isn't: If somebody sets mixer_dirty exactly here,
|
||||
it'll be handled just fine. */
|
||||
|
|
@ -877,8 +888,6 @@ int pa_sink_suspend(pa_sink *s, bool suspend, pa_suspend_cause_t cause) {
|
|||
if ((pa_sink_get_state(s) == PA_SINK_SUSPENDED) == !!s->suspend_cause)
|
||||
return 0;
|
||||
|
||||
pa_log_debug("Suspend cause of sink %s is 0x%04x, %s", s->name, s->suspend_cause, s->suspend_cause ? "suspending" : "resuming");
|
||||
|
||||
if (s->suspend_cause)
|
||||
return sink_set_state(s, PA_SINK_SUSPENDED);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue