Unofficial Kodi HDHomeRun DVR PVR Client

Kodi Community Development

Moderator: TVJunkie198

Post Reply
timecutter
Posts: 21
Joined: Mon Aug 20, 2018 5:12 am

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by timecutter » Wed Dec 18, 2019 4:32 pm

Music channels - stingray - US.

This used to work however it appears either the work that was done for audio only streams or something that I have done locally has caused our cable music channels to no longer work in the app.

They work using hdhomerun apps, vlc and even directly tuning to the channel using strm files. They work in vlc through the record engine: http://ip:port/auto/v941


2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers(pvr://channels/tv/All channels/pvr.hdhomerundvr_3690496.pvr)
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: system rules
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: system rules
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mms/udp
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtmp
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtsp
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: streams
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvd
2019-12-18 17:23:52.096 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvdimage
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: sdp/asf
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: nsv
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: radio
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers: matched 0 rules with players
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers: adding videodefaultplayer (VideoPlayer)
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=0
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=1
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers: adding audiodefaultplayer (PAPlayer)
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers: for video=0, audio=1
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=1
2019-12-18 17:23:52.097 T:4089790480 DEBUG: CPlayerCoreFactory::GetPlayers: added 2 players
2019-12-18 17:23:52.102 T:4089790480 DEBUG: Radio UECP (RDS) Processor - new CDVDRadioRDSData
2019-12-18 17:23:52.102 T:4089790480 NOTICE: VideoPlayer::OpenFile: pvr://channels/tv/All channels/pvr.hdhomerundvr_3690496.pvr
2019-12-18 17:23:52.102 T:4089790480 DEBUG: OnPlayBackStarted: CApplication::OnPlayBackStarted
2019-12-18 17:23:52.102 T:3462710080 DEBUG: Thread VideoPlayer start, auto delete: false
2019-12-18 17:23:52.103 T:3462710080 NOTICE: Creating InputStream
2019-12-18 17:23:52.104 T:3462710080 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: CloseLiveStream: triggering recording update
2019-12-18 17:23:52.105 T:3462710080 ERROR: OpenLiveStream: Add-on 'zuki.pvr.hdhomerundvr:api.hdhomerun.com' returned an error: server error
2019-12-18 17:23:52.105 T:3462710080 ERROR: CVideoPlayer::OpenInputStream - error opening [pvr://channels/tv/All channels/pvr.hdhomerundvr_3690496.pvr]
2019-12-18 17:23:52.105 T:3462710080 NOTICE: CVideoPlayer::OnExit()
2019-12-18 17:23:52.105 T:3462710080 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: CloseLiveStream: triggering recording update


Any suggestions?

thanks!

djp952
Posts: 1058
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 » Wed Dec 18, 2019 5:07 pm

I'll have to look again but looks like an HTTP error was returned and the stream never opened. Can I see the entire Kodi log (to see what URL it was trying to access)

djp952
Posts: 1058
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 » Wed Dec 18, 2019 9:56 pm

djp952 wrote:
Mon Dec 16, 2019 11:21 am
jaytaylor@gmail.com wrote:
Mon Dec 16, 2019 11:10 am
Absolutely. I'll give it a try!
It might take me a day or two, but I definitely will.
Should I try both local RECORD and RECORD on the networked server?
Will you want the Kodi and the HDHomerun logs too?
Either way works - since both install types gave you the same problem I'd say whichever setup you would prefer :)

Logs aren't necessary, but I appreciate the offer. If this works any better, it will just remove the log entries anyway, it shouldn't add anything new. You'll know based on just observation if it's a step in the right direction or not. Hoping it is!

My next step is to run a program here that screws up the network randomly and see if I can get the existing one to more reliably exhibit the problem, and then can have some evidence if this might be a good way to solve that. It's so hard to make happen on demand!
A little more info on this for tonight. I added some timing information to the HTTP streaming code and things appear to have changed since last I tested all of this. cURL (the HTTP library) added some new functionality that I can take advantage of, and I think a change I made in the recent past may have been ill-conceived (v2.4.1 - "Report a fixed length (32KiB) stream chunk size to Kodi regardless of 'DVR stream read chunk size' setting value").

I'm leery of changing the streaming code since as far as I know it's been working well in general, but what I'm seeing in the current implementation (NOTE: on Windows) is that as mentioned before the buffer is barely being used at all, but there are also some unexpected variances in the time required to read a single chunk of data from the input stream. I expected to find a fairly uniform set of values but instead I found series like (15ms, 0ms, 0ms, 0ms, 20ms, 4ms, 0ms, 0ms). For low bitrate streams not a lot can be done about it, there just isn't enough data to return it that quickly, but I have been able to smooth that out for high bitrate streams to series more like (4ms, 5ms, 6ms, 5ms, 5ms, 6ms, 3ms, 5ms). I also added some simple logic to "burn down" the buffer a bit if it ever becomes full before resuming the stream.

Insofar as my possibly ill-conceived change I still believe that was OK in and of itself and wouldn't cause any problems, but when I pulled it back I found that Kodi may ask for slightly more data than the "chunk size" has been set to, and I never accounted for that. Right now, I'm rounding down the request to an even MPEG-TS packet length (188 bytes) so I can apply the packet filtering to acquire the timestamps and filter out the pesky "SCTE Program Information Message" payload that trips ffmpeg up, but past experience with Kodi has told me that giving it less data than it wants is bad. I think I can still do that with some adjustments and still give Kodi the exact byte count it's looking for.

For what it's worth, all of this has amounted to ... complete bupkis ... for playback purposes. I believe they are good changes that further refine how HTTP streaming works, but I don't see them solving this particular problem. I'm now of the mindset that there is more likely something going on with Windows specifically here, perhaps a QoS condition with 1903/1909 that needs attention. I haven't seen the condition since bouncing the RECORD engine a couple days ago so I'm still in speculation mode.

I definitely like being able to smooth out the stream read response times for Kodi, with the caveat that more work needs to be done to somehow dynamically adjust that for lower bitrate streams if possible. I also think that the default PVR buffer needs to be much larger if these changes go mainstream - let's say 4MB instead of 1MB - favoring stream writes as opposed to client reads drastically changes the dynamic.

More info as I have it. Would love to know if the test build (3.0.1~alpha1) has had any noticeable effect for you, be it positive or negative.

djp952
Posts: 1058
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 » Fri Dec 20, 2019 3:52 pm

Yet more info on jaytaylor's problem. I put a bunch of things in place to monitor the stream, capture timings for read operations, etc. I caught the event, but ... there was nothing wrong! I have a "stream stalled" accompanied by around 5 seconds of things righting themselves, but during that timeframe the stream operations never stopped running and never took more than 100ms to complete (and typically well under 25ms). There were no buffer issues, there were no instances of the stream being paused, etc. What the heck?

So while I have what appears to be a nice set of minor streaming performance enhancements, they still seem to be completely pointless. The RECORD engine is giving me the data, the PVR is getting the data, and it's sending it all to Kodi.

I'm really starting to think this is a Windows exclusive problem, unless anyone else has seen it on other platforms. My wife has a LibreELEC Kodi (x86_64) running pretty much all day and there are no instances on that device, nor do I see anything on Android (aarch64), which is used a few hours every night. The symptom is a sudden buffering event for no apparent reason, then after a small amount of time Kodi will freak out and catch up.

I'm going to switch gears again on this and start looking at Kodi itself. I'll start by installing a previous Leia version and see if the event still occurs. If it does, and no instances are reported on non-Windows platforms we might be looking at a driver thing? No idea.

Rickt1962
Posts: 147
Joined: Tue Dec 01, 2015 2:17 pm

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by Rickt1962 » Sat Dec 21, 2019 6:33 am

You say My wife has a LibreELEC Kodi (x86_64) does the channel guide give you info ?

djp952
Posts: 1058
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 » Sat Dec 21, 2019 7:14 am

Rickt1962 wrote:
Sat Dec 21, 2019 6:33 am
You say My wife has a LibreELEC Kodi (x86_64) does the channel guide give you info ?
Yes.

As of version 3.0.0, the EPG data isn't available for users that don't have the DVR subscription. If you have the DVR subscription and you're not seeing any EPG please let me know. The previous API for retrieving the guide data is no longer accessible to this PVR addon, SD provided a new API but it requires the subscription to access it.

Rickt1962
Posts: 147
Joined: Tue Dec 01, 2015 2:17 pm

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by Rickt1962 » Sat Dec 21, 2019 8:00 am

djp952 wrote:
Sat Dec 21, 2019 7:14 am
Rickt1962 wrote:
Sat Dec 21, 2019 6:33 am
You say My wife has a LibreELEC Kodi (x86_64) does the channel guide give you info ?
Yes.

As of version 3.0.0, the EPG data isn't available for users that don't have the DVR subscription. If you have the DVR subscription and you're not seeing any EPG please let me know. The previous API for retrieving the guide data is no longer accessible to this PVR addon, SD provided a new API but it requires the subscription to access it.
Well that sucks ! SD extorting money for channel guide info

djp952
Posts: 1058
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 » Sat Dec 21, 2019 3:03 pm

Rickt1962 wrote:
Sat Dec 21, 2019 8:00 am
djp952 wrote:
Sat Dec 21, 2019 7:14 am
Rickt1962 wrote:
Sat Dec 21, 2019 6:33 am
You say My wife has a LibreELEC Kodi (x86_64) does the channel guide give you info ?
Yes.

As of version 3.0.0, the EPG data isn't available for users that don't have the DVR subscription. If you have the DVR subscription and you're not seeing any EPG please let me know. The previous API for retrieving the guide data is no longer accessible to this PVR addon, SD provided a new API but it requires the subscription to access it.
Well that sucks ! SD extorting money for channel guide info
It is what it is I guess. I believe the pvr.hdhomerun addon in Kodi can still access the old API (it doesn't slam the snot out of the servers like this one did) and provides about 4 hours of EPG data.

If there is some reason that Kodi's pvr.hdhomerun doesn't work for you, I'd like to know why if you don't mind. The intention being to assist in porting over whatever feature(s) this PVR has to that one for the folks without the DVR subscription. So far the only thing that has really come up is that they could use the 4 hour EPG data (as long as it works) to change the channel names from the tuner-provided strings to the guide-provided strings.

djp952
Posts: 1058
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 » Sat Dec 21, 2019 3:19 pm

And back to my latest white whale; the stream hitching on Windows. I did finally find SOMETHING that changed recently that might be the cause for jaytaylor's issue with Recorded TV. No love here on that ^%@$^&%&@$# Hallmark Movies channel, but maybe that's different.

In the last cURL (HTTP library) update, they changed how pausing a transfer works. Before, if my buffer filled up, cURL would still keep going on it's own, keeping the data transfer alive. Now if I say the buffer is full, the transfer itself gets held up until I have space. (https://github.com/curl/curl/pull/3240).

Kodi has a large buffer of it's own, and it tries to fill it up as quickly as possible. With Recorded TV specifically, the data can be pulled extremely quickly; limited only by the network or the speed RECORD can serve it. Watching the network throughout, you can see things like a blast of 150MB/s followed by nothing, followed by another blast, followed by nothing, and so on. The "nothing" occurs when all the various buffers in play have filled up and you have to play back the stream for a bit to burn them down.

I'm thinking the new behavior in cURL may be the root cause of the Recorded TV complaint, especially since this should be a recent development. cURL was last updated in version 2.4.1 of the PVR, back on November 13th, so the timing seems reasonable.

What I'm working on now is to smooth out the stream and avoid pausing altogether. I've gotten it pretty reasonable, for me it settles down to around 18MB/s and the "nothing" period of time between bursts is much shorter. I'm tinkering with the cURL buffer size as well (so many buffers, bro!), making it larger lets it cache more HTTP data, but then it blasts it all to me at once, so I end up needing to burn THAT data down. Live TV isn't affected much since the transfer rate is slow to begin with.

So ... still tinkering. I think I have a good set of changes here, once I'm satisfied they aren't ill-conceived and break out my 1st gen Firestick to see if it still works, I'll send something out for the bleeding edgers to try. I want to be careful not to break anything that isn't broken already :)

djp952
Posts: 1058
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 » Sat Dec 21, 2019 10:03 pm

And ... sometimes the writing is on the wall. When a first gen Firestick outperforms an 8th gen Core i7 it may be time to call it quits

I honestly don't know how longer I will maintain this; I'm tired of chasing ghosts. I apologize to everyone that sent me hate mail over the loss of the EPG for non DVR subscribers, it wasn't my doing. It does hurt a bit too, I've done everything in my power to support you guys.

Tomorrow is another day, but as it stands right now I anticipate a v3.0.1 for Krypton and a v3.1.0 for Leia/Matrix and then I may be out, and switch this back to being a "me only" thing. It's been a good long run for almost 3 years but I have finally lost interest in solving every single weird problem with Kodi or HDHomeRun or whatever.

Please LMK if anyone is interested in taking this over; my only claim is the 'zuki' part of the name. You can have everything else.

See you next year, I'm on a break until then.

garyan2
Posts: 42
Joined: Sun Aug 19, 2018 9:36 am
Contact:

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by garyan2 » Sun Dec 22, 2019 12:40 am

It can get exhausting sometimes, I feel you. Take a break, let the world burn for a bit, and enjoy life that doesn't involve this project. From the little I've seen of this, you deserve it.

Just my unsolicited advice.

Ken.F
Posts: 2200
Joined: Fri Apr 05, 2013 9:20 am
Device ID: 1041A706, 1043EB32, 104BAD9E, 13168DC5, 1322A7AC
Location: West Rockhill, PA

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by Ken.F » Sun Dec 22, 2019 6:26 am

djp952 wrote:
Sat Dec 21, 2019 10:03 pm
I honestly don't know how longer I will maintain this; I'm tired of chasing ghosts. I apologize to everyone that sent me hate mail over the loss of the EPG for non DVR subscribers, it wasn't my doing. It does hurt a bit too, I've done everything in my power to support you guys.
I'm sorry you feel that way but I get it. I wish I had the skills to help. You certainly don't deserve any hate mail. I bet most of those people don't understand how much you have done for us or why the guide data had to stop. Anyone who does understand all of that and still sends you hate mail doesn't deserve an apology.

Thank you for all of the time and hard work you put into creating the PVR client for us. I probably wouldn't be using the HDHR DVR if it didn't exist.

clarkss12
Posts: 1217
Joined: Sat May 11, 2013 11:51 am
Device ID: 104CBEA5 ;1055A951
Location: Michigan, USA
Contact:

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by clarkss12 » Sun Dec 22, 2019 7:38 am

I too agree that you have done a great service creating this fantastic PVR for Kodi.............. Take a break and enjoy what you have created.
Shame on those freeloaders that wish to blame you....

starslayer74
Posts: 18
Joined: Thu Jul 06, 2017 2:50 pm
Device ID: 15300503, 1325D5CE
Location: Parkville, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by starslayer74 » Sun Dec 22, 2019 8:53 am

I was literally just coming here to wish you Happy Holidays and say thanks for all you've done with this program. I just discovered it a few months back and I've been blown away at the level of involvement and responsiveness you've had with it.

Hoping it doesn't go away but I understand if it does. I would hate to have to go back to a server system like I was using before. :(

Best Wishes for the Holidays and Happy New Year!

djp952
Posts: 1058
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD

Re: Unofficial Kodi HDHomeRun DVR PVR Client

Post by djp952 » Sun Dec 22, 2019 11:54 am

Thanks guys! And Happy Holidays to you all as well :)

You can ignore my temper tantrum, I received a very scathing e-mail from a user basically blaming me for everything short of inventing Typhoid Fever, right when I was in the middle of trying to figure this silly stream hitching thing out. It was a bit much! There is always TV Guide you know - LOL (do they still even print that?)

Slept on it, went back to 3.0.0 without any new changes, reverted cURL back to 7.66.0. The kid and I were watching discovery family all morning and it hitched like 14 times, very annoying. I've got it playing now on a couple PCs, so far zero hitches.

I appreciate you all, and apologize for letting one nasty e-mail get to me like that. If reverting cURL solves the immediate problem, I promise to go full Elsa and Let it Go­­™ for a bit!

Post Reply