Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Kodi Community Development

Moderator: TVJunkie198

djp952
Posts: 616
Joined: Wed Oct 01, 2008 8:46 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby djp952 » Tue Jul 10, 2018 8:39 pm

Glad all is ok @djp952!

WHEN, you have the chance can you look at my previous post issue with playback randomly stopping when using your Android build? Only happens with your modified APK and unfortunately breaks the ever important WAF so ive had to move onto other solutions but would love to go back if I can.

Thanks!
I will totally admit to not getting that far back into the game yet, but does this happen when you seek or are you just sitting there and the stream locks up on you? I actually have the same problem from time to time if it's seek related (even on Windows), I think it has to do with how I "fixed" the way live streams are reported so that Kodi would gracefully move from a live to a recorded stream if the program ended. I never saw the problem until I did that.

Please let me know what, if anything in your opinion, you are doing in Kodi that may be exacerbating this or outright causing it to occur. Again, I apologize for not being up to date on all the posts.

PS - I really appreciate the comments and well-wishes I saw from you when I clicked on your "posts" link. I am indeed very sorry that you nice folks here got left in the dark for so long. The project became overwhelming for certain, but that's only a small piece of why I disappeared on you. The main reason was 'real' work got in the way. I got sucked up into a very difficult work project that has consumed all my free time since January. Perhaps I should make a separate post :)

pavlov70
Posts: 24
Joined: Mon Jun 01, 2015 8:13 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby pavlov70 » Wed Jul 11, 2018 5:59 am

Leia is kinda/sorta updated. It will work but I see some issues, mainly with 'live stream' reporting. Your timeline bar at the bottom will be all dorked up. I also haven't done anything to deal with the new changes in the past 6+ months, but I did start looking into them :)

https://github.com/djp952/pvr.hdhomerun ... leia-1.2.9
Cool thanks man! Will give it a shot tonight. I have Leia up and running on a test box with Amazon and Netflix via inputstream. Only thing keeping me from rolling it out was lack of my favorite PVR software :-)

Hardax
Posts: 48
Joined: Wed Aug 09, 2017 11:01 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby Hardax » Wed Jul 11, 2018 1:01 pm

I will totally admit to not getting that far back into the game yet, but does this happen when you seek or are you just sitting there and the stream locks up on you? I actually have the same problem from time to time if it's seek related (even on Windows), I think it has to do with how I "fixed" the way live streams are reported so that Kodi would gracefully move from a live to a recorded stream if the program ended. I never saw the problem until I did that.

Please let me know what, if anything in your opinion, you are doing in Kodi that may be exacerbating this or outright causing it to occur. Again, I apologize for not being up to date on all the posts.difficult work project that has consumed all my free time since January. Perhaps I should make a separate post :)
All I am doing is watching either a live stream or even a local file and playback will just randomly stop and return to the home screen. This usually happens once or twice a viewing session and weirdly, once it happens and I resume, it doesnt happen again. If its local file playback, when I resume it actually remembers the resume point so its not a hard crash or lockup.

This only happens with your modified APK. If I set everything up using an official Kodi build it does not do this when using the built in, unofficial HDHomeRun PVR client.

I am using this on an Nvidia Shield and I have read some posts over on the Kodi forums and also the Shield forums about the same kind of behavior from others so it might not be related but in my testing, again, only with your build does this do it.

Case in point. Right now I have the latest Alpha build of SPMC v17 installed and am using NextPVR as my backend. Playback has not stopped once since I installed this setup about a month ago.

The only scenerio I havent tried yet is using your APK but not enabling your PVR client. Probably should have tried that combination before going with SPMC to determine if its your Kodi build itself or just the PVR add-on. If I have a chance I might test that out this weekend.

djp952
Posts: 616
Joined: Wed Oct 01, 2008 8:46 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby djp952 » Wed Jul 11, 2018 9:01 pm

I will totally admit to not getting that far back into the game yet, but does this happen when you seek or are you just sitting there and the stream locks up on you? I actually have the same problem from time to time if it's seek related (even on Windows), I think it has to do with how I "fixed" the way live streams are reported so that Kodi would gracefully move from a live to a recorded stream if the program ended. I never saw the problem until I did that.

Please let me know what, if anything in your opinion, you are doing in Kodi that may be exacerbating this or outright causing it to occur. Again, I apologize for not being up to date on all the posts.difficult work project that has consumed all my free time since January. Perhaps I should make a separate post :)
All I am doing is watching either a live stream or even a local file and playback will just randomly stop and return to the home screen. This usually happens once or twice a viewing session and weirdly, once it happens and I resume, it doesnt happen again. If its local file playback, when I resume it actually remembers the resume point so its not a hard crash or lockup.

This only happens with your modified APK. If I set everything up using an official Kodi build it does not do this when using the built in, unofficial HDHomeRun PVR client.

I am using this on an Nvidia Shield and I have read some posts over on the Kodi forums and also the Shield forums about the same kind of behavior from others so it might not be related but in my testing, again, only with your build does this do it.

Case in point. Right now I have the latest Alpha build of SPMC v17 installed and am using NextPVR as my backend. Playback has not stopped once since I installed this setup about a month ago.

The only scenerio I havent tried yet is using your APK but not enabling your PVR client. Probably should have tried that combination before going with SPMC to determine if its your Kodi build itself or just the PVR add-on. If I have a chance I might test that out this weekend.
Gotcha. This PVR client does a lot more work than the in-built one does, and over time the streaming implementation has been tweaked (incessantly) to handle little things that have popped up. I'm looking into redoing the streaming implementation yet again since I'm not super happy with it right now.

The main thing I can envision with it just sitting there and streaming without any interaction (seek, for example) would be a timeout. There are a couple places where this can happen, both in my code as well as the underlying "cURL" HTTP code. Would you happen to have a kodi.log file that may indicate when this occurred? Either the PVR client or Kodi should have said something in there if the stream died.

Hardax
Posts: 48
Joined: Wed Aug 09, 2017 11:01 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby Hardax » Thu Jul 12, 2018 4:41 am

Gotcha. This PVR client does a lot more work than the in-built one does, and over time the streaming implementation has been tweaked (incessantly) to handle little things that have popped up. I'm looking into redoing the streaming implementation yet again since I'm not super happy with it right now.

The main thing I can envision with it just sitting there and streaming without any interaction (seek, for example) would be a timeout. There are a couple places where this can happen, both in my code as well as the underlying "cURL" HTTP code. Would you happen to have a kodi.log file that may indicate when this occurred? Either the PVR client or Kodi should have said something in there if the stream died.
Ill try and reinstall this weekend and get you some logs. What should I turn on in Kodi itself for logging and is there PVR specific logs to turn on?

I should mention that this happens even when I don't have the HDHomeRun record engine up and running as well. Just using your APK for live streaming with the option to to direct stream (cant remember the exact wording) turned both on and off.

pavlov70
Posts: 24
Joined: Mon Jun 01, 2015 8:13 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby pavlov70 » Thu Jul 12, 2018 5:27 am

Tried the new version in Leia last night and it's working fine. Thanks for the update!!

djp952
Posts: 616
Joined: Wed Oct 01, 2008 8:46 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby djp952 » Fri Jul 13, 2018 8:54 pm

Gotcha. This PVR client does a lot more work than the in-built one does, and over time the streaming implementation has been tweaked (incessantly) to handle little things that have popped up. I'm looking into redoing the streaming implementation yet again since I'm not super happy with it right now.

The main thing I can envision with it just sitting there and streaming without any interaction (seek, for example) would be a timeout. There are a couple places where this can happen, both in my code as well as the underlying "cURL" HTTP code. Would you happen to have a kodi.log file that may indicate when this occurred? Either the PVR client or Kodi should have said something in there if the stream died.
Ill try and reinstall this weekend and get you some logs. What should I turn on in Kodi itself for logging and is there PVR specific logs to turn on?

I should mention that this happens even when I don't have the HDHomeRun record engine up and running as well. Just using your APK for live streaming with the option to to direct stream (cant remember the exact wording) turned both on and off.
Just the normal everyday Kodi log should suffice. My guess here is still that the stream is timing out and the regular Kodi log should provide enough evidence if that is the case :D It's something I intend to work on, it would probably be better overall to just wait and let Kodi buffer if a stream is inconsistent than letting it die. Sadly I'm still learning as I go too!!

djp952
Posts: 616
Joined: Wed Oct 01, 2008 8:46 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby djp952 » Fri Jul 13, 2018 8:55 pm

Tried the new version in Leia last night and it's working fine. Thanks for the update!!
Cool! I know there are deficiencies, and I apologize for that. I'm very glad that it's generally functional. I really have to dig in and figure out what they did regarding the reporting of live streams - that is so messed up at the moment!

djp952
Posts: 616
Joined: Wed Oct 01, 2008 8:46 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby djp952 » Fri Jul 13, 2018 9:11 pm

Hi gang! I wanted to let you all know that my extremely time consuming TDY (temporary duty) has completed! I can finally get back into the swing of this project. Caution that I still might have to disappear for a few days or a week for some travel to roll that project out across the country, and I'm so hopelessly far behind on this thread I may never actually catch up with you to my satisfaction :)

I really hate to ask, but for those still interested/watching, could you summarize what your current set of complaints/problems/requests are for me? I have an initial agenda (below), but I'd really like to be able to catch up with you guys and see if I can solve the things that need to be solved in time for Leia to be released.

The "Agenda":

- Redo the stream implementation (yup, again). I want to simplify this so that it works better on the lower-end equipment like Amazon Fire Sticks and slower Android devices. The current implementation is OK on high-end devices but even then all the tweaks have introduced some weirdness here and there. I was playing with this tonight and so far so good, I was able to completely eliminate the worker thread which also means I can get rid of all the synchronization nonsense, and that's where the performance was really being hit. We'll see, the last time I tried this I screwed a bunch of people up. Now I'm ARMed (pun intended) with some really low-end stuff to play with, so I hope that particular debacle won't be repeated.

- Figure out what to do about UWP (Xbox). I have a working build for that, but UWP can't install binary addons at all, it's worse than Android in this respect. I'd really really really like to avoid pulling apart the Kodi APPX and repacking it with the addon pre-installed, but to date that's the only way I've gotten it to work. It's limiting like the Android APK is, you end up getting stuck with "my" version of the APPX.

That's about it, really. Add in going through all the posts and github issues and whatnot again and doing what I can, but otherwise I'm open for business and ready to listen :)

THANK YOU for continuing to use and support this project/community while I was away. I'm very happy that it lived on in my absence!!

pavlov70
Posts: 24
Joined: Mon Jun 01, 2015 8:13 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby pavlov70 » Sat Jul 14, 2018 7:26 am

I really hate to ask, but for those still interested/watching, could you summarize what your current set of complaints/problems/requests are for me? I have an initial agenda (below), but I'd really like to be able to catch up with you guys and see if I can solve the things that need to be solved in time for Leia to be released.
I don't have anything to add. It just works for me and has been for months, so good job. I'm running Libreelec on i3 NUC's so I haven't had to deal with any Andriod issues and have plenty of cpu and mem to avoid performance issues.

Hardax
Posts: 48
Joined: Wed Aug 09, 2017 11:01 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby Hardax » Sat Jul 14, 2018 7:58 pm

Testing now with both the Kodi 17 & 18 APK. Clean installs with nothing else loaded and using all default settings.

Will report back with logs as soon/if playback randomly stops.
Last edited by Hardax on Sun Jul 15, 2018 2:40 pm, edited 1 time in total.

Hardax
Posts: 48
Joined: Wed Aug 09, 2017 11:01 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby Hardax » Sun Jul 15, 2018 8:19 am

Observation (v18):

Let a live stream play for about 45 minutes. Audio sync drifted to about 2 full seconds off until I finally killed the stream.

Update: looks like navigating around the Kodi interface while the stream played in the background causes the audio to go out of sync. I do this a lot and have never noticed it happening before so it might be a v18 issue.

Update #2: Playback consistently freezes. Kodi does not lock up so its possible to get back to the home screen. My guess is that this is the same behavior as v17 but in v18 the screen just freezes and in v17 it dumps you back to the home screen?

Log here:

https://pastebin.com/YHHed8sF
Last edited by Hardax on Sun Jul 15, 2018 3:41 pm, edited 3 times in total.

Hardax
Posts: 48
Joined: Wed Aug 09, 2017 11:01 am

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby Hardax » Sun Jul 15, 2018 9:37 am

Playback just stopped. (v17) Log here:

https://pastebin.com/jQeJ907f

djp952
Posts: 616
Joined: Wed Oct 01, 2008 8:46 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby djp952 » Mon Jul 16, 2018 8:13 pm

Playback just stopped. (v17) Log here:

https://pastebin.com/jQeJ907f
This looks so far like the stream is stalling on us here. What can happen here is that I have a timeout set on how long the PVR client will wait to get enough data to send back to Kodi. If that timeout is reached, it's handled by saying "I've got no more data to give you". Another thing that may be happening is that there could be a bug/defect with how I'm handing the case where the input buffer actually fills up (I would consider this far-fetched for a stream being played, I think it would be more akin to pausing it).

I need to go through your logs a bit more (THANK YOU for posting them!!), but I think I may not have the required level of logging/error support built in to find out exactly what's happening. I'm working on that part - the inability to diagnose people's problems easily has been bothering me :)

djp952
Posts: 616
Joined: Wed Oct 01, 2008 8:46 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Postby djp952 » Mon Jul 16, 2018 8:28 pm

Update on the 'next' release. As indicated I've been working on redoing the HTTP stream implementation based on all our lessons learned to date. While I haven't found any smoking guns for the stream stalling or getting 'poppy' or 'jittery' audio on some channels then they start, I am pleased to say that by simplifying things I have indeed improved the performance significantly (to me, anyway).

For the developer types out there, I completely over-engineered this piece. I honestly thought that it would be best to have a worker thread doing all the streaming into a ring buffer regardless of what Kodi was up to, but I can now say with certainty that I was wrong. The overhead with managing that, even though I made most of it "lock free", was not worth it :D

It's not ready for prime-time yet, but doing some quick profiling on a Windows 10 (1803) Core i7 (7th gen) box the results are very promising. With the existing (1.2.9) Krypton Windows x86 version, a 30-second 1080i channel viewing session spent 9.76% in my DLL. With the refactoring, the same 3-second viewing only spent 3.86% in the DLL. That may not sound like a lot, but it's actually pretty killer! This will mean less time wasted context switching, and I am of the belief that will make a notable impact on the slower devices.

I also re-examined how seek works, and at least on Krypton I still think it's about as good as it can be performance-wise. Kodi/ffmpeg just makes a lot of seek requests to find what it's looking for, and those take time. I played around with just going head and reading like one second of data to try and let the buffer/cache handle it, but that didn't work out at all. Ideally I could find a way to stop Kodi from needing 5-10 separate seek requests in the first place, but again that's not looking good.


Return to “Kodi Community Development”

Who is online

Users browsing this forum: No registered users and 1 guest