Kodi Community Forum

Full Version: Live TV Channel switching time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Morning,

I have no idea if this is relevant to the new Video player or not (I read a long discussion about fast channel switching on Github a while back), but I find the channel switch of a TV program slow compared to set-top boxes. I've tried a few different backends, but no difference.

It's as if the video stream starts, pauses and then begins about a second later.

If there is anything that can be done to decrease channel switching time, that would be awesome!
What backends did you try? Did you try vnsi or tvheadend which have their own demuxers? Addons with their own demuxers can switch faster than the others.

Remains the problem of the relatively large audio buffers of the participating units including the buffer of the driver. Once playback has been started the buffers won't fill for a live stream. In order to get first timestamp of audio and video the streams are started, then stopped until buffers have minimum level, then started again.
This has already slightly improved on VideoPlayer branch. There is still room for improvement though. We could start the steam immediately and play with slightly reduced speed but this won't work nicely for passthrough. Our problem is always that we want to support all available platforms and modes. set-top boxes don't suffer from this.

EDIT: platforms in this context refers more to hardware then OS. Some USB audio devices have huge buffers.
EDIT2: that makes it not impossible but much harder
I was having buffering problems with current master and the DVBViewer PVR and after seeing this commit, I looked at the source code that checks if the stream is treated as a realtime one and, obviously, it isn't because SetCaching(CACHESTATE_FULL); is called.

As a workaround, I did this:

Code:
xbmc/cores/VideoPlayer/VideoPlayer.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
index d45d5bd..72bf813 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
@@ -1808,9 +1808,9 @@ void CVideoPlayer::HandlePlaySpeed()
       if ((m_VideoPlayerAudio->IsStalled() || m_VideoPlayerVideo->IsStalled()) &&
           m_syncTimer.IsTimePast())
       {
-        if (m_pInputStream->IsRealtime())
+        if (m_pInputStream->IsRealtime() || (m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER) && !g_PVRManager.IsPlayingRecording()))
         {
-          if ((m_CurrentAudio.id >= 0 && m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_INSYNC && m_VideoPlayerAudio->GetLevel() == 0) ||
+          if ((m_CurrentAudio.id >= 0 && m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_INSYNC && m_VideoPlayerAudio->GetLevel() == 0) &&
               (m_CurrentVideo.id >= 0 && m_CurrentVideo.syncState == IDVDStreamPlayer::SYNC_INSYNC && m_VideoPlayerVideo->GetLevel() == 0))
           {
             CLog::Log(LOGDEBUG, "Stream stalled, start buffering. Audio: %d - Video: %d",
@@ -1836,7 +1836,7 @@ void CVideoPlayer::HandlePlaySpeed()
         }
       }
       // care for live streams
-      else if (m_pInputStream->IsRealtime())
+      else if (m_pInputStream->IsRealtime() || (m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER) && !g_PVRManager.IsPlayingRecording()))
       {
         if (m_CurrentAudio.id >= 0)
         {

and now it works like with Jarvis (I replaced the || with && because I was getting an audio level of 0, with video level >0 that ended with a brief but annoying buffering two seconds after the playback started).

Shouldn't all PVR streams be treated as realtime?
IsRealtime() can change during a stream depending on the position of the timeshift buffer. This behaviour is not implemented yet. You could set the realtime flag here: https://github.com/xbmc/xbmc/blob/master...r.cpp#L116
I saw your commit and now the playback is perfect without my hack. Many thanks!
(2015-10-15, 10:01)zag Wrote: [ -> ]... I've tried a few different backends, ...

Where did you enable or install a PVR client backend in KODI 17?
backends have to run on your PVR server (device having DVB cards/sticks), this can either be the same device Kodi is running on or a different device. Installation of those backends is usually done outside of Kodi. Some Kodi distros like LibreElec and OSMC come with a package manager that you can manage from within Kodi, which allows you to f.e. install tvheadend backend from inside Kodi, but configuration of these backends is still done outside of Kodi. Kodi itself by default only delivers PVR client add-ons.
(2016-05-24, 09:38)da-anda Wrote: [ -> ]backends have to run on your PVR server ... Kodi itself by default only delivers PVR client add-ons.

Thank you for your clarification da-anda. I incorrectly asked where to enable or install a PVR client backend. Rather, I should have asked where to enable or install a PVR client. I have successfully been using NextPVR server with the XBMC/KODI NextPVR client for years.

I solved the lack of a PVR client in my installation of KODI 17 by installing a different build. Build 20160521 does not seem to include functionality to enable or install PVR clients, but I found that build 20160502 does include this functionality.