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
8480a4b4
authored
Apr 03, 2019
by
eguven
Committed by
Oliver Woodman
Apr 05, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add Downloader.getCounters method
PiperOrigin-RevId: 241636860
parent
ee7bf4b0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
0 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/Downloader.java
library/core/src/main/java/com/google/android/exoplayer2/offline/ProgressiveDownloader.java
library/core/src/main/java/com/google/android/exoplayer2/offline/SegmentDownloader.java
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
library/core/src/main/java/com/google/android/exoplayer2/offline/Downloader.java
View file @
8480a4b4
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer2
.
offline
;
package
com
.
google
.
android
.
exoplayer2
.
offline
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.upstream.cache.CacheUtil.CachingCounters
;
import
java.io.IOException
;
import
java.io.IOException
;
/**
/**
...
@@ -47,6 +48,9 @@ public interface Downloader {
...
@@ -47,6 +48,9 @@ public interface Downloader {
*/
*/
float
getDownloadPercentage
();
float
getDownloadPercentage
();
/** Returns a {@link CachingCounters} which holds download counters. */
CachingCounters
getCounters
();
/**
/**
* Removes the media.
* Removes the media.
*
*
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/ProgressiveDownloader.java
View file @
8480a4b4
...
@@ -107,6 +107,11 @@ public final class ProgressiveDownloader implements Downloader {
...
@@ -107,6 +107,11 @@ public final class ProgressiveDownloader implements Downloader {
}
}
@Override
@Override
public
CachingCounters
getCounters
()
{
return
cachingCounters
;
}
@Override
public
void
remove
()
{
public
void
remove
()
{
CacheUtil
.
remove
(
dataSpec
,
cache
,
cacheKeyFactory
);
CacheUtil
.
remove
(
dataSpec
,
cache
,
cacheKeyFactory
);
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/offline/SegmentDownloader.java
View file @
8480a4b4
...
@@ -159,6 +159,11 @@ public abstract class SegmentDownloader<M extends FilterableManifest<M>> impleme
...
@@ -159,6 +159,11 @@ public abstract class SegmentDownloader<M extends FilterableManifest<M>> impleme
}
}
@Override
@Override
public
CachingCounters
getCounters
()
{
return
counters
;
}
@Override
public
final
void
remove
()
throws
InterruptedException
{
public
final
void
remove
()
throws
InterruptedException
{
try
{
try
{
M
manifest
=
getManifest
(
offlineDataSource
,
manifestDataSpec
);
M
manifest
=
getManifest
(
offlineDataSource
,
manifestDataSpec
);
...
...
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
View file @
8480a4b4
...
@@ -28,6 +28,7 @@ import com.google.android.exoplayer2.testutil.DummyMainThread.TestRunnable;
...
@@ -28,6 +28,7 @@ import com.google.android.exoplayer2.testutil.DummyMainThread.TestRunnable;
import
com.google.android.exoplayer2.testutil.RobolectricUtil
;
import
com.google.android.exoplayer2.testutil.RobolectricUtil
;
import
com.google.android.exoplayer2.testutil.TestDownloadManagerListener
;
import
com.google.android.exoplayer2.testutil.TestDownloadManagerListener
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.cache.CacheUtil.CachingCounters
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -747,6 +748,11 @@ public class DownloadManagerTest {
...
@@ -747,6 +748,11 @@ public class DownloadManagerTest {
return
C
.
PERCENTAGE_UNSET
;
return
C
.
PERCENTAGE_UNSET
;
}
}
@Override
public
CachingCounters
getCounters
()
{
return
null
;
}
private
void
assertDoesNotStart
()
throws
InterruptedException
{
private
void
assertDoesNotStart
()
throws
InterruptedException
{
Thread
.
sleep
(
ASSERT_FALSE_TIME
);
Thread
.
sleep
(
ASSERT_FALSE_TIME
);
assertThat
(
started
.
getCount
()).
isEqualTo
(
1
);
assertThat
(
started
.
getCount
()).
isEqualTo
(
1
);
...
...
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