djp952 / pvr.hdhomerundvr

Unofficial Kodi HDHomeRun DVR PVR Client
https://github.com/djp952/pvr.hdhomerundvr/wiki
Other
60 stars 9 forks source link

HDHomeRunDVR: Difficulties with audio-only streams #48

Closed gibxxi closed 5 years ago

gibxxi commented 5 years ago

Having an issue where the add-on is freezing Kodi when initiating a new stream from the tuner.

It will start on either TV or radio by playing a short amount of audio / video, which then freezes at that point. For radio, the station logo remains visible and the rotating CD in the music vis area (Aeon Madnox) will continue to spin, but there's no audio. also there is an insane amount of length of "played" time listed, like 9 hours or so, and there will also be an end time which shouldn't be present for a live stream (as if it's being treated like a regular audio track with a definite end).

Stopping the stream with the stop button causes Kodi to freeze. Discovery actions from the add-on still execute in the background upon playback stop, but nothing else is responsive.

Checking the log I see a lot of the following message being scattered throughout the log.

ERROR: PVR::CPVRTimerType::CreateFromAttributes: Unable to resolve timer type (0x1, 0xa, 795398121)

also seeing a lot of the following:

ERROR: CDVDAudio::AddPacketsRenderer - timeout adding data to renderer

It's my assumption that there is a problem with the way the add-on is caching the live stream, and potentially also not clearing the cache upon playback end. Once the crash happens for the first time, it's impossible to play anything through the add-on without the same behaviour occurring next time round. A restart / reboot does not cure the issue.

Clearing commoncache.db, simplecache.db and the video database seem to solve the issue, until the next time it happens.

I installed Zoltan's HDHomeRun PVR add-on and it works as expected with no freezing of either TV or radio stations, but as I mentioned in my other post, it has no DVR functionality.

gibxxi commented 5 years ago

...I would like to re-iterate that at this point I'm not using SiliconDust's own DVR functionality with my QNAP NAS. I'm using a 3rd-party "RECORD" service hook add-on, that records both live TV and timer recordings to a dedicated share on the NAS. Details of that addon can be found below:

https://forum.silicondust.com/forum/viewtopic.php?t=31745

gibxxi commented 5 years ago

I stand corrected. TV channels are not affected as I previously thought, just radio. Perhaps it's paused the audio stream, waiting for a video stream it's never going to receive, as the stream contains none. I don't at this point know.

The HDHomeRun device is successfully streaming to the "LiveTV" folder on the NAS, but no audio is playing through Kodi.

Also, the time panel in the music vis screen is showing 15:12:00 / 7:44 for playback time/duration, and both values are incrementing by one, each second. As soon as I press the "stop" button, Kodi will freeze.

djp952 commented 5 years ago

There have been a handful of reports of audio-only channels that don't play correctly. Unfortunately I don't have access to any of those here, would you be willing to record one with your setup and make it available for me to use? The PVR expects certain elements to be present in the HTTP stream, if they aren't there for audio-only it can definitely cause problems. I would love to be able to help diagnose/fix this for you guys, but my hands are tied. All my "audio" channels are actually video channels so they don't exhibit the behavior. Having the times wrong may or may not be indicative of the issue, Kodi tries to marry the EPG data to the player UI. But given the description it's likely that the flags I'm sending into Kodi are nonsense for the stream being played.

Oh, don't worry about the "ERROR: PVR::CPVRTimerType::CreateFromAttributes: Unable to resolve timer type (0x1, 0xa, 795398121)", that's a known issue and exists because it's not possible to create timers that fire for a specific time and channel using the HDHomeRun DVR. Since I can't implement them, Kodi (repeatedly) gives us that error in the logs. It's benign, and has been around since day one: https://github.com/djp952/pvr.hdhomerundvr/wiki/Known-Issues-and-Limitations#cpvrtimertype-errors-in-kodilog. It would be nice if Kodi would just yell at us once, but it happens every time certain timer operations take place.

Let me know about the recording -- it doesn't need to be long, 10 minutes or so would be OK. I may also ask for a copy of your PVR database file to see how these streams are coming through, if there is a special flag or anything I can use to know it's audio-only.

Thanks!

gibxxi commented 5 years ago

I'll see what I can do. It seems at the moment that the station I use most predominantly (BBC Radio 5 Live) is unplayable at least. It works on a vanilla install of Kodi, where no PVR content has been played before, and starts (& stops) correctly under that scenario. A second attempt on a subsequent run of Kodi exhibits the symptoms I've detailed above.

I'll see what I can do and send you a recording ASAP, As I said, on the other HDHomeRun add-on, this does not cause any issues, but it's not making use of the RECORD engine (AFAIK) either.

I also want to try the "Stream Direct from Tuner" option, and see if this has any bearing. I'll let you know how that pans out later today.

With regards the "CPVRTimerType" errors, read and understood. Feel free to alter the title of this issue to something more relevant to the problem then, should you wish to, as I mistakenly believed the two were possibly linked.

djp952 commented 5 years ago

FYI for anyone watching/reading this, gibxxi and I have been working on this via Issue 46: https://github.com/djp952/pvr.hdhomerundvr/issues/46

We got our issues crossed a while back, but not being able to play audio streams is one of the problems being discussed and worked over there :)

djp952 commented 5 years ago

I have filed a bug report with Kodi regarding audio-only streams. I could only replicate one specific issue, but I think there may be a more systemic concern in the code wherein it appears to always expect that MPEG-TS will have a video stream in it. I'll let the experts see if that is the case ...

https://github.com/xbmc/xbmc/issues/15563

We'll see if it gets any traction! I'm sure I will have to answer a lot of questions, but I'll do what I can.

gibxxi commented 5 years ago

Thanks for the update Mike. I've not had time to do much with Kodi this week.

Dan / Gib.

djp952 commented 5 years ago

The PR has been accepted and merged, hopefully when Kodi 18.2 comes out we can call this particular one "fixed" :)

gibxxi commented 5 years ago

Well done Mike!

:)

Dan / Gib.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Michael Brehm notifications@github.com Sent: Thursday, March 7, 2019 10:20:17 PM To: djp952/pvr.hdhomerundvr Cc: Dan Morgan; Author Subject: Re: [djp952/pvr.hdhomerundvr] HDHomeRunDVR: Difficulties with audio-only streams (#48)

The PR has been accepted and merged, hopefully when Kodi 18.2 comes out we can call this particular one "fixed" :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/djp952/pvr.hdhomerundvr/issues/48#issuecomment-470719974, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGyQ6rK9oFaywF4e8EavIhUa8S7JFglbks5vUZChgaJpZM4Z8qtN.

gibxxi commented 5 years ago

Hi Mike,

An Update / Feedback on the v2.0 version of the add-on; After the add-on auto-updated, I decided to do some more testing, aside from some issues I've been having with both the Pulse-Eight USB HDMI-CEC Adapter and a hardware fault with my Onkyo TX-NR515 Amplifier.

Hardware issues aside, it appears that version 2.0 of the HDHomeRunPVR DVR add-on is now able to play nicely with the Milkdrop 2.0 add-on also enabled. No issues with playback of either audio-only, or video TV streams.

The only caveat here (which is fairly minor) is that upon initiating a TV-Video OTA stream, Kodi (Aeon Madnox Skin) displays the "full-screen Music-Vis Window" for about 2-3 seconds, complete with CD-case and spinning CD, at the start of playback, followed by a black screen for about 1 second, then the (expected) video stream + audio. Again, not a major issue. It's certainly preferable to Kodi freezing up as was happening prior. This behaviour is consistent across Kodi Leia 18.1 and Kodi 18.2-RC1.

EDIT: The duration of the initial display of the "MusicVis" screen seems to depend on what system I'm running the add-on on, which would indicate network latency being the deciding factor. On the Desktop it's visible for about 500ms, for example.

Regards,

Dan / Gib.

djp952 commented 5 years ago

Glad the addon and Kodi are getting closer to good here!

There wasn't anything specifically new in 2.0.x in regard to streaming (at least not on purpose), but I'm very happy to hear that it didn't cause anything new to go wrong too. As you probably noted from the extensive change log, it was a big cleanup of a lot of little annoying things.

I wonder if on the TV-Video OTA stuff if Kodi/ffmpeg is thinking it's an audio program at first, then after it fully detected all the streams in the program deciding it's video after all. I've had some issues with that here, well not exactly the same, my problem comes in when the audio of a program switches formats, like from 5.1 to 2.0, the sound completely drops for a few seconds.

One thing to check to make sure it's not my fault -- after you open one of these programs and see the odd behavior, can you check the kodi.log to see what "mediatype" the PVR decided to pass to Kodi? In almost all cases this will be "video/mpeg", but one of the fixes for audio-only was to send the MIME type from the RECORD engine/tuner rather than forcing "video/mp2t". If I'm sending in a bum MIME type Kodi/ffmpeg will take my word for it as first, then likely figure out it's not right and switch things around. Just a thought:

NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: streaming channel 721 via url http://xxx.xxx.xxx.xxx:xxxxx/auto/v721?ClientID=d6edffac-5dd3-4512-962c-133f493cab71&SessionID=0xE2EC39B6 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: mediatype = video/mpeg NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: canseek = true NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: length = -1 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: realtime = true NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: starttime = 1555902202 (epoch) = Sun Apr 21 23:03:22 2019 (local)

gibxxi commented 5 years ago

2019-04-25 20:54:23.151 T:12232 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: streaming channel 601 via url http://xxx.xxx.xxx.xxx:xxxxx/auto/v601?ClientID=bedb5465-6ed2-416f-a550-10b4184e40a3&SessionID=0x56DE1A79 2019-04-25 20:54:23.604 T:12232 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: mediatype = video/mpeg 2019-04-25 20:54:23.604 T:12232 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: canseek = true 2019-04-25 20:54:23.604 T:12232 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: length = -1 2019-04-25 20:54:23.604 T:12232 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: realtime = true 2019-04-25 20:54:23.604 T:12232 NOTICE: AddOnLog: HDHomeRun DVR PVR Client: OpenLiveStream: starttime = 1556222063 (epoch) = Thu Apr 25 20:54:23 2019 (local)

Looks like TV streams are being properly detected as video my end. One thing I do know, is that audio segments of a file incur less bandwidth issues than video, generally, except for high quality formats like AC3, etc. So on my network, which is somewhat bandwidth restricted, it's highly likely the audio buffer is being filled quicker, at least initially, than the video buffer. Especially if there's background activity (Downloads / Acronis backups) also active at the time. I've seen stuttering / buffering when Acronis is doing a backup on another machine, as all traffic on my network goes through the powerline adapters.

Not a big issue for me. It is working, that's the main thing. As long as it's not a bug, I can live with the 2-3 second delay.

Dan / Gib.

djp952 commented 5 years ago

Sounds good sir. I think for now all that can be done on my end has been done, I'm going to cross my fingers and mark this issue as "closed". Please feel free to reopen and/or create a new Issue for this or anything else that crops up that you think I can work on and make a difference!

gibxxi commented 5 years ago

Hi Mike,

Will do.

Dan / Gib.