Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libossaudio ossv4 mixer API: be extra careful with the i...
details: https://anonhg.NetBSD.org/src/rev/8114a9cc47d3
branches: trunk
changeset: 953654:8114a9cc47d3
user: nia <nia%NetBSD.org@localhost>
date: Mon Mar 15 10:58:05 2021 +0000
description:
ossv4 mixer API: be extra careful with the inputs to AUDIO_MIXER_READ.
some drivers (not hdaudio(4), but uaudio(4), eap(4), sb(4), various other
old cards) will return error if a AUDIO_MIXER_VALUE is requested and the
number of channels is not specified as input. this is not documented as
well as it should be, unfortunately.
diffstat:
lib/libossaudio/ossaudio.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (44 lines):
diff -r e7563ee4b5c5 -r 8114a9cc47d3 lib/libossaudio/ossaudio.c
--- a/lib/libossaudio/ossaudio.c Mon Mar 15 07:30:40 2021 +0000
+++ b/lib/libossaudio/ossaudio.c Mon Mar 15 10:58:05 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ossaudio.c,v 1.65 2020/12/19 12:55:28 nia Exp $ */
+/* $NetBSD: ossaudio.c,v 1.66 2021/03/15 10:58:05 nia Exp $ */
/*-
* Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: ossaudio.c,v 1.65 2020/12/19 12:55:28 nia Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.66 2021/03/15 10:58:05 nia Exp $");
/*
* This is an Open Sound System compatibility layer, which provides
@@ -1442,6 +1442,7 @@
errno = tmperrno;
return retval;
}
+ mc.type = mdi.type;
switch (mdi.type) {
case AUDIO_MIXER_ENUM:
if (mv->value >= mdi.un.e.num_mem) {
@@ -1469,6 +1470,7 @@
#endif
break;
case AUDIO_MIXER_VALUE:
+ mc.un.value.num_channels = mdi.un.v.num_channels;
if (mdi.un.v.num_channels != 2) {
for (i = 0; i < mdi.un.v.num_channels; ++i) {
mc.un.value.level[i] = mv->value;
@@ -1512,6 +1514,9 @@
return retval;
}
mc.dev = mdi.index;
+ mc.type = mdi.type;
+ if (mdi.type == AUDIO_MIXER_VALUE)
+ mc.un.value.num_channels = mdi.un.v.num_channels;
retval = ioctl(newfd, AUDIO_MIXER_READ, &mc);
if (retval < 0) {
tmperrno = errno;
Home |
Main Index |
Thread Index |
Old Index