mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-23 06:59:53 -05:00
count corked streams per sink/source and make pa_sink_used_by() return only the number of streams that are not corked. Introduce pa_sink_linked_by() returning the number of streams connected at all. This will allow suspending of sinks/sources when all streams connected to a sink are corked.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1824 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
5ae4eed52e
commit
8389264d65
7 changed files with 64 additions and 7 deletions
|
|
@ -225,6 +225,15 @@ pa_sink_input* pa_sink_input_new(
|
|||
return i;
|
||||
}
|
||||
|
||||
static void update_n_corked(pa_sink_input *i, pa_sink_input_state_t state) {
|
||||
pa_assert(i);
|
||||
|
||||
if (i->state == PA_SINK_INPUT_CORKED && state != PA_SINK_INPUT_CORKED)
|
||||
pa_assert_se(i->sink->n_corked -- >= 1);
|
||||
else if (i->state != PA_SINK_INPUT_CORKED && state == PA_SINK_INPUT_CORKED)
|
||||
i->sink->n_corked++;
|
||||
}
|
||||
|
||||
static int sink_input_set_state(pa_sink_input *i, pa_sink_input_state_t state) {
|
||||
pa_sink_input *ssync;
|
||||
pa_assert(i);
|
||||
|
|
@ -238,11 +247,17 @@ static int sink_input_set_state(pa_sink_input *i, pa_sink_input_state_t state) {
|
|||
if (pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_STATE, PA_UINT_TO_PTR(state), 0, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
update_n_corked(i, state);
|
||||
i->state = state;
|
||||
for (ssync = i->sync_prev; ssync; ssync = ssync->sync_prev)
|
||||
|
||||
for (ssync = i->sync_prev; ssync; ssync = ssync->sync_prev) {
|
||||
update_n_corked(ssync, state);
|
||||
ssync->state = state;
|
||||
for (ssync = i->sync_next; ssync; ssync = ssync->sync_next)
|
||||
}
|
||||
for (ssync = i->sync_next; ssync; ssync = ssync->sync_next) {
|
||||
update_n_corked(ssync, state);
|
||||
ssync->state = state;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue