[polypaudio-commits] r981 - /trunk/src/utils/padsp.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri May 26 05:18:08 PDT 2006


Author: ossman
Date: Fri May 26 14:18:07 2006
New Revision: 981

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=981&root=polypaudio&view=rev
Log:
Fix the fix_metrics() function so that we don't get a tiny buffer by default.

Modified:
    trunk/src/utils/padsp.c

Modified: trunk/src/utils/padsp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/utils/padsp.c?rev=981&root=polypaudio&r1=980&r2=981&view=diff
==============================================================================
--- trunk/src/utils/padsp.c (original)
+++ trunk/src/utils/padsp.c Fri May 26 14:18:07 2006
@@ -357,7 +357,7 @@
     i->sample_spec.format = PA_SAMPLE_ULAW;
     i->sample_spec.channels = 1;
     i->sample_spec.rate = 8000;
-    i->fragment_size = 1024;
+    i->fragment_size = 0;
     i->n_fragments = 0;
 }
 
@@ -627,13 +627,23 @@
 
     fs = pa_frame_size(&i->sample_spec);
     i->fragment_size = (i->fragment_size/fs)*fs;
-    
-    if (i->n_fragments < 2)
-        i->n_fragments = 12;
-
-    if (i->fragment_size <= 0)
-        if ((i->fragment_size = pa_bytes_per_second(&i->sample_spec) / 2 / i->n_fragments) <= 0)
+
+    /* Number of fragments set? */
+    if (i->n_fragments < 2) {
+        if (i->fragment_size > 0) {
+            i->n_fragments = pa_bytes_per_second(&i->sample_spec) / 2 / i->fragment_size;
+            if (i->n_fragments < 2)
+                i->n_fragments = 2;
+        } else
+            i->n_fragments = 12;
+    }
+
+    /* Fragment size set? */
+    if (i->fragment_size <= 0) {
+        i->fragment_size = pa_bytes_per_second(&i->sample_spec) / 2 / i->n_fragments;
+        if (i->fragment_size < 1024)
             i->fragment_size = 1024;
+    }
 
     debug(__FILE__": sample spec: %s\n", pa_sample_spec_snprint(t, sizeof(t), &i->sample_spec));
     debug(__FILE__": fixated metrics to %i fragments, %li bytes each.\n", i->n_fragments, (long)i->fragment_size);




More information about the pulseaudio-commits mailing list