diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2016-11-08 08:09:48 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2016-11-08 08:09:48 +0000 |
| commit | dd3dde9828049e11572d78ad6b79fe5f7268ad4a (patch) | |
| tree | 6edc6aa16a98008f6648ab36f7e1c6bbee726f44 /sys/dev | |
| parent | cbd6713146d14bb506626d8add767771f9cbfb97 (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/sound/usb/uaudio.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 7e32b706c2d7..6ed81eef02ea 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -2078,9 +2078,22 @@ uaudio_chan_play_sync_callback(struct usb_xfer *xfer, usb_error_t error) * 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; |
