Permalink
Browse files

Merge pull request #2382 from fritsch/ae-clip-buffer

AE: Fix menu sounds decreasing buffer(max 200 ms) and periodSize(50 ms)
  • Loading branch information...
2 parents f4c93fb + eb4ae32 commit 845f8b1d78dd8fc813c5ba452f358c8f3cf44ba9 @davilla davilla committed Mar 10, 2013
Showing with 10 additions and 9 deletions.
  1. +10 −9 xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
@@ -336,18 +336,19 @@ bool CAESinkALSA::InitializeHW(AEAudioFormat &format)
snd_pcm_hw_params_get_period_size_max(hw_params, &periodSize, NULL);
/*
- We want to make sure, that we have approx 500 to 800 ms Buffer with
- a periodSize of approx 100 ms.
- It is calced:
- periodSize = sampleRate / 10
- buffersize = periodSize * 1 frame * 8.
+ We want to make sure, that we have max 200 ms Buffer with
+ a periodSize of approx 50 ms. Choosing a higher bufferSize
+ will cause problems with menu sounds. Buffer will be increased
+ after those are fixed.
+ periodSize = sampleRate / 20
+ bufferSize = periodSize * 1 frame * 4.
*/
- periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 10);
- bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) periodSize * 8);
+ periodSize = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 20);
+ bufferSize = std::min(bufferSize, (snd_pcm_uframes_t) periodSize * 4);
/*
- According to upstream we should set buffer size first - so make sure it is always at least
- double of period size to not get underruns
+ According to upstream we should set buffer size first - so make sure it is always at least
+ double of period size to not get underruns
*/
periodSize = std::min(periodSize, bufferSize / 2);

0 comments on commit 845f8b1

Please sign in to comment.