summaryrefslogtreecommitdiffstats
path: root/polyp
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2006-01-12 16:11:54 +0000
committerPierre Ossman <ossman@cendio.se>2006-01-12 16:11:54 +0000
commitcb2a7ed02840c076f8b53023658920ea8d12d849 (patch)
tree2b5fe17009a91b8ad7d0fa56ba669b24909eca34 /polyp
parent289c914b470537234c1de498cf195323826d7984 (diff)
Some crappy hardware generate noise on the output when reading input. To
avoid triggering this needlesly we tweak the algorithm a bit to avoid reading when nothing is connected to the source. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@454 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp')
-rw-r--r--polyp/module-oss.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/polyp/module-oss.c b/polyp/module-oss.c
index 12cedf19..06679a97 100644
--- a/polyp/module-oss.c
+++ b/polyp/module-oss.c
@@ -161,7 +161,7 @@ static void do_read(struct userdata *u) {
int loop = 0;
assert(u);
- if (!u->source || !pa_iochannel_is_readable(u->io))
+ if (!u->source || !pa_iochannel_is_readable(u->io) || !pa_idxset_size(u->source->outputs))
return;
update_usage(u);
@@ -209,6 +209,12 @@ static void io_callback(PA_GCC_UNUSED pa_iochannel *io, void*userdata) {
do_read(u);
}
+static void source_notify_cb(pa_source *s) {
+ struct userdata *u = s->userdata;
+ assert(u);
+ do_read(u);
+}
+
static pa_usec_t sink_get_latency_cb(pa_sink *s) {
pa_usec_t r = 0;
int arg;
@@ -329,6 +335,7 @@ int pa__init(pa_core *c, pa_module*m) {
u->source = pa_source_new(c, PA_TYPEID_OSS, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss);
assert(u->source);
u->source->userdata = u;
+ u->source->notify = source_notify_cb;
u->source->get_latency = source_get_latency_cb;
pa_source_set_owner(u->source, m);
u->source->description = pa_sprintf_malloc("Open Sound System PCM on '%s'", p);