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
1653e816
authored
Nov 06, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add configurable retry count to ChunkSampleSource
parent
eccf8d79
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
library/src/main/java/com/google/android/exoplayer/chunk/ChunkSampleSource.java
library/src/main/java/com/google/android/exoplayer/chunk/ChunkSampleSource.java
View file @
1653e816
...
@@ -140,6 +140,8 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
...
@@ -140,6 +140,8 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
private
static
final
int
NO_RESET_PENDING
=
-
1
;
private
static
final
int
NO_RESET_PENDING
=
-
1
;
private
static
final
int
DEFAULT_MIN_LOADABLE_RETRY_COUNT
=
1
;
private
final
int
eventSourceId
;
private
final
int
eventSourceId
;
private
final
LoadControl
loadControl
;
private
final
LoadControl
loadControl
;
private
final
ChunkSource
chunkSource
;
private
final
ChunkSource
chunkSource
;
...
@@ -150,6 +152,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
...
@@ -150,6 +152,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
private
final
boolean
frameAccurateSeeking
;
private
final
boolean
frameAccurateSeeking
;
private
final
Handler
eventHandler
;
private
final
Handler
eventHandler
;
private
final
EventListener
eventListener
;
private
final
EventListener
eventListener
;
private
final
int
minLoadableRetryCount
;
private
int
state
;
private
int
state
;
private
long
downstreamPositionUs
;
private
long
downstreamPositionUs
;
...
@@ -175,6 +178,13 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
...
@@ -175,6 +178,13 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
public
ChunkSampleSource
(
ChunkSource
chunkSource
,
LoadControl
loadControl
,
public
ChunkSampleSource
(
ChunkSource
chunkSource
,
LoadControl
loadControl
,
int
bufferSizeContribution
,
boolean
frameAccurateSeeking
,
Handler
eventHandler
,
int
bufferSizeContribution
,
boolean
frameAccurateSeeking
,
Handler
eventHandler
,
EventListener
eventListener
,
int
eventSourceId
)
{
EventListener
eventListener
,
int
eventSourceId
)
{
this
(
chunkSource
,
loadControl
,
bufferSizeContribution
,
frameAccurateSeeking
,
eventHandler
,
eventListener
,
eventSourceId
,
DEFAULT_MIN_LOADABLE_RETRY_COUNT
);
}
public
ChunkSampleSource
(
ChunkSource
chunkSource
,
LoadControl
loadControl
,
int
bufferSizeContribution
,
boolean
frameAccurateSeeking
,
Handler
eventHandler
,
EventListener
eventListener
,
int
eventSourceId
,
int
minLoadableRetryCount
)
{
this
.
chunkSource
=
chunkSource
;
this
.
chunkSource
=
chunkSource
;
this
.
loadControl
=
loadControl
;
this
.
loadControl
=
loadControl
;
this
.
bufferSizeContribution
=
bufferSizeContribution
;
this
.
bufferSizeContribution
=
bufferSizeContribution
;
...
@@ -182,6 +192,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
...
@@ -182,6 +192,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
this
.
eventHandler
=
eventHandler
;
this
.
eventHandler
=
eventHandler
;
this
.
eventListener
=
eventListener
;
this
.
eventListener
=
eventListener
;
this
.
eventSourceId
=
eventSourceId
;
this
.
eventSourceId
=
eventSourceId
;
this
.
minLoadableRetryCount
=
minLoadableRetryCount
;
currentLoadableHolder
=
new
ChunkOperationHolder
();
currentLoadableHolder
=
new
ChunkOperationHolder
();
mediaChunks
=
new
LinkedList
<
MediaChunk
>();
mediaChunks
=
new
LinkedList
<
MediaChunk
>();
readOnlyMediaChunks
=
Collections
.
unmodifiableList
(
mediaChunks
);
readOnlyMediaChunks
=
Collections
.
unmodifiableList
(
mediaChunks
);
...
@@ -287,9 +298,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
...
@@ -287,9 +298,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
downstreamPositionUs
=
positionUs
;
downstreamPositionUs
=
positionUs
;
if
(
isPendingReset
())
{
if
(
isPendingReset
())
{
if
(
currentLoadableException
!=
null
)
{
maybeThrowLoadableException
();
throw
currentLoadableException
;
}
IOException
chunkSourceException
=
chunkSource
.
getError
();
IOException
chunkSourceException
=
chunkSource
.
getError
();
if
(
chunkSourceException
!=
null
)
{
if
(
chunkSourceException
!=
null
)
{
throw
chunkSourceException
;
throw
chunkSourceException
;
...
@@ -342,9 +351,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
...
@@ -342,9 +351,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
onSampleRead
(
mediaChunk
,
sampleHolder
);
onSampleRead
(
mediaChunk
,
sampleHolder
);
return
SAMPLE_READ
;
return
SAMPLE_READ
;
}
else
{
}
else
{
if
(
currentLoadableException
!=
null
)
{
maybeThrowLoadableException
();
throw
currentLoadableException
;
}
return
NOTHING_READ
;
return
NOTHING_READ
;
}
}
}
}
...
@@ -369,6 +376,12 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
...
@@ -369,6 +376,12 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
}
}
}
}
private
void
maybeThrowLoadableException
()
throws
IOException
{
if
(
currentLoadableException
!=
null
&&
currentLoadableExceptionCount
>
minLoadableRetryCount
)
{
throw
currentLoadableException
;
}
}
private
MediaChunk
getMediaChunk
(
long
positionUs
)
{
private
MediaChunk
getMediaChunk
(
long
positionUs
)
{
Iterator
<
MediaChunk
>
mediaChunkIterator
=
mediaChunks
.
iterator
();
Iterator
<
MediaChunk
>
mediaChunkIterator
=
mediaChunks
.
iterator
();
while
(
mediaChunkIterator
.
hasNext
())
{
while
(
mediaChunkIterator
.
hasNext
())
{
...
...
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