Kodi Community Forum
WIP Faster channel switching for tvheadend/vdr addons - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136)
+---- Thread: WIP Faster channel switching for tvheadend/vdr addons (/showthread.php?tid=182355)

Pages: 1 2 3 4


RE: Faster channel switching for tvheadend/vdr addons - negge - 2014-01-12

I've been trying to figure out where we should load channel settings since the call has to be moved if we want it to work when <cacheindvdplayer> is set to false. https://github.com/Jalle19/xbmc/commit/7c2162893795e243377a64003471e85a1212dffb is obviously wrong since it is called everytime you try to switch subtitles using the "star" button. I'm currently doing it at https://github.com/xbmc/xbmc/blob/master/xbmc/cores/dvdplayer/DVDPlayer.cpp#L909 but I'm not sure loading settings on every stream change is the right way to do it. It works fine overall but I'm thinking it could have unintended consequences if e.g. a new subtitle stream suddenly appears in the stream.

What about CDVDPlayer::SwitchChannel()?

@opdenkamp any thoughts on this?


RE: Faster channel switching for tvheadend/vdr addons - negge - 2014-01-13

Opened a branch for this fix here. I realized that this only works for tvheadend/vdr so I need your help in figuring out where exactly to put the call.


RE: Faster channel switching for tvheadend/vdr addons - opdenkamp - 2014-01-13

Quote:I guess the biggest slowdown comes from the caching, another part is the unnecessary call to RequestStreams() that I removed (it was always done twice when switching channels)
there's two calls indeed, because it will call it when it receives a stream change packet. that shouldn't slow things down (noticeably)

what are you trying to fix with the channel settings changes?


RE: Faster channel switching for tvheadend/vdr addons - FernetMenta - 2014-01-13

What we currently have in load/save channelsSettings is a chain of work arounds. First OpenDefaultStreams was not able to open desired streams because those were not ready. Then we delayed load settings and opened audio/subs explicitly. Because of delayed load we observed overwrite of settings after a failed channels switch -> valid flag was introduced.

Now the original problem is solved: OpenDefaultStreams is called after a stream change. If load/save is touched, it should be aligned with load/save of video settings. The work arounds can be cleaned-up.


RE: Faster channel switching for tvheadend/vdr addons - negge - 2014-01-14

(2014-01-13, 19:13)opdenkamp Wrote: what are you trying to fix with the channel settings changes?

AFAICT, if pvr.cacheindvdplayer is set to false, CDVDPlayer::CachePVRStream() will always return false, which means the caching state will never enter the state CACHESTATE_PVR, which means that the if-block where the stored channel settings are loaded won't be reached.

@FernetMenta: thanks for the explanation. Are you saying we should attempt to load the settings where OpenDefaultStreams() is called?


RE: Faster channel switching for tvheadend/vdr addons - FernetMenta - 2014-01-14

Quote:Are you saying we should attempt to load the settings where OpenDefaultStreams() is called?

No, do you see video settings loaded in OpenDefaultStreams? I say load channel settings should be aligned with load/save video settings.


RE: Faster channel switching for tvheadend/vdr addons - negge - 2014-01-14

I need to do some more digging then, I'm not familiar with that part of the code. I still think it could be a good idea to also load them during a stream change, since there's the possibility that the user has set e.g. Finnish subtitles as default for a channel, but when he switched to it the program didn't have any subtitles. Once a non-Finnish program starts the user would likely want the subs enabled, and at the moment that won't happen.


RE: Faster channel switching for tvheadend/vdr addons - FernetMenta - 2014-01-14

There is no need to reinvent the wheel. All bits are already in place: a stream change triggers OpenDefaultStreams which opens audio and subs according the the channel settings. Once settings are loaded you can't reload them because it would overwrite changes you have made since loading. Settings are saved on stop.
Video settings are handled in application and FileStateJob. Exactly at those places in the code where video settings are handled, channels settings should be handled as well. The other bits should be cleaned out.


RE: Faster channel switching for tvheadend/vdr addons - negge - 2014-01-14

Alright, thanks for the pointers, I'll have a look. You're incorrect about "settings are saved on stop" though, PVR channel settings are saved all over the place.

I started working on unifying the channel settings some time ago so that they're stored just like all other video items, I'll see if I can find some time to clean it up and push it to Github.


RE: Faster channel switching for tvheadend/vdr addons - zag - 2015-11-25

NICE! Just found this setting and works rather well.

The video is very quick to change now, even faster than my old dbox which is great.

No problems with audio dropouts as far as my limited testing has gone.

Using TVheadend client/server on same box.


RE: Faster channel switching for tvheadend/vdr addons - bam80 - 2015-11-25

Hi zag,
what exact setting are you talking about?


RE: Faster channel switching for tvheadend/vdr addons - zag - 2015-11-25

I was frustrated at the channel changing speed in Kodi using tvheadend (especially as its on the same htpc box as the tv client) so did a google search.

This page came up as the first hit, so I added the setting to advancesettings.xml in my "userdata" folder on OpenELEC

PHP Code:
<pvr>
      <
cacheindvdplayer>false</cacheindvdplayer>
</
pvr

Unfortunately after a bit of testing, the speed of change is now VERY quick, but it seems to pause for about 0.5 seconds on the 1st video frame for the audio and video to start.

A little disappointing as it takes away from the smooth experience of browsing channels seen on some modern set top boxes.


RE: Faster channel switching for tvheadend/vdr addons - bam80 - 2015-11-26

What kind of TV source do you have in tvheadend?


RE: Faster channel switching for tvheadend/vdr addons - zag - 2015-11-26

Testing with uk freesat DVB-S2


RE: Faster channel switching for tvheadend/vdr addons - FernetMenta - 2015-11-26

(2015-11-25, 13:18)zag Wrote: I was frustrated at the channel changing speed in Kodi using tvheadend (especially as its on the same htpc box as the tv client) so did a google search.

This page came up as the first hit, so I added the setting to advancesettings.xml in my "userdata" folder on OpenELEC

PHP Code:
<pvr>
      <
cacheindvdplayer>false</cacheindvdplayer>
</
pvr

Unfortunately after a bit of testing, the speed of change is now VERY quick, but it seems to pause for about 0.5 seconds on the 1st video frame for the audio and video to start.

A little disappointing as it takes away from the smooth experience of browsing channels seen on some modern set top boxes.

Note that I dropped this on VideoPlayer branch -> 17.0