Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[epg] fixed - epg load/update was interrupted when the pvr manager im…

…ports channels, leading to delays and channel ids gone missing in certain situations
  • Loading branch information...
commit bdf8842d543fae54067c4dd453bded8474e1044f 1 parent a2e3fe4
Lars Op den Kamp opdenkamp authored
6 xbmc/epg/EpgContainer.cpp
View
@@ -228,6 +228,12 @@ void CEpgContainer::Process(void)
bool bUpdateEpg(true);
bool bHasPendingUpdates(false);
+ if (!CPVRManager::Get().WaitUntilInitialised())
+ {
+ CLog::Log(LOGDEBUG, "EPG - %s - pvr manager failed to load - exiting", __FUNCTION__);
+ return;
+ }
+
while (!m_bStop && !g_application.m_bStop)
{
CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(iNow);
14 xbmc/pvr/PVRManager.cpp
View
@@ -180,6 +180,12 @@ bool CPVRManager::UpgradeOutdatedAddons(void)
return false;
}
+bool CPVRManager::WaitUntilInitialised(void)
+{
+ return m_initialisedEvent.Wait() &&
+ IsStarted();
+}
+
void CPVRManager::Cleanup(void)
{
CSingleLock lock(m_critSection);
@@ -202,6 +208,7 @@ void CPVRManager::Cleanup(void)
delete m_pendingUpdates.at(iJobPtr);
m_pendingUpdates.clear();
+ m_initialisedEvent.Reset();
SetState(ManagerStateStopped);
}
@@ -264,6 +271,8 @@ void CPVRManager::Start(bool bAsync /* = false */, bool bOpenPVRWindow /* = fals
m_database = new CPVRDatabase;
m_database->Open();
+ g_EpgContainer.Start();
+
/* create the supervisor thread to do all background activities */
StartUpdateThreads();
}
@@ -278,6 +287,7 @@ void CPVRManager::Stop(void)
SetState(ManagerStateStopping);
/* stop the EPG updater, since it might be using the pvr add-ons */
+ m_initialisedEvent.Set();
g_EpgContainer.Stop();
CLog::Log(LOGNOTICE, "PVRManager - stopping");
@@ -317,8 +327,6 @@ void CPVRManager::SetState(ManagerState state)
void CPVRManager::Process(void)
{
- g_EpgContainer.Stop();
-
/* load the pvr data from the db and clients if it's not already loaded */
while (!Load() && GetState() == ManagerStateStarting)
{
@@ -336,7 +344,7 @@ void CPVRManager::Process(void)
/* main loop */
CLog::Log(LOGDEBUG, "PVRManager - %s - entering main loop", __FUNCTION__);
- g_EpgContainer.Start();
+ m_initialisedEvent.Set();
if (m_bOpenPVRWindow)
{
7 xbmc/pvr/PVRManager.h
View
@@ -467,6 +467,12 @@ namespace PVR
*/
bool SetWakeupCommand(void);
+ /*!
+ * @brief Wait until the pvr manager is loaded
+ * @return True when loaded, false otherwise
+ */
+ bool WaitUntilInitialised(void);
+
protected:
/*!
* @brief PVR update and control thread.
@@ -575,6 +581,7 @@ namespace PVR
CStopWatch *m_parentalTimer;
bool m_bOpenPVRWindow;
std::map<std::string, std::string> m_outdatedAddons;
+ CEvent m_initialisedEvent; /*!< triggered when the pvr manager initialised */
};
class CPVRRecordingsUpdateJob : public CJob

2 comments on commit bdf8842

Dimitris Kazakos

This one is in direct conflict with the logic proposed in PR #1994 and still leads to a lot of waiting for the PVR Views to be available.
I think it's worth considering taking a look at it, works wonders in my setup :)

Lars Op den Kamp
Collaborator

as i already commented on that PR, only necessary and minor changes until frodo. this one was necessary because channel IDs weren't assigned to epg tables properly, leading to errors when scheduling recordings.

Please sign in to comment.
Something went wrong with that request. Please try again.