summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2006-05-26 12:18:07 +0000
committerPierre Ossman <ossman@cendio.se>2006-05-26 12:18:07 +0000
commit12dc4c21ac4e31becf687513ac9852a3ae6893e5 (patch)
treebed30c19e645fc9f00c392181064c8afabe55882 /src/utils
parent7d90e3a32d52a5d94b536c0286d3e87f4df01fd0 (diff)
Fix the fix_metrics() function so that we don't get a tiny buffer by default.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@981 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/padsp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/utils/padsp.c b/src/utils/padsp.c
index b3e443d3..8bad126b 100644
--- a/src/utils/padsp.c
+++ b/src/utils/padsp.c
@@ -357,7 +357,7 @@ static void reset_params(fd_info *i) {
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 @@ static void fix_metrics(fd_info *i) {
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);