From owner-svn-src-stable-8@FreeBSD.ORG Wed Aug 27 14:25:18 2014 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E0CC16B2; Wed, 27 Aug 2014 14:25:18 +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 B1CE13923; Wed, 27 Aug 2014 14:25:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7REPIbl099097; Wed, 27 Aug 2014 14:25:18 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7REPIfT099095; Wed, 27 Aug 2014 14:25:18 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201408271425.s7REPIfT099095@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 27 Aug 2014 14:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r270719 - stable/8/sys/dev/sound/usb X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Aug 2014 14:25:19 -0000 Author: hselasky Date: Wed Aug 27 14:25:18 2014 New Revision: 270719 URL: http://svnweb.freebsd.org/changeset/base/270719 Log: MFC r270134: 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 Modified: stable/8/sys/dev/sound/usb/uaudio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/usb/ (props changed) Modified: stable/8/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Wed Aug 27 14:24:00 2014 (r270718) +++ stable/8/sys/dev/sound/usb/uaudio.c Wed Aug 27 14:25:18 2014 (r270719) @@ -1665,21 +1665,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)) { @@ -1726,7 +1715,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",