Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/ossaudio Update compat/ossaudio with GETISPACE/GE...



details:   https://anonhg.NetBSD.org/src/rev/b85467552c02
branches:  trunk
changeset: 822546:b85467552c02
user:      nat <nat%NetBSD.org@localhost>
date:      Fri Mar 24 14:32:29 2017 +0000

description:
Update compat/ossaudio with GETISPACE/GETOSPACE corrections from
libossaudio.

diffstat:

 sys/compat/ossaudio/ossaudio.c |  20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diffs (50 lines):

diff -r 37ba69a6fe38 -r b85467552c02 sys/compat/ossaudio/ossaudio.c
--- a/sys/compat/ossaudio/ossaudio.c    Fri Mar 24 12:49:43 2017 +0000
+++ b/sys/compat/ossaudio/ossaudio.c    Fri Mar 24 14:32:29 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.69 2014/09/05 09:21:55 matt Exp $       */
+/*     $NetBSD: ossaudio.c,v 1.70 2017/03/24 14:32:29 nat Exp $        */
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.69 2014/09/05 09:21:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.70 2017/03/24 14:32:29 nat Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -619,12 +619,11 @@
                }
                setblocksize(fp, &tmpinfo);
                bufinfo.fragsize = tmpinfo.blocksize;
-               bufinfo.fragments = tmpinfo.hiwat -
-                   (tmpinfo.play.seek + tmpinfo.blocksize - 1) /
+               bufinfo.fragments = (tmpinfo.hiwat * tmpinfo.blocksize -
+                   (tmpinfo.play.seek + tmpinfo.blocksize -1)) /
                    tmpinfo.blocksize;
                bufinfo.fragstotal = tmpinfo.hiwat;
-               bufinfo.bytes =
-                   tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.play.seek;
+               bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
                error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo);
                if (error) {
                        DPRINTF(("%s: SNDCTL_DSP_GETOSPACE = %d\n",
@@ -641,12 +640,9 @@
                }
                setblocksize(fp, &tmpinfo);
                bufinfo.fragsize = tmpinfo.blocksize;
-               bufinfo.fragments = tmpinfo.hiwat -
-                   (tmpinfo.record.seek + tmpinfo.blocksize - 1) /
-                   tmpinfo.blocksize;
-                bufinfo.fragstotal = tmpinfo.hiwat;
-               bufinfo.bytes =
-                   tmpinfo.hiwat * tmpinfo.blocksize - tmpinfo.record.seek;
+               bufinfo.fragments = tmpinfo.record.seek / tmpinfo.blocksize;
+               bufinfo.fragstotal = tmpinfo.hiwat;
+               bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
                error = copyout(&bufinfo, SCARG(uap, data), sizeof bufinfo);
                if (error) {
                        DPRINTF(("%s: SNDCTL_DSP_GETISPACE %d %d %d %d = %d\n",



Home | Main Index | Thread Index | Old Index