diff options
author | arnova <arnova@void.org> | 2014-11-24 07:29:26 +0100 |
---|---|---|
committer | arnova <arnova@void.org> | 2014-11-26 09:06:03 +0100 |
commit | f37628b90ce2b5e6ef4e327216781a2d24f41ca7 (patch) | |
tree | 1042b52a9409b05abf4cd2ab13746a837eb7ebfc | |
parent | bedd1500bfa4f358e47287137f7f194e43efb14c (diff) |
changed: Don't perform wait-on-data if position is in our old cache
-rw-r--r-- | xbmc/filesystem/CacheStrategy.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
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) |