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
[pvr] finally make it possible to use multiple PVR clients #7020
Conversation
does not runtime test it, but looks good. |
Looking good, wrt pragmatic approach to improve things for Isengard. Though I did not runtime test. |
It's easy to runtime test, just enable pvr.demo and start Kodi a few times, checking that both your normal PVR client and the demo client gets loaded. |
IMO shove it in, even better than it was before. |
I'd still like to hear @opdenkamp's thoughts |
I don't see this as a fix |
@MartijnKaijser why not? We have always supported multiple clients, it just hasn't ever really worked that well so we have always adviced people to not do it. |
totally agree with @Jalle19, it's a feature since the beginning but it didn't work in some cases. This will fix it and therefore it's a fix ;) |
@Jalle19 i would say let's shove it in for Beta1 so we have a wide range of testings till our final release. jenkins build this please. |
I agree, any breakage should be easily spotted. |
👍 for inclusion in beta |
any objections, if not i'll merge it in later today. |
i am traveling and would like to have a closer look at this. |
and I've been out of the loop for a couple of days because I was ill and On 29-04-15 13:41, Rainer Hochecker wrote:
|
// indicate that addons have now been initialised | ||
{ | ||
CSingleLock lock(m_critSection); | ||
m_bAddonsInitialised = true; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@FernetMenta I changed it to use an event instead and removed the superfluous boolean. Tested by injecting sleeps here and there and it seems to work just fine. |
return bReturn; | ||
} | ||
|
||
void CPVRClients::WaitForInitialisation() | ||
{ | ||
m_loadedEvent.Wait(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
it's not. On 30-04-15 12:32, freddysmith1 wrote:
|
e00ddd2
to
d593e8c
Compare
It has been broken for over two years and I don't see anyone else fixing it.
Do you have any suggestions on how this should be done properly? Either way I've updated the PR to wait a maximum of 5 seconds instead of forever. |
What's the verdict on this? |
@@ -47,6 +47,8 @@ using namespace EPG; | |||
/** sleep time in milliseconds when no auto-configured add-ons were found */ | |||
#define PVR_CLIENT_AVAHI_SLEEP_TIME_MS (250) | |||
|
|||
const int CPVRClients::CLIENT_LOAD_TIMEOUT = 5000; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
we should not wait for all clients to be connected, as explained earlier. that's why the code was structured like this. it should just return from the method when 1 add-on connected, and the updater thread for the clients should keep trying to connect to the other add-ons (if any) while they're not all connected. |
There's much work to be done to implement it the way you're suggesting: a) b) once the channel group container has started to load it will search the database and find all channels from the client that didn't start on time and delete them. This can take a lot of time. Same thing happens with the EPG data. c) even if we'd change the code so that the channel group container etc. is reloaded when a new client is connected there'd be a ton of pointless database operations in between. I don't see why we can't go with the current solution for now, the absolutely worst case scenario is that the "Loading channels from clients" dialog is shown for five seconds during startup, alternatively during shutdown if the user quits Kodi as soon as possible after launching it. edit: typo |
@FernetMenta I updated the event handling, is this how you meant? |
The main advantage of having multiple pvr clients imo is to be able to switch between backends easily. All the rest can be consolidated into 1 backend. The code originally did handle this correctly a couple of years ago, but it broke with all the refactoring. Rather than doing it like this, and removing the parts of the code that were structured to handle it properly in the process, the points you mentioned should be fixed. It's one of the main reasons for having the updater threads in pvr... |
@opdenkamp since you're pretty much the only one who is familiar with how it should work (I didn't use PVR many years ago), any chance you might look into it at some point? |
@opdenkamp while thinking about this again, I realized that the way you want it to work will make the startup code incredibly complicated. Think of this scenario:
|
{ | ||
CLog::Log(LOGINFO, "PVRManager - %s - %d of %d enabled clients connected in time, continue to start", | ||
__FUNCTION__, numConnectedClients, numEnabledClients); | ||
} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Got some fresh complaints about us never fixing this bug (http://trac.kodi.tv/ticket/14498), any chance we could just show this if I fix the outstanding comments (not the architectural ones)? |
least tried to load) all enabled addons. This fixes the ancient bug where it's unreliable to use more than one PVR client simultaneously. Closes xbmc#14498
0188f3e
to
552e0b5
Compare
Added some fixups, squashed the last [squash] commit. jenkins build this please |
Supposed to be obsolete |
Is this possible to do yet? I'm using DVBS-2 and now have IPTV also, I'm happy to write a guide if it does work.... |
Not supported, works only by luck if at all. To realize your use case, I'd route iptv through tvheadend. |
Just enable more than one PVR client |
... which does not work reliably as we know. No? |
I thought it was fixed now that the manager is started asynchronously? |
@FernetMenta ^^^ ? |
I've grown tired of telling users that it's not possible to use more than one addon at a time due to a bug, so this is my attempt at fixing it. We really need a solution for this for Isengard so I'd appreciate it if we can keep the bikeshedding to a minimum and focus on getting something that works done, even though the solution might not be the prettiest.
The problem:
CPVRClients
on a background thread. Meanwhile,CPVRManager
used a simple sleep loop while waiting for at least one addon to load before continuing. If the second (or third) addon didn't load during the same 50 millisecond sleep duration, the startup would continue with just one addon.The solution:
CPVRClients
to indicate whether all clients have been loaded or not. FromCPVRManager
we call a method which blocks until this boolean's condition variable is signaled.Ping @opdenkamp @ksooo @xhaggi @FernetMenta
I'm not convinced this is the ultimate solution, but at least it works and it doesn't introduce arbitrary sleep durations.