Comment 39 for bug 450684

Revision history for this message
In , Matthew Gregan (kinetik) wrote :

The fill level is the prebuf field of a pa_buffer_attr struct. The PulseAudio ALSA plugin sets prebuf to buffer_size - period_size. Querying ALSA for the buffer, period, and start threshold sizes at the end of sa_stream_open reveals the following for a stereo 16-bit 48kHz stream:

Period: 6000 (125ms) Buffer: 24000 (500ms) Threshold: 24000 (500ms)

Which would result in prebuf being set to 18000 frames, or 375ms. That's with the existing code. Our current OGGPLAY_AUDIO_OFFSET of 250ms means we usually won't have more than 250ms of audio available ahead of the current video frame. Changing snd_pcm_set_set_params to request 200ms latency reduces the above values to:

Period: 2400 (50ms) Buffer: 9600 (200ms) Threshold: 9600 (200ms)

Which results in a prebuf setting of 7200 frames, or 150ms.