diff options
-rw-r--r-- | src/modules/module-solaris.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index 90cf010b..66968cb1 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -82,6 +82,8 @@ struct userdata { pa_memchunk memchunk; + unsigned int page_size; + uint32_t frame_size; uint32_t buffer_size; unsigned int written_bytes, read_bytes; @@ -193,7 +195,8 @@ static void do_write(struct userdata *u) { static void do_read(struct userdata *u) { pa_memchunk memchunk; - int err, l; + int err; + size_t l; ssize_t r; assert(u); @@ -205,6 +208,11 @@ static void do_read(struct userdata *u) { err = ioctl(u->fd, I_NREAD, &l); assert(err >= 0); + /* This is to make sure it fits in the memory pool. Also, a page + should be the most efficient transfer size. */ + if (l > u->page_size) + l = u->page_size; + memchunk.memblock = pa_memblock_new(u->core->mempool, l); assert(memchunk.memblock); if ((r = pa_iochannel_read(u->io, memchunk.memblock->data, memchunk.memblock->length)) < 0) { @@ -589,6 +597,10 @@ int pa__init(pa_core *c, pa_module*m) { u->memchunk.memblock = NULL; u->memchunk.length = 0; + + /* We use this to get a reasonable chunk size */ + u->page_size = sysconf(_SC_PAGESIZE); + u->frame_size = pa_frame_size(&ss); u->buffer_size = buffer_size; |