diff -Nru kodi-pvr-hts-4.4.17/debian/changelog kodi-pvr-hts-4.4.18/debian/changelog --- kodi-pvr-hts-4.4.17/debian/changelog 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-hts-4.4.18/debian/changelog 2013-05-31 22:59:22.000000000 +0000 @@ -1,4 +1,4 @@ -kodi-pvr-hts (4.4.17-1~xenial) xenial; urgency=low +kodi-pvr-hts (4.4.18-1~xenial) xenial; urgency=low [ kodi ] * autogenerated dummy changelog diff -Nru kodi-pvr-hts-4.4.17/pvr.hts/addon.xml.in kodi-pvr-hts-4.4.18/pvr.hts/addon.xml.in --- kodi-pvr-hts-4.4.17/pvr.hts/addon.xml.in 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-hts-4.4.18/pvr.hts/addon.xml.in 2013-05-31 22:59:22.000000000 +0000 @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff -Nru kodi-pvr-hts-4.4.17/pvr.hts/changelog.txt kodi-pvr-hts-4.4.18/pvr.hts/changelog.txt --- kodi-pvr-hts-4.4.17/pvr.hts/changelog.txt 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-hts-4.4.18/pvr.hts/changelog.txt 2013-05-31 22:59:22.000000000 +0000 @@ -1,3 +1,6 @@ +4.4.18 +- Predictive tuning: Fix unability to retune to a channel that was closed immediately before. + 4.4.17 - Fix playback when skipping an in progress recording to real-time. diff -Nru kodi-pvr-hts-4.4.17/src/Tvheadend.cpp kodi-pvr-hts-4.4.18/src/Tvheadend.cpp --- kodi-pvr-hts-4.4.17/src/Tvheadend.cpp 2013-05-31 22:59:22.000000000 +0000 +++ kodi-pvr-hts-4.4.18/src/Tvheadend.cpp 2013-05-31 22:59:22.000000000 +0000 @@ -2870,24 +2870,29 @@ * we reuse that subscription */ for (auto *dmx : m_dmx) { - if (dmx != m_dmx_active && dmx->GetChannelId() == chn.iUniqueId) + if (dmx->GetChannelId() == chn.iUniqueId) { Logger::Log(LogLevel::LEVEL_TRACE, "retuning channel %u on subscription %u", m_channels[chn.iUniqueId].GetNum(), dmx->GetSubscriptionId()); - /* Lower the priority on the current subscrption */ - m_dmx_active->Weight(SUBSCRIPTION_WEIGHT_POSTTUNING); - prevId = m_dmx_active->GetChannelId(); - - /* Promote the lingering subscription to the active one */ - dmx->Weight(SUBSCRIPTION_WEIGHT_NORMAL); - m_dmx_active = dmx; + if (dmx != m_dmx_active) + { + /* Lower the priority on the current subscrption */ + m_dmx_active->Weight(SUBSCRIPTION_WEIGHT_POSTTUNING); + prevId = m_dmx_active->GetChannelId(); + + /* Promote the lingering subscription to the active one */ + dmx->Weight(SUBSCRIPTION_WEIGHT_NORMAL); + m_dmx_active = dmx; + + PredictiveTune(prevId, chn.iUniqueId); + m_streamchange = true; + } - PredictiveTune(prevId, chn.iUniqueId); - m_streamchange = true; m_playingLiveStream = true; return true; } + if (dmx->GetLastUse() < oldest->GetLastUse()) oldest = dmx; } @@ -2950,7 +2955,9 @@ void CTvheadend::DemuxAbort ( void ) { - m_dmx_active->Abort(); + // If predictive tuning is active, demuxers will be closed/aborted automatically once they are expired. + if (m_dmx.size() == 1) + m_dmx_active->Abort(); } bool CTvheadend::DemuxSeek ( double time, bool backward, double *startpts )