danikula / danikula/AndroidVideoCache

Seek issue,use too much time.

Open
#215 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

```
private boolean isUseCache(GetRequest request) throws ProxyCacheException {
long sourceLength = source.length();
boolean sourceLengthKnown = sourceLength > 0;
long cacheAvailable = cache.available();
// do not use cache for partial requests which too far from available cache. It seems user seek video.
// return !sourceLengthKnown || !request.partial || request.rangeOffset <= cacheAvailable + sourceLength * NO_CACHE_BARRIER;
return !sourceLengthKnown || !request.partial || request.rangeOffset <= cacheAvailable;// + sourceLength * NO_CACHE_BARRIER;
}
```

HTTP MP4 file, if the duration too long, "sourceLength * NO_CACHE_BARRIER" well be a **BIG number**, fetch cache from network will coast too much time, seek blocked.
Remove the added number, seek works normally.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.