diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-09-15 14:21:05 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-09-15 14:21:05 +0000 |
commit | 8389264d6560d32b3912c60474497742807efbde (patch) | |
tree | 5a9218108ee461f894c1829369e30a7c19788b00 /src/pulsecore/source.c | |
parent | 5ae4eed52e911fb3e9712e1cd7d6095427515cd1 (diff) |
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
Diffstat (limited to 'src/pulsecore/source.c')
-rw-r--r-- | src/pulsecore/source.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 63ff9d7d..d72349f8 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -93,6 +93,7 @@ pa_source* pa_source_new( s->channel_map = *map; s->outputs = pa_idxset_new(NULL, NULL); + s->n_corked = 0; s->monitor_of = NULL; pa_cvolume_reset(&s->volume, spec->channels); @@ -426,13 +427,25 @@ void pa_source_set_rtpoll(pa_source *s, pa_rtpoll *p) { s->rtpoll = p; } -unsigned pa_source_used_by(pa_source *s) { +unsigned pa_source_linked_by(pa_source *s) { pa_source_assert_ref(s); pa_assert(PA_SOURCE_LINKED(s->state)); return pa_idxset_size(s->outputs); } +unsigned pa_source_used_by(pa_source *s) { + unsigned ret; + + pa_source_assert_ref(s); + pa_assert(PA_SOURCE_LINKED(s->state)); + + ret = pa_idxset_size(s->outputs); + pa_assert(ret >= s->n_corked); + + return ret - s->n_corked; +} + int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_t offset, pa_memchunk *chunk) { pa_source *s = PA_SOURCE(object); pa_source_assert_ref(s); |