Permalink
Browse files

ActiveAE: increase max buffer size from 80ms to 100ms

  • Loading branch information...
FernetMenta committed Mar 3, 2014
1 parent 1920d8d commit ba63a2b5440a23b97319f898afd8fce8792088bd
Showing with 5 additions and 4 deletions.
  1. +5 −4 xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
@@ -32,6 +32,7 @@ using namespace ActiveAE;
#define MAX_CACHE_LEVEL 0.5 // total cache time of stream in seconds
#define MAX_WATER_LEVEL 0.25 // buffered time after stream stages in seconds
+#define MAX_BUFFER_TIME 0.1 // max time of a buffer in seconds
void CEngineStats::Reset(unsigned int sampleRate)
{
@@ -942,11 +943,11 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
m_sink.m_controlPort.SendOutMessage(CSinkControlProtocol::VOLUME, &m_volume, sizeof(float));
// limit buffer size in case of sink returns large buffer
- unsigned int buffertime = (m_sinkFormat.m_frames*1000) / m_sinkFormat.m_sampleRate;
- if (buffertime > 80)
+ unsigned int buffertime = m_sinkFormat.m_frames / m_sinkFormat.m_sampleRate;
+ if (buffertime > MAX_BUFFER_TIME)
{
- CLog::Log(LOGWARNING, "ActiveAE::%s - sink returned large buffer of %d ms, reducing to 80 ms", __FUNCTION__, buffertime);
- m_sinkFormat.m_frames = 80 * m_sinkFormat.m_sampleRate / 1000;
+ CLog::Log(LOGWARNING, "ActiveAE::%s - sink returned large buffer of %d ms, reducing to %d ms", __FUNCTION__, buffertime, MAX_BUFFER_TIME*1000);
+ m_sinkFormat.m_frames = MAX_BUFFER_TIME * m_sinkFormat.m_sampleRate;
}
}

0 comments on commit ba63a2b

Please sign in to comment.