Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
704993ce
authored
Apr 20, 2020
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #7210 from nebyan:CacheKeyFactoryNotUsed
PiperOrigin-RevId: 307045655
parents
7350981e
a944b5cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
26 deletions
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceTest.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheUtilTest.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheUtil.java
View file @
704993ce
...
...
@@ -109,7 +109,6 @@ public final class CacheUtil {
*
* @param dataSpec Defines the data to be cached.
* @param cache A {@link Cache} to store the data.
* @param cacheKeyFactory An optional factory for cache keys.
* @param upstream A {@link DataSource} for reading data not in the cache.
* @param progressListener A listener to receive progress updates, or {@code null}.
* @param isCanceled An optional flag that will interrupt caching if set to true.
...
...
@@ -120,7 +119,6 @@ public final class CacheUtil {
public
static
void
cache
(
DataSpec
dataSpec
,
Cache
cache
,
@Nullable
CacheKeyFactory
cacheKeyFactory
,
DataSource
upstream
,
@Nullable
ProgressListener
progressListener
,
@Nullable
AtomicBoolean
isCanceled
)
...
...
@@ -128,7 +126,7 @@ public final class CacheUtil {
cache
(
dataSpec
,
cache
,
cacheKeyFactory
,
/* cacheKeyFactory= */
null
,
new
CacheDataSource
(
cache
,
upstream
),
new
byte
[
DEFAULT_BUFFER_SIZE_BYTES
],
/* priorityTaskManager= */
null
,
...
...
@@ -139,14 +137,14 @@ public final class CacheUtil {
}
/**
* Caches the data defined by {@code dataSpec}
while skipping already cached data. Caching stops
*
early
if end of input is reached and {@code enableEOFException} is false.
* Caches the data defined by {@code dataSpec}
, skipping already cached data. Caching stops early
* if end of input is reached and {@code enableEOFException} is false.
*
* <p>If a {@link PriorityTaskManager} is
given, it's used to pause and resume caching depend
ing
*
on {@code priority} and the priority of other tasks registered to the PriorityTaskManager.
* P
lease note that it's the responsibility of the calling code to call {@link
*
PriorityTaskManager#add} to register with the manager before calling this method, and to call
* {@link PriorityTaskManager#remove} afterwards to unregister.
* <p>If a {@link PriorityTaskManager} is
provided, it's used to pause and resume cach
ing
*
depending on {@code priority} and the priority of other tasks registered to the
* P
riorityTaskManager. Please note that it's the responsibility of the calling code to call
*
{@link PriorityTaskManager#add} to register with the manager before calling this method, and to
*
call
{@link PriorityTaskManager#remove} afterwards to unregister.
*
* <p>This method may be slow and shouldn't normally be called on the main thread.
*
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceTest.java
View file @
704993ce
...
...
@@ -360,7 +360,6 @@ public final class CacheDataSourceTest {
CacheUtil
.
cache
(
unboundedDataSpec
,
cache
,
/* cacheKeyFactory= */
null
,
upstream2
,
/* progressListener= */
null
,
/* isCanceled= */
null
);
...
...
@@ -409,7 +408,6 @@ public final class CacheDataSourceTest {
CacheUtil
.
cache
(
unboundedDataSpec
,
cache
,
/* cacheKeyFactory= */
null
,
upstream2
,
/* progressListener= */
null
,
/* isCanceled= */
null
);
...
...
@@ -433,7 +431,6 @@ public final class CacheDataSourceTest {
CacheUtil
.
cache
(
dataSpec
,
cache
,
/* cacheKeyFactory= */
null
,
upstream
,
/* progressListener= */
null
,
/* isCanceled= */
null
);
...
...
@@ -469,7 +466,6 @@ public final class CacheDataSourceTest {
CacheUtil
.
cache
(
dataSpec
,
cache
,
/* cacheKeyFactory= */
null
,
upstream
,
/* progressListener= */
null
,
/* isCanceled= */
null
);
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CacheUtilTest.java
View file @
704993ce
...
...
@@ -203,7 +203,6 @@ public final class CacheUtilTest {
CacheUtil
.
cache
(
new
DataSpec
(
Uri
.
parse
(
"test_data"
)),
cache
,
/* cacheKeyFactory= */
null
,
dataSource
,
counters
,
/* isCanceled= */
null
);
...
...
@@ -220,8 +219,7 @@ public final class CacheUtilTest {
Uri
testUri
=
Uri
.
parse
(
"test_data"
);
DataSpec
dataSpec
=
new
DataSpec
(
testUri
,
/* position= */
10
,
/* length= */
20
);
CachingCounters
counters
=
new
CachingCounters
();
CacheUtil
.
cache
(
dataSpec
,
cache
,
/* cacheKeyFactory= */
null
,
dataSource
,
counters
,
/* isCanceled= */
null
);
CacheUtil
.
cache
(
dataSpec
,
cache
,
dataSource
,
counters
,
/* isCanceled= */
null
);
counters
.
assertValues
(
0
,
20
,
20
);
counters
.
reset
();
...
...
@@ -229,7 +227,6 @@ public final class CacheUtilTest {
CacheUtil
.
cache
(
new
DataSpec
(
testUri
),
cache
,
/* cacheKeyFactory= */
null
,
dataSource
,
counters
,
/* isCanceled= */
null
);
...
...
@@ -247,8 +244,7 @@ public final class CacheUtilTest {
DataSpec
dataSpec
=
new
DataSpec
(
Uri
.
parse
(
"test_data"
));
CachingCounters
counters
=
new
CachingCounters
();
CacheUtil
.
cache
(
dataSpec
,
cache
,
/* cacheKeyFactory= */
null
,
dataSource
,
counters
,
/* isCanceled= */
null
);
CacheUtil
.
cache
(
dataSpec
,
cache
,
dataSource
,
counters
,
/* isCanceled= */
null
);
counters
.
assertValues
(
0
,
100
,
100
);
assertCachedData
(
cache
,
fakeDataSet
);
...
...
@@ -264,8 +260,7 @@ public final class CacheUtilTest {
Uri
testUri
=
Uri
.
parse
(
"test_data"
);
DataSpec
dataSpec
=
new
DataSpec
(
testUri
,
/* position= */
10
,
/* length= */
20
);
CachingCounters
counters
=
new
CachingCounters
();
CacheUtil
.
cache
(
dataSpec
,
cache
,
/* cacheKeyFactory= */
null
,
dataSource
,
counters
,
/* isCanceled= */
null
);
CacheUtil
.
cache
(
dataSpec
,
cache
,
dataSource
,
counters
,
/* isCanceled= */
null
);
counters
.
assertValues
(
0
,
20
,
20
);
counters
.
reset
();
...
...
@@ -273,7 +268,6 @@ public final class CacheUtilTest {
CacheUtil
.
cache
(
new
DataSpec
(
testUri
),
cache
,
/* cacheKeyFactory= */
null
,
dataSource
,
counters
,
/* isCanceled= */
null
);
...
...
@@ -290,8 +284,7 @@ public final class CacheUtilTest {
Uri
testUri
=
Uri
.
parse
(
"test_data"
);
DataSpec
dataSpec
=
new
DataSpec
(
testUri
,
/* position= */
0
,
/* length= */
1000
);
CachingCounters
counters
=
new
CachingCounters
();
CacheUtil
.
cache
(
dataSpec
,
cache
,
/* cacheKeyFactory= */
null
,
dataSource
,
counters
,
/* isCanceled= */
null
);
CacheUtil
.
cache
(
dataSpec
,
cache
,
dataSource
,
counters
,
/* isCanceled= */
null
);
counters
.
assertValues
(
0
,
100
,
1000
);
assertCachedData
(
cache
,
fakeDataSet
);
...
...
@@ -340,7 +333,6 @@ public final class CacheUtilTest {
CacheUtil
.
cache
(
new
DataSpec
(
Uri
.
parse
(
"test_data"
)),
cache
,
/* cacheKeyFactory= */
null
,
dataSource
,
counters
,
/* isCanceled= */
null
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment