Module Name:    src
Committed By:   isaki
Date:           Tue Jan 29 11:54:02 UTC 2019

Modified Files:
        src/lib/libossaudio: ossaudio.c

Log Message:
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@


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.34 src/lib/libossaudio/ossaudio.c:1.35
--- src/lib/libossaudio/ossaudio.c:1.34	Wed Jan 23 00:08:06 2019
+++ src/lib/libossaudio/ossaudio.c	Tue Jan 29 11:54:02 2019
@@ -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 @@ audio_ioctl(int fd, unsigned long com, v
 			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:

Reply via email to