kodi-pvr / pvr.hts

Kodi's Tvheadend HTSP client addon
GNU General Public License v2.0
136 stars 93 forks source link

Choppy playback: asked for new data packet, with nothing available #107

Closed joshuisman closed 8 years ago

joshuisman commented 9 years ago

Choppy playback on certain "Stingray Music" channels. Streams are MPEG-2 Video. When starting such a channel playback starts choppy, Kodi shows "Buffering..." After a while playback is fine. No weird messages in TVH. Kodi logs does show "WARNING: CDVDMessageQueue(audio)::Get - asked for new data packet, with nothing available" when the playback is interrupted. Please take a look at the kodi.log pastebin url I added.

Playback of H.264 channels is just fine. TVH shows 0 BER, 0 uncorrectable blocks, 0 transport errors, 0 continuity errors. SNR and signal strength @ 100%

Example: I start a radio station on my Kodi mediacenter in the living room. Playback is ok, no stuttering. I go to the mediacenter upstairs with Kodi and start the same radio channel - to be clear the mediacenter in the living room is still playing said channel - and Kodi upstairs plays with stuttering.

But also if there's only one mediacenter playing the stuttering occurs.

Add-on V 2.1.18 Kodi 15.2-RC3 Mac OS, OSMC, Kodibuntu http://pastebin.com/eTh2bXr3

Jalle19 commented 9 years ago

Radio channels have been problematic with all PVR addons for a while, it has something to do with the way Kodi buffers the data. I'm afraid there's not much we can do about it in the addon.

joshuisman commented 9 years ago

That's such a shame, is there any other way to fix this? Can we bring it to someones attention?

FernetMenta commented 9 years ago

already adressed in new videoplayer.

Jalle19 commented 9 years ago

@FernetMenta I was hoping you'd say that :-)

FernetMenta commented 9 years ago

I hope I was not too fast. @joshuisman can you provide a debug log?

joshuisman commented 9 years ago

http://pastebin.com/3ZS1EQGu

Problem was there a few times with the 2nd radio channel; "Love Songs"

FernetMenta commented 9 years ago

Why does this radio channel have a video stream?


21:35:26 T:123145314263040   ERROR: ffmpeg[700000B66000]: [mpeg2video] Invalid frame dimensions 0x0.
21:35:26 T:123145314263040   ERROR: Decode - avcodec_decode_video returned failure

@Jalle19 looks like a tvheadend issue. It opens an invalid video stream.

joshuisman commented 9 years ago

Since Ziggo was acquired by UPC they started showing video with these "stingray music" channels. It is a static image with the album art and song info.

Jalle19 commented 9 years ago

@joshuisman any chance you could make a mux dump in tvheadend and upload it somewhere? I want to be sure whether this is something we're handling incorrectly in the addon or if it's a tvheadend issue.

Jalle19 commented 9 years ago

@ksooo a semi-ugly workaround could be to ignore any video streams for channels marked as radio. I'm not sure if we have that information available in the demuxer though.

joshuisman commented 9 years ago

@Jalle19 Sure, here it is: http://we.tl/2B0Pj1z0uB

Shoot, wrong button; re-opened

Jalle19 commented 9 years ago

@joshuisman the file doesn't seem to work (doesn't play in VLC), did you use "Save link as" from the mux link in tvheadend or did you do something else?

joshuisman commented 9 years ago

I used https://tvheadend.org/projects/tvheadend/wiki/Muxdump

Is it maybe because the stream is encrypted?

Jalle19 commented 9 years ago

Yeah that's definitely it. Can you grab the dump using the channel URL instead so it gets decrypted?

joshuisman commented 9 years ago

http://we.tl/9dshuGs6SG

Jalle19 commented 9 years ago

Thanks, that one works.

FernetMenta commented 9 years ago

And it works without any issues on VideoPlayer branch. Does it show issues on mainline?

Jalle19 commented 9 years ago

Not sure (just tested in VLC), @joshuisman?

joshuisman commented 9 years ago

Just tested the file in Kodi RC2, and indeed no issues.

That's the tricky thing about it, sometimes such channels play fine from the very beginning, sometimes not. It is even possible that I start playback and it is fine, I go to the next channel and that one's also playing fine, going back to the previous channel... choppy.

Let me try to make some bigger samples, I'll double it in size, and let's hope there's one that will show the issue.

joshuisman commented 9 years ago

Just made multiple dumps from different channels. The dumps play fine on both Kodi RC2 and VLC. So it seems the problem doesn't occur when the pvr part of Kodi isn't involved?

I also just tried live playback with url of a radio station in VLC, flawless and I kept it in the background playing. Next I opened Kodi and started playing the same channel; flawless. Stopped playback on Kodi, restarted the same channel; choppy and showing buffering...

Jalle19 commented 9 years ago

@joshuisman the code paths are different when playing a standard file than when playing a PVR channel, that's why it may seem to work when you play a dump file. I don't think there's much we can do about this until @FernetMenta finishes his video player rewrite.

By the way does Kodi display the channel's static image when you play this radio channel or does it show the visualization?

joshuisman commented 9 years ago

It shows the static image, the video stream. No visualization.

Jalle19 commented 9 years ago

Okay, then the issue is probably the same as other PVR radio related issues. This has been reported earlier at http://forum.kodi.tv/showthread.php?tid=222764 and since it seems to work in the new video player rewrite I'm closing this as a bug in Kodi.

FernetMenta commented 9 years ago

There is more than a single issue and the tvheadend related one should be fixed now. The demuxer must not expose streams with invalid dimensions: https://github.com/xbmc/xbmc/blob/master/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.cpp#L312

Jalle19 commented 9 years ago

@FernetMenta https://github.com/kodi-pvr/pvr.hts/blob/master/src/HTSPDemuxer.cpp#L530 that scenario shouldn't be possible anymore. Are you sure it's not ffmpeg being fooled by the still frame?

joshuisman commented 9 years ago

Well I was just trying some other radio channels and it seems the affected channels all seem to have one thing in common, encrypted content. Though some channels seem to be more affected than others.

For example RNE Radio is very choppy, both in Kodi and VLC. So I made a dump of that channel. Guess what, perfect playback in VLC. And RNE Radio is an audio stream only, no video.

Jalle19 commented 9 years ago

During my limited testing earlier I think the culprit is channels with very low bitrate. Radio channels that have ~100 kbps or more in bitrate seem to work without buffering.

FernetMenta commented 9 years ago

Are you sure it's not ffmpeg being fooled by the still frame?

@Jalle19 yes I am. I played the sample through vnsi parsers and don't get the decoding error. I am not saying that this is the root cause of this issue but it is an issue that needs to be fixed as well.

joshuisman commented 9 years ago

The dump file of 60 seconds from RNE Radio is indeed a very small file, 1.3 MB. So that's a low bitrate.

L-S-D commented 9 years ago

does pressing pause and starting again work for you?

joshuisman commented 9 years ago

@L-S-D I tried a few times and it seems that "solves" the problem. I'm not sure though, as the playback often picks up the right playback by itself.

Jalle19 commented 9 years ago

Not sure what to do with this one, I'm tempted to close it since radio stuttering has been widely reported as a Kodi issue.

Jalle19 commented 8 years ago

Yeah, definitely closing this, it's been lingering here for too long.