Skip to content

Commit

Permalink
[PVR] Guide window: Fix responsiveness on first open.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksooo committed Oct 31, 2016
1 parent 6009b32 commit b38f600
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion xbmc/pvr/windows/GUIWindowPVRGuide.cpp
Expand Up @@ -695,13 +695,37 @@ CPVRRefreshTimelineItemsThread::CPVRRefreshTimelineItemsThread(CGUIWindowPVRGuid

void CPVRRefreshTimelineItemsThread::Process()
{
static const int BOOSTED_SLEEPS_THRESHOLD = 4;

int iLastEpgItemsCount = 0;
int iUpdatesWithoutChange = 0;

while (!m_bStop)
{
if (m_pGuideWindow->RefreshTimelineItems() && !m_bStop)
{
CGUIMessage m(GUI_MSG_REFRESH_LIST, m_pGuideWindow->GetID(), 0, ObservableMessageEpg);
KODI::MESSAGING::CApplicationMessenger::GetInstance().SendGUIMessage(m);
}
Sleep(5000);

// in order to fill the guide window asap, use a short update interval until we the
// same amount of epg events for BOOSTED_SLEEPS_THRESHOLD + 1 times in a row .
if (iUpdatesWithoutChange < BOOSTED_SLEEPS_THRESHOLD)
{
int iCurrentEpgItemsCount = m_pGuideWindow->CurrentDirectory().Size();

if (iCurrentEpgItemsCount == iLastEpgItemsCount)
iUpdatesWithoutChange++;
else
iUpdatesWithoutChange = 0; // reset

iLastEpgItemsCount = iCurrentEpgItemsCount;

Sleep(1000); // boosted update cycle
}
else
{
Sleep(5000); // normal update cycle
}
}
}

0 comments on commit b38f600

Please sign in to comment.