Skip to content

Commit 38dfda6

Browse files
committed
[Session] Add thread sleep when waiting for buffer
When you are waiting for buffer, the VP do DemuxRead callbacks in very fast way causing CPU spikes until 13% (on a fast CPU) add a thread sleep help to mitigate the problem
1 parent ff31663 commit 38dfda6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/Session.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,8 @@ bool SESSION::CSession::GetNextSample(ISampleReader*& sampleReader)
828828

829829
if (waiting)
830830
{
831+
// Prevents CPU usage spikes due to continuous Kodi VP requests
832+
std::this_thread::sleep_for(std::chrono::milliseconds(10));
831833
return true;
832834
}
833835
else if (res)

0 commit comments

Comments
 (0)