summaryrefslogtreecommitdiffstats
path: root/polyp
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-09-01 15:00:44 +0000
committerLennart Poettering <lennart@poettering.net>2004-09-01 15:00:44 +0000
commit50f592b67c9d7364ab0d7ac447c565db4ab83d2a (patch)
treeed80f9f2b084ee6d569c2127f8032ea7d94ff5ab /polyp
parent0205fc57bbfdf03e5cdd5eb3c908f5531c4fdbf1 (diff)
introduce sink input and source output limits
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@170 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp')
-rw-r--r--polyp/module-x11-bell.c6
-rw-r--r--polyp/sample.h4
-rw-r--r--polyp/sink-input.c5
-rw-r--r--polyp/sink.h2
-rw-r--r--polyp/source-output.c6
-rw-r--r--polyp/source.h2
6 files changed, 18 insertions, 7 deletions
diff --git a/polyp/module-x11-bell.c b/polyp/module-x11-bell.c
index 3ed9b068..ae889b22 100644
--- a/polyp/module-x11-bell.c
+++ b/polyp/module-x11-bell.c
@@ -69,11 +69,7 @@ static int ring_bell(struct userdata *u, int percent) {
return -1;
}
- if (pa_scache_play_item(u->core, u->scache_item, s, percent*2) < 0) {
- fprintf(stderr, __FILE__": Failed to play sample\n");
- return -1;
- }
-
+ pa_scache_play_item(u->core, u->scache_item, s, percent*2);
return 0;
}
diff --git a/polyp/sample.h b/polyp/sample.h
index 4b28780d..a5479562 100644
--- a/polyp/sample.h
+++ b/polyp/sample.h
@@ -110,10 +110,10 @@ pa_volume_t pa_volume_from_dB(double f);
double pa_volume_to_dB(pa_volume_t v);
#ifdef INFINITY
-#define PA_DECIBEL_MININFTY -INFINITY
+#define PA_DECIBEL_MININFTY (-INFINITY)
#else
/** This value is used as minus infinity when using pa_volume_{to,from}_dB(). \since 0.4 */
-#define PA_DECIBEL_MININFTY -200
+#define PA_DECIBEL_MININFTY (-200)
#endif
PA_C_DECL_END
diff --git a/polyp/sink-input.c b/polyp/sink-input.c
index 9238fac0..95dc5577 100644
--- a/polyp/sink-input.c
+++ b/polyp/sink-input.c
@@ -42,6 +42,11 @@ struct pa_sink_input* pa_sink_input_new(struct pa_sink *s, const char *name, con
char st[256];
assert(s && spec);
+ if (pa_idxset_ncontents(s->inputs) >= PA_MAX_INPUTS_PER_SINK) {
+ fprintf(stderr, __FILE__": Failed to create sink input: too many inputs per sink.\n");
+ return NULL;
+ }
+
if (!pa_sample_spec_equal(spec, &s->sample_spec))
if (!(resampler = pa_resampler_new(spec, &s->sample_spec, s->core->memblock_stat)))
return NULL;
diff --git a/polyp/sink.h b/polyp/sink.h
index 940d1618..85addf76 100644
--- a/polyp/sink.h
+++ b/polyp/sink.h
@@ -31,6 +31,8 @@ struct pa_sink;
#include "idxset.h"
#include "source.h"
+#define PA_MAX_INPUTS_PER_SINK 6
+
struct pa_sink {
uint32_t index;
diff --git a/polyp/source-output.c b/polyp/source-output.c
index b8083a79..9d124f07 100644
--- a/polyp/source-output.c
+++ b/polyp/source-output.c
@@ -23,6 +23,7 @@
#include <config.h>
#endif
+#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -37,6 +38,11 @@ struct pa_source_output* pa_source_output_new(struct pa_source *s, const char *n
int r;
assert(s && spec);
+ if (pa_idxset_ncontents(s->outputs) >= PA_MAX_OUTPUTS_PER_SOURCE) {
+ fprintf(stderr, __FILE__": Failed to create source output: too many outputs per source.\n");
+ return NULL;
+ }
+
if (!pa_sample_spec_equal(&s->sample_spec, spec))
if (!(resampler = pa_resampler_new(&s->sample_spec, spec, s->core->memblock_stat)))
return NULL;
diff --git a/polyp/source.h b/polyp/source.h
index 32ef14e6..309b87e7 100644
--- a/polyp/source.h
+++ b/polyp/source.h
@@ -32,6 +32,8 @@ struct pa_source;
#include "memchunk.h"
#include "sink.h"
+#define PA_MAX_OUTPUTS_PER_SOURCE 16
+
struct pa_source {
uint32_t index;