summaryrefslogtreecommitdiff
path: root/audio/xmms/patches/patch-af
blob: b72c00f7ae5fa6493069cdacd91aeb1e1e64e39a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$NetBSD: patch-af,v 1.4 2001/05/20 20:52:24 rh Exp $

--- Output/OSS/audio.c.orig	Sat Jul 29 02:19:41 2000
+++ Output/OSS/audio.c
@@ -39,9 +39,22 @@
 
 static void oss_calc_device_buffer_used(void)
 {
+#if defined(__NetBSD__) && SOUND_VERSION <= 0x030000
+	struct audio_info info;
+#endif
 	audio_buf_info buf_info;
 	if(paused)
 		device_buffer_used = 0;
+#if defined(__NetBSD__) && SOUND_VERSION <= 0x030000
+	/*
+	  This is to work around a bug in NetBSD-1.5.1 and earlier, in which
+	  the SNDCTL_DSP_GETOSPACE(&buf_info) ioctl was not handled properly.
+	  The correct information is always available via the native audio
+	  driver, so use that instead.
+	*/
+	else if (!ioctl(fd, AUDIO_GETINFO, &info))
+		device_buffer_used = info.play.seek;
+#endif
 	else if (!ioctl(fd, SNDCTL_DSP_GETOSPACE, &buf_info))
 		device_buffer_used = (buf_info.fragstotal * buf_info.fragsize) - buf_info.bytes;
 }