Limit rate adjustments to small, inaudible jumps
commit8b4cb54595baeeb1d9b7d11a842ef7946e43a55a
authorMaarten Bosmans <mkbosmans@gmail.com>
Fri, 7 Jan 2011 00:25:55 +0000 (7 01:25 +0100)
committerMaarten Bosmans <mkbosmans@gmail.com>
Sun, 16 Jan 2011 01:14:41 +0000 (16 02:14 +0100)
treebc691c1539c036173a21e447b74d3d35e058839e
parent11dbe30bfae09235307115f413fb6172df04a895
Limit rate adjustments to small, inaudible jumps

The same logic is applied to the sample rate adjustments in module-rtp-recv,
module-loopback and module-combine:
 - Each time an adjustment is made, the new rate can differ at most 2‰ from the
   old rate.  Such a step is equal to 3.5 cents (a cent is 1/100th of a
   semitone) and as 5 cents is generally considered the smallest observable
   difference in pitch, this results in inaudible adjustments.
 - The sample rate of the stream can only differ from the rate of the
   corresponding sink by 25%.  As these adjustments are meant to account for
   very small clock drifts, any large deviation from the base rate suggests
   something is seriously wrong.
 - If the calculated rate is within 20Hz of the base rate, set it to the base
   rate.  This saves CPU because no resampling is necessary.
src/modules/module-combine.c
src/modules/module-loopback.c
src/modules/rtp/module-rtp-recv.c