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
0414b0d2
authored
Dec 20, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix assertion fail on seek.
Issue: #214
parent
c497b78f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
8 deletions
library/src/main/java/com/google/android/exoplayer/hls/HlsSampleSource.java
library/src/main/java/com/google/android/exoplayer/hls/TsExtractor.java
library/src/main/java/com/google/android/exoplayer/hls/HlsSampleSource.java
View file @
0414b0d2
...
...
@@ -171,7 +171,7 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
if
(
isPendingReset
()
||
extractors
.
isEmpty
())
{
return
false
;
}
boolean
haveSamples
=
prepared
&&
haveSamplesForEnabledTracks
(
extractors
.
getFirst
());
boolean
haveSamples
=
prepared
&&
haveSamplesForEnabledTracks
(
getCurrentExtractor
());
if
(!
haveSamples
)
{
maybeThrowLoadableException
();
}
...
...
@@ -194,13 +194,7 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
return
NOTHING_READ
;
}
TsExtractor
extractor
=
extractors
.
getFirst
();
while
(
extractors
.
size
()
>
1
&&
!
haveSamplesForEnabledTracks
(
extractor
))
{
// We're finished reading from the extractor for all tracks, and so can discard it.
extractors
.
removeFirst
().
release
();
extractor
=
extractors
.
getFirst
();
}
TsExtractor
extractor
=
getCurrentExtractor
();
if
(
extractors
.
size
()
>
1
)
{
// If there's more than one extractor, attempt to configure a seamless splice from the
// current one to the next one.
...
...
@@ -318,7 +312,30 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
maybeStartLoading
();
}
/**
* Gets the current extractor from which samples should be read.
* <p>
* Calling this method discards extractors without any samples from the front of the queue. The
* last extractor is retained even if it doesn't have any samples.
* <p>
* This method must not be called unless {@link #extractors} is non-empty.
*
* @return The current extractor from which samples should be read. Guaranteed to be non-null.
*/
private
TsExtractor
getCurrentExtractor
()
{
TsExtractor
extractor
=
extractors
.
getFirst
();
while
(
extractors
.
size
()
>
1
&&
!
haveSamplesForEnabledTracks
(
extractor
))
{
// We're finished reading from the extractor for all tracks, and so can discard it.
extractors
.
removeFirst
().
release
();
extractor
=
extractors
.
getFirst
();
}
return
extractor
;
}
private
void
discardSamplesForDisabledTracks
(
TsExtractor
extractor
,
long
timeUs
)
{
if
(!
extractor
.
isPrepared
())
{
return
;
}
for
(
int
i
=
0
;
i
<
trackEnabledStates
.
length
;
i
++)
{
if
(!
trackEnabledStates
[
i
])
{
extractor
.
discardUntil
(
i
,
timeUs
);
...
...
@@ -327,6 +344,9 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
}
private
boolean
haveSamplesForEnabledTracks
(
TsExtractor
extractor
)
{
if
(!
extractor
.
isPrepared
())
{
return
false
;
}
for
(
int
i
=
0
;
i
<
trackEnabledStates
.
length
;
i
++)
{
if
(
trackEnabledStates
[
i
]
&&
extractor
.
hasSamples
(
i
))
{
return
true
;
...
...
library/src/main/java/com/google/android/exoplayer/hls/TsExtractor.java
View file @
0414b0d2
...
...
@@ -205,6 +205,7 @@ public final class TsExtractor {
* for the specified track. False otherwise.
*/
public
boolean
hasSamples
(
int
track
)
{
Assertions
.
checkState
(
prepared
);
return
sampleQueues
.
valueAt
(
track
).
peek
()
!=
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