summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/usb
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2014-08-18 14:30:43 +0000
committerhselasky <hselasky@FreeBSD.org>2014-08-18 14:30:43 +0000
commita90787f44f207a1183037fa69775a4ac0a1e9e21 (patch)
treec74adca390c6ec3164bb34844f88575cbbe64257 /sys/dev/sound/usb
parent1ca71f77fa6863b75f96cba1db476dd313762cff (diff)
downloadFreeBSD-src-a90787f44f207a1183037fa69775a4ac0a1e9e21.zip
FreeBSD-src-a90787f44f207a1183037fa69775a4ac0a1e9e21.tar.gz
Use the "bSubslotSize" and "bSubFrameSize" fields to obtain the actual
sample size. According to the USB audio frame format specification from USB.org, the value in the "bBitResolution" field can be less than the actual sample size, depending on the actual hardware, and should not be used for this computation. PR: 192755 MFC after: 1 week
Diffstat (limited to 'sys/dev/sound/usb')
-rw-r--r--sys/dev/sound/usb/uaudio.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 6c798cc..9d98a78 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -1659,21 +1659,10 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev,
} else if (audio_rev >= UAUDIO_VERSION_20) {
uint32_t dwFormat;
- uint8_t bSubslotSize;
dwFormat = UGETDW(asid.v2->bmFormats);
bChannels = asid.v2->bNrChannels;
- bBitResolution = asf1d.v2->bBitResolution;
- bSubslotSize = asf1d.v2->bSubslotSize;
-
- /* Map 4-byte aligned 24-bit samples into 32-bit */
- if (bBitResolution == 24 && bSubslotSize == 4)
- bBitResolution = 32;
-
- if (bBitResolution != (bSubslotSize * 8)) {
- DPRINTF("Invalid bSubslotSize\n");
- goto next_ep;
- }
+ bBitResolution = asf1d.v2->bSubslotSize * 8;
if ((bChannels != channels) ||
(bBitResolution != bit_resolution)) {
@@ -1720,7 +1709,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev,
wFormat = UGETW(asid.v1->wFormatTag);
bChannels = UAUDIO_MAX_CHAN(asf1d.v1->bNrChannels);
- bBitResolution = asf1d.v1->bBitResolution;
+ bBitResolution = asf1d.v1->bSubFrameSize * 8;
if (asf1d.v1->bSamFreqType == 0) {
DPRINTFN(16, "Sample rate: %d-%dHz\n",
OpenPOWER on IntegriCloud