* set default fragment metrics depending on the sample specs of the device in OSS and ALSA

* fix fragment size calculation in module-alsa-sink


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@855 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-05-13 21:20:34 +00:00
parent 0231e6ea41
commit 0f22d63289
3 changed files with 21 additions and 15 deletions

View file

@ -342,13 +342,17 @@ int pa__init(pa_core *c, pa_module*m) {
frame_size = pa_frame_size(&ss);
/* Fix latency to 100ms */
periods = 8;
fragsize = 1024;
fragsize = pa_bytes_per_second(&ss)/128;
pa_log("req: %i %i", periods, fragsize);
if (pa_modargs_get_value_u32(ma, "fragments", &periods) < 0 || pa_modargs_get_value_u32(ma, "fragment_size", &fragsize) < 0) {
pa_log(__FILE__": failed to parse buffer metrics");
goto fail;
}
period_size = fragsize;
period_size = fragsize/frame_size;
u = pa_xmalloc0(sizeof(struct userdata));
m->userdata = u;
@ -431,7 +435,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
u->frame_size = frame_size;
u->fragment_size = period_size;
u->fragment_size = period_size * frame_size;
pa_log_info(__FILE__": using %u fragments of size %lu bytes.", periods, (long unsigned)u->fragment_size);