Source-Changes-HG archive

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

[src/trunk]: src/lib/libossaudio Revert a wrong SNDCTL_DSP_GETOSPACE part of ...



details:   https://anonhg.NetBSD.org/src/rev/c2270284b17f
branches:  trunk
changeset: 448299:c2270284b17f
user:      isaki <isaki%NetBSD.org@localhost>
date:      Tue Jan 29 11:54:02 2019 +0000

description:
Revert a wrong SNDCTL_DSP_GETOSPACE part of rev1.33.
- 'fragments' is the number of full free blocks and should not be
  negative value.
- 'bytes' should not be rounded down.
It makes mpv work correctly (fixes a second half of kern/53028).
Reviewed by mlelstv@

diffstat:

 lib/libossaudio/ossaudio.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r 9797edcfdcf2 -r c2270284b17f lib/libossaudio/ossaudio.c
--- a/lib/libossaudio/ossaudio.c        Tue Jan 29 11:51:05 2019 +0000
+++ b/lib/libossaudio/ossaudio.c        Tue Jan 29 11:54:02 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.34 2019/01/23 00:08:06 mrg Exp $        */
+/*     $NetBSD: ossaudio.c,v 1.35 2019/01/29 11:54:02 isaki Exp $      */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: ossaudio.c,v 1.34 2019/01/23 00:08:06 mrg Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.35 2019/01/29 11:54:02 isaki Exp $");
 
 /*
  * This is an OSS (Linux) sound API emulator.
@@ -411,11 +411,11 @@
                        return retval;
                setblocksize(fd, &tmpinfo);
                bufinfo.fragsize = tmpinfo.blocksize;
-               bufinfo.fragments = (tmpinfo.hiwat * tmpinfo.blocksize -
-                   (tmpinfo.play.seek + tmpinfo.blocksize -1)) /
-                   tmpinfo.blocksize;
+               bufinfo.fragments = tmpinfo.hiwat - (tmpinfo.play.seek
+                   + tmpinfo.blocksize - 1) / tmpinfo.blocksize;
                bufinfo.fragstotal = tmpinfo.hiwat;
-               bufinfo.bytes = bufinfo.fragments * tmpinfo.blocksize;
+               bufinfo.bytes = tmpinfo.hiwat * tmpinfo.blocksize
+                   - tmpinfo.play.seek;
                *(struct audio_buf_info *)argp = bufinfo;
                break;
        case SNDCTL_DSP_GETISPACE:



Home | Main Index | Thread Index | Old Index