Date: Tue, 8 Nov 2016 08:09:49 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308437 - head/sys/dev/sound/usb Message-ID: <201611080809.uA889nVl088842@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Tue Nov 8 08:09:48 2016 New Revision: 308437 URL: https://svnweb.freebsd.org/changeset/base/308437 Log: Range check the jitter values to avoid bogus sample rate adjustments. The expected deviation should not be more than 1Hz per second. The USB v2.0 specification also mandates this requirement. Refer to chapter 5.12.4.2 about feedback. 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 Tue Nov 8 07:18:39 2016 (r308436) +++ head/sys/dev/sound/usb/uaudio.c Tue Nov 8 08:09:48 2016 (r308437) @@ -2078,9 +2078,22 @@ uaudio_chan_play_sync_callback(struct us * Use feedback value as fallback when there is no * recording channel: */ - if (ch->priv_sc->sc_rec_chan.num_alt == 0) - ch->jitter_curr = temp - sample_rate; - + if (ch->priv_sc->sc_rec_chan.num_alt == 0) { + /* + * Range check the jitter values to avoid + * bogus sample rate adjustments. The expected + * deviation should not be more than 1Hz per + * second. The USB v2.0 specification also + * 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->feedback_rate = temp; break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611080809.uA889nVl088842>