From f37628b90ce2b5e6ef4e327216781a2d24f41ca7 Mon Sep 17 00:00:00 2001 From: arnova Date: Mon, 24 Nov 2014 07:29:26 +0100 Subject: changed: Don't perform wait-on-data if position is in our old cache --- xbmc/filesystem/CacheStrategy.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xbmc/filesystem/CacheStrategy.cpp b/xbmc/filesystem/CacheStrategy.cpp index 3cee421af2..f7b4f0a0e5 100644 --- a/xbmc/filesystem/CacheStrategy.cpp +++ b/xbmc/filesystem/CacheStrategy.cpp @@ -328,7 +328,17 @@ int64_t CDoubleCache::WaitForData(unsigned int iMinAvail, unsigned int iMillis) int64_t CDoubleCache::Seek(int64_t iFilePosition) { - return m_pCache->Seek(iFilePosition); + /* Check whether position is NOT in our current cache but IS in our old cache. + * This is faster/more efficient than having to possibly wait for data in the + * Seek() call below + */ + if (!m_pCache->IsCachedPosition(iFilePosition) && + m_pCacheOld && m_pCacheOld->IsCachedPosition(iFilePosition)) + { + return CACHE_RC_ERROR; // Request seek event, so caches are swapped + } + + return m_pCache->Seek(iFilePosition); // Normal seek } bool CDoubleCache::Reset(int64_t iSourcePosition, bool clearAnyway) -- cgit v1.2.3