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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to