Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[osx/ios] - fix cpu maxout when playing music (it happened after the first song was finished and the second song started) #1979

Merged
merged 1 commit into from
Dec 23, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion xbmc/cores/paplayer/PAPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,18 @@ void PAPlayer::Process()
ProcessStreams(delay, buffer);

double watermark = buffer * 0.5;
if (delay < buffer && delay > watermark)
#if defined(TARGET_DARWIN)
// In CoreAudio the delay can be bigger then the buffer
// because of delay from the HAL/Hardware
// This is the case when the buffer is full (e.x. 1 sec)
// and there is a HAL-Delay. In that case we would never sleep
// but load one cpu core up to 100% (happens on osx/ios whenever
// the first stream is finished and a prebuffered second stream
// starts to play. A BIG FIXME HERE.
if ((delay < buffer || buffer == 1) && delay > watermark)
#else
if ((delay < buffer) && delay > watermark)
#endif
CThread::Sleep(MathUtils::round_int((delay - watermark) * 1000.0));

GetTimeInternal(); //update for GUI
Expand Down