From 55651ec215b8359aaf3668cc37eb270847563cc3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 24 Sep 2007 16:24:23 +0000 Subject: [PATCH] don't count streams using the monitor source in pa_sink_used_by(), because this would disallow suspending a sink ehn an rtp stream is connected git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1895 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/cli-text.c | 12 ++++++++---- src/pulsecore/sink.c | 11 ++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c index ec22019..6683e69 100644 --- a/src/pulsecore/cli-text.c +++ b/src/pulsecore/cli-text.c @@ -119,7 +119,8 @@ char *pa_sink_list_to_string(pa_core *c) { "\tmonitor source: <%u>\n" "\tsample spec: <%s>\n" "\tchannel map: <%s>\n" - "\tused by: <%u>\n", + "\tused by: <%u>\n" + "\tlinked by: <%u>\n", c->default_sink_name && !strcmp(sink->name, c->default_sink_name) ? '*' : ' ', sink->index, sink->name, @@ -134,7 +135,8 @@ char *pa_sink_list_to_string(pa_core *c) { sink->monitor_source ? sink->monitor_source->index : PA_INVALID_INDEX, pa_sample_spec_snprint(ss, sizeof(ss), &sink->sample_spec), pa_channel_map_snprint(cm, sizeof(cm), &sink->channel_map), - pa_sink_used_by(sink)); + pa_sink_used_by(sink), + pa_sink_linked_by(sink)); if (sink->module) pa_strbuf_printf(s, "\tmodule: <%u>\n", sink->module->index); @@ -177,7 +179,8 @@ char *pa_source_list_to_string(pa_core *c) { "\tlatency: <%0.0f usec>\n" "\tsample spec: <%s>\n" "\tchannel map: <%s>\n" - "\tused by: <%u>\n", + "\tused by: <%u>\n" + "\tlinked by: <%u>\n", c->default_source_name && !strcmp(source->name, c->default_source_name) ? '*' : ' ', source->index, source->name, @@ -191,7 +194,8 @@ char *pa_source_list_to_string(pa_core *c) { (double) pa_source_get_latency(source), pa_sample_spec_snprint(ss, sizeof(ss), &source->sample_spec), pa_channel_map_snprint(cm, sizeof(cm), &source->channel_map), - pa_source_used_by(source)); + pa_source_used_by(source), + pa_source_linked_by(source)); if (source->monitor_of) pa_strbuf_printf(s, "\tmonitor_of: <%u>\n", source->monitor_of->index); diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 830960a..733a9d9 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -775,8 +775,11 @@ unsigned pa_sink_linked_by(pa_sink *s) { ret = pa_idxset_size(s->inputs); + /* We add in the number of streams connected to us here. Please + * not the asymmmetry to pa_sink_used_by()! */ + if (s->monitor_source) - ret += pa_source_used_by(s->monitor_source); + ret += pa_source_linked_by(s->monitor_source); return ret; } @@ -788,13 +791,11 @@ unsigned pa_sink_used_by(pa_sink *s) { pa_assert(PA_SINK_LINKED(s->state)); ret = pa_idxset_size(s->inputs); - pa_assert(ret >= s->n_corked); - ret -= s->n_corked; - if (s->monitor_source) - ret += pa_source_used_by(s->monitor_source); + /* Streams connected to our monitor source do not matter for + * pa_sink_used_by()!.*/ return ret; } -- 2.7.4