xbmc/xbmc — pull request #1994 by nemphys (2012-12-27 15:15:31+00:00)
Title: [pvr] make all livetv views available to the user earlier (as soon as channels are fetched from the backend and before epg is loaded from the db) by changing the pvr/epg manager startup logic

This is quite a big one, but tested to greatly reduce the time needed for the LiveTV views to be available to the user upon startup.

Right now, the logic is a little weird, as PVR manager thread is supposed to first load channel groups, etc, and then ask the EpgContainer to start before it enters its main loop.

The thing is that as soon as all channels are loaded from the db and updated, CreateChannelEpgs is executed (this is done after every internal channel group is loaded), which in turn calls LoadFromDB for the EPG data before it does its work.
Therefore, EPG data is loaded from the database before the epg thread is even asked to start, which causes a huge delay (especially on installations with many channels and slow hardware) before PVR is actually usable (in my secondary RPi setup, this takes more than 5 minutes(!)).

I changed the logic, so that PVR manager loads/updates the channels, but CreateChannelEpgs is only called as a trigger/callback when the main loop has started and therefore EPG data has been loaded from the database. The EPG loading itself has been changed to lock only when needed and not during the whole process.

This means that upon startup, all LiveTV views (and channel viewing, etc) are available as soon as the channels are loaded, even before epg is loaded from the database.
As a side-effect, it also cures the "ugly" overdrawing of the channel and epg loading popups.

In my opinion, it is crucial not to have the user wait for minutes before he/she can start watching TV.