Skip to content

Commit

Permalink
ActiveAE: limit buffertime to 80ms
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Dec 4, 2013
1 parent 2274be6 commit 47fcf24
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
Expand Up @@ -865,6 +865,14 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt)
initSink = true;
m_stats.Reset(m_sinkFormat.m_sampleRate);
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)
{
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;
}
}

if (m_silenceBuffers)
Expand Down

2 comments on commit 47fcf24

@FernetMenta
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t-nelson @fritsch I noticed that audiotrack sink returns a huge buffer of 6144 frames (140 ms). ActiveAE may have too less buffers for proper operation. Events are generated when a buffer flows from one stage to another.

@fritsch
Copy link

@fritsch fritsch commented on 47fcf24 Dec 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't that be reduced here: https://github.com/FernetMenta/xbmc/blob/master/xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp#L329

That sink uses a pull modell, by fetching data out of a lockless ringbuffer. I think that can be nicer incorporated with ActiveAESink cause normally there is no need to extra buffer again with our design.

Please sign in to comment.