question how buffering works

Added by Lukas Pirl 3 months ago

Dear Audacious folks, :)

first, thanks a lot for this awesome piece of FLOSS – I am a satisfies user of Audacious since years.

I have a question how the buffering is implemented.
I did have a quick look into the source but couldn't answer the question myself.
Also, reverse engineering through observing Audacious behavior was not enlightening.

From other software, I observed two strategies for buffering:

a.1) completely fill the buffer
a.2) playback until it is "almost empty"
a.3) fill it up again
a.4) goto a.2

…with the foreseeable downside (if filling is supposed to happen when there is little bandwidth available, the buffer might underrun).

b.1) fill the buffer until it is "full enough"
b.2) start playback & always try to keep the buffer as full as possible

…with the foreseeable upsides (much better tolerance for varying bandwidth).

E.g. search for −cache in the MPlayer manual

Which strategy does Audacious implement?

Background:
Suppose we playback files from a (GVFS) mounted share.
The connection is shared with other devices/users, has a high-latency and offers just sufficiently bandwidth for playing back the files.
As a result, the bandwidth is – for short bursts – insufficient for the playback.

In such a scenario, I observe occasional buffer underruns.


Replies (4)

RE: question how buffering works - Added by John Lindgren 3 months ago

Try using a larger buffer. File -> Settings -> Network -> Buffer size

RE: question how buffering works - Added by Lukas Pirl about 1 month ago

Hi John and thanks for your reply.

Increasing the network buffer size won't help, since the files are GVFS-mounted and look like local (/run/user/1000/gvfs/…).

Increasing the audio buffer does not help either (but introduces a corresponding lack when changing the volume etc.).

I love Audacious but the absence of a properly configurable buffer is a show-stopper when using slow connections and I have to fall back to mplayer, for which I can configure a huge cache and mplayer will try to keep it as full as possible.

RE: question how buffering works - Added by John Lindgren about 1 month ago

Sorry, you're right, the network buffer size applies only to HTTP connections. If you've tried setting the audio buffer to the max (10 seconds) and it still didn't help, you're out of luck. With latency that high, you should be thinking about fixing/upgrading the network rather than looking for a software solution. Or maybe keep the files you want to play cached on a local disk and sync them to/from the network share in the background?

RE: question how buffering works - Added by Lukas Pirl about 1 month ago

Well, since it works flawlessly with mplayer, I'd assume that the caching/buffering strategy could be improved.
However, I cannot judge in any way if that would be an complicated task code-wise.

(1-4/4)