sink, source: improve state change logging

Now the old and new state is logged every time when the sink or source
state changes.
This commit is contained in:
Tanu Kaskinen 2017-12-28 12:09:18 +02:00
parent 94fc586c01
commit eeee5664fa
5 changed files with 34 additions and 36 deletions

View file

@ -381,6 +381,7 @@ static int source_set_state(pa_source *s, pa_source_state_t state) {
return ret;
}
pa_log_debug("%s: state: %s -> %s", s->name, pa_source_state_to_string(s->state), pa_source_state_to_string(state));
s->state = state;
if (state != PA_SOURCE_UNLINKED) { /* if we enter UNLINKED state pa_source_unlink() will fire the appropriate events */
@ -2014,6 +2015,19 @@ unsigned pa_source_check_suspend(pa_source *s, pa_source_output *ignore) {
return ret;
}
const char *pa_source_state_to_string(pa_source_state_t state) {
switch (state) {
case PA_SOURCE_INIT: return "INIT";
case PA_SOURCE_IDLE: return "IDLE";
case PA_SOURCE_RUNNING: return "RUNNING";
case PA_SOURCE_SUSPENDED: return "SUSPENDED";
case PA_SOURCE_UNLINKED: return "UNLINKED";
case PA_SOURCE_INVALID_STATE: return "INVALID_STATE";
}
pa_assert_not_reached();
}
/* Called from the IO thread */
static void sync_output_volumes_within_thread(pa_source *s) {
pa_source_output *o;