[Flac-dev] Synchronizing a streaming client to the server Was: Idea to possibly improve flac?

David Richards rawdod at gmail.com
Fri Jan 7 15:04:48 PST 2011


On Fri, Jan 7, 2011 at 5:58 PM, Tor-Einar Jarnbjo
<tor-einar at jarnbjo.name> wrote:
> Am 07.01.2011 23:38, schrieb David Richards:
>>
>> I'm also interested in another concept of lossless streaming with
>> flac. Lets call it broadcast flac. A problem with streaming for long
>> periods of time is that the sending and receiving computers clocks go
>> out of sync, for example even if I stream myself on localhost, with
>
> This is not a FLAC specific problem, but has to be handled in all situations
> where the streaming server is in control of the transmitting data rate. It's
> caused by a playback device, which actual sample rate is slightly higher
> than the sample rate actually requested or a streaming source, which system
> clock is running slowly. Since these parameters (at least an exact playback
> sample rate) is hard to achieve, this is a rather common problem. Or to
> shorten it: If the data has a sample rate of 44100 and your sound card
> consumes more than 44100 samples per "sender-time" second, your buffer will
> eventually exhaust. If it's the other way around, your buffer may overflow
> if the client does not handle these cases properly.
>

I am well aware its not flac specific, but such a standard way of
handling such a matter could be part of the packaging for streaming
flac.

>> Anyway what could happen is the client could do a little bit of
>> re-sampling here or there to ensure its in sync with the servers
>> clock.
>
> That is how streaming clients usually solve this problem, although is not
> really improving sound quality.

Its probably not a big deal if you don't resample all the time, just
when your off by X amount, all of this would just be client side
preferences. As long as the client side "knows" its off by X amount
you could handle it in any number of ways, I'd be fine if its just
crossfaded to the correct timing if was off by more than half a
second, then no resampling would ever happen, you would just get a
weird effect about once an hour, better than a buffer underrun or lag,
or perhaps the client could look for a half second of silence and just
cut it out.

-David

>
> Tor
>
>
>


More information about the Flac-dev mailing list