]> code.delx.au - pulseaudio/commitdiff
introduce sink input and source output limits
authorLennart Poettering <lennart@poettering.net>
Wed, 1 Sep 2004 15:00:44 +0000 (15:00 +0000)
committerLennart Poettering <lennart@poettering.net>
Wed, 1 Sep 2004 15:00:44 +0000 (15:00 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@170 fefdeb5f-60dc-0310-8127-8f9354f1896f

doc/todo
polyp/module-x11-bell.c
polyp/sample.h
polyp/sink-input.c
polyp/sink.h
polyp/source-output.c
polyp/source.h

index 107fc443c10fab7ebec0289f3fbfe4da417a3eaa..6aacd3a5fdc928010c36508167877f97ed8645c4 100644 (file)
--- a/doc/todo
+++ b/doc/todo
@@ -13,7 +13,8 @@
 - cleanup tagstruct and modargs (add s32, pa_volume_t, pa_usec_t)
 - remove all gcc warnings
 - esd compatible startup script or personality
-- limit number of concurrent streams
+- add total sample size to stat
+- implement streamed file playbacj
 
 ** later ***
 - xmlrpc/http
index 3ed9b0682479853c24edbd4eea88d96e039517a7..ae889b22139f2526b56187cfc3c52ae7fa6f4872 100644 (file)
@@ -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;
 }
 
index 4b28780df05bfb56bb386c291d2129b05d5f2670..a5479562b89ef7e28d63894fd0a9e5027f168ad2 100644 (file)
@@ -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
index 9238fac0f55fcf539d01dd33030eac714752d942..95dc5577260c33e61cb14864c1bddf15c653b384 100644 (file)
@@ -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;
index 940d16184f61f87243d378071277f3b12b59712f..85addf763f065606b31a38f7affe035e17c14358 100644 (file)
@@ -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;
 
index b8083a79afa9f230fefeccd55d59dd8e962302ec..9d124f074b5a5a4d2645b21d826d30d5b02d2ed4 100644 (file)
@@ -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;
index 32ef14e602c088d982238b258cd2ce522e2bd7e8..309b87e725711121c6738203ef516049e55a34dd 100644 (file)
@@ -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;