From owner-svn-src-head@FreeBSD.ORG Mon Aug 18 14:30:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C9B6381; Mon, 18 Aug 2014 14:30:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6719D3E46; Mon, 18 Aug 2014 14:30:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7IEUiJw007912; Mon, 18 Aug 2014 14:30:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7IEUiEV007911; Mon, 18 Aug 2014 14:30:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201408181430.s7IEUiEV007911@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 18 Aug 2014 14:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270134 - head/sys/dev/sound/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Aug 2014 14:30:44 -0000 Author: hselasky Date: Mon Aug 18 14:30:43 2014 New Revision: 270134 URL: http://svnweb.freebsd.org/changeset/base/270134 Log: 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 Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Mon Aug 18 14:23:07 2014 (r270133) +++ head/sys/dev/sound/usb/uaudio.c Mon Aug 18 14:30:43 2014 (r270134) @@ -1659,21 +1659,10 @@ uaudio_chan_fill_info_sub(struct uaudio_ } 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_ 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",