From owner-svn-src-all@freebsd.org Wed Nov 9 07:09:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77FD7C3797C; Wed, 9 Nov 2016 07:09:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 49AECCBB; Wed, 9 Nov 2016 07:09:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA979RGf035473; Wed, 9 Nov 2016 07:09:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA979RAZ035472; Wed, 9 Nov 2016 07:09:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611090709.uA979RAZ035472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 9 Nov 2016 07:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308461 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2016 07:09:28 -0000 Author: hselasky Date: Wed Nov 9 07:09:27 2016 New Revision: 308461 URL: https://svnweb.freebsd.org/changeset/base/308461 Log: Allow higher sample rates to have more jitter than lower ones. PR: 208791 MFC after: 3 days Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Wed Nov 9 06:47:29 2016 (r308460) +++ head/sys/dev/sound/usb/uaudio.c Wed Nov 9 07:09:27 2016 (r308461) @@ -2079,6 +2079,8 @@ uaudio_chan_play_sync_callback(struct us * recording channel: */ if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + int32_t jitter_max = howmany(sample_rate, 16000); + /* * Range check the jitter values to avoid * bogus sample rate adjustments. The expected @@ -2087,12 +2089,11 @@ uaudio_chan_play_sync_callback(struct us * mandates this requirement. Refer to chapter * 5.12.4.2 about feedback. */ - if (temp > sample_rate) - ch->jitter_curr = 1; - else if (temp < sample_rate) - ch->jitter_curr = -1; - else - ch->jitter_curr = 0; + ch->jitter_curr = temp - sample_rate; + if (ch->jitter_curr > jitter_max) + ch->jitter_curr = jitter_max; + else if (ch->jitter_curr < -jitter_max) + ch->jitter_curr = -jitter_max; } ch->feedback_rate = temp; break;