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
9246fbbe
authored
Oct 26, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add exception type for manifest load errors.
parent
f3113e70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
library/src/main/java/com/google/android/exoplayer/util/ManifestFetcher.java
library/src/main/java/com/google/android/exoplayer/util/ManifestFetcher.java
View file @
9246fbbe
...
@@ -49,6 +49,14 @@ import java.util.concurrent.CancellationException;
...
@@ -49,6 +49,14 @@ import java.util.concurrent.CancellationException;
public
class
ManifestFetcher
<
T
>
implements
Loader
.
Callback
{
public
class
ManifestFetcher
<
T
>
implements
Loader
.
Callback
{
/**
/**
* Thrown when an error occurs trying to fetch a manifest.
*/
public
static
final
class
ManifestIOException
extends
IOException
{
public
ManifestIOException
(
Throwable
cause
)
{
super
(
cause
);
}
}
/**
* Interface definition for a callback to be notified of {@link ManifestFetcher} events.
* Interface definition for a callback to be notified of {@link ManifestFetcher} events.
*/
*/
public
interface
EventListener
{
public
interface
EventListener
{
...
@@ -112,7 +120,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -112,7 +120,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
private
int
loadExceptionCount
;
private
int
loadExceptionCount
;
private
long
loadExceptionTimestamp
;
private
long
loadExceptionTimestamp
;
private
IOException
loadException
;
private
Manifest
IOException
loadException
;
private
volatile
T
manifest
;
private
volatile
T
manifest
;
private
volatile
long
manifestLoadStartTimestamp
;
private
volatile
long
manifestLoadStartTimestamp
;
...
@@ -201,9 +209,10 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -201,9 +209,10 @@ public class ManifestFetcher<T> implements Loader.Callback {
* Throws the error that affected the most recent attempt to load the manifest. Does nothing if
* Throws the error that affected the most recent attempt to load the manifest. Does nothing if
* the most recent attempt was successful.
* the most recent attempt was successful.
*
*
* @throws IOException The error that affected the most recent attempt to load the manifest.
* @throws ManifestIOException The error that affected the most recent attempt to load the
* manifest.
*/
*/
public
void
maybeThrowError
()
throws
IOException
{
public
void
maybeThrowError
()
throws
Manifest
IOException
{
// Don't throw an exception until at least 1 retry attempt has been made.
// Don't throw an exception until at least 1 retry attempt has been made.
if
(
loadException
==
null
||
loadExceptionCount
<=
1
)
{
if
(
loadException
==
null
||
loadExceptionCount
<=
1
)
{
return
;
return
;
...
@@ -291,7 +300,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -291,7 +300,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
loadExceptionCount
++;
loadExceptionCount
++;
loadExceptionTimestamp
=
SystemClock
.
elapsedRealtime
();
loadExceptionTimestamp
=
SystemClock
.
elapsedRealtime
();
loadException
=
new
IOException
(
exception
);
loadException
=
new
Manifest
IOException
(
exception
);
notifyManifestError
(
loadException
);
notifyManifestError
(
loadException
);
}
}
...
@@ -376,7 +385,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
...
@@ -376,7 +385,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
public
void
onLoadCanceled
(
Loadable
loadable
)
{
public
void
onLoadCanceled
(
Loadable
loadable
)
{
// This shouldn't ever happen, but handle it anyway.
// This shouldn't ever happen, but handle it anyway.
try
{
try
{
IOException
exception
=
new
IOException
(
"Load cancelled"
,
new
CancellationException
());
IOException
exception
=
new
ManifestIOException
(
new
CancellationException
());
wrappedCallback
.
onSingleManifestError
(
exception
);
wrappedCallback
.
onSingleManifestError
(
exception
);
}
finally
{
}
finally
{
releaseLoader
();
releaseLoader
();
...
...
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