New auto-synchronization feature
There has been a report about the local and remote streams getting
out of sync by over 5 seconds after a 3 hour call. This commit
now introduces a new auto-synchronization feature, that works like
this: Whenever a constant delay is detected between the two
streams, the shorter buffer is padded with silence. Constant
delay means that over a period of roughly 3 seconds, the delay
must have a small standard deviation.
Note that not every delay between the streams must be corrected.
Under some loads (a busy X server, for example) the two streams
can get out of sync by several seconds, however, this is probably
only due to Skype not sending both streams equally fast during
that load. When the load disappears again, the stream that was
behind gets data faster and gets into sync again automatically.
This is why a constant delay over a fairly long period of time is
required for the auto-sync feature to trigger.
Another source of desynchronization is that the two streams cannot
be requested from Skype simultaneously. Until the second stream
is set up, the first one might already have incoming data.
Pure CPU load, pure I/O load, as well as dropped packets do not
seem to introduce desynchronization.
There might be other causes for desynchronization to happen, but
those are unknown as of now.
Alternatively to inserting silence one could also stretch the
shorter buffer by repeating blocks of samples in it. I tried this
and it turned out to introduce unpleasant artifacts.