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
d5f8d1a1
authored
Sep 01, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Don't crash updating a representation without an index.
parent
ebeafe23
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
View file @
d5f8d1a1
...
@@ -788,30 +788,30 @@ public class DashChunkSource implements ChunkSource {
...
@@ -788,30 +788,30 @@ public class DashChunkSource implements ChunkSource {
public
void
updateRepresentation
(
Representation
newRepresentation
)
public
void
updateRepresentation
(
Representation
newRepresentation
)
throws
BehindLiveWindowException
{
throws
BehindLiveWindowException
{
DashSegmentIndex
oldIndex
=
segmentIndex
;
DashSegmentIndex
oldIndex
=
representation
.
getIndex
();
DashSegmentIndex
newIndex
=
newRepresentation
.
getIndex
();
representation
=
newRepresentation
;
if
(
newIndex
==
null
)
{
return
;
}
segmentIndex
=
newIndex
;
int
oldIndexLastSegmentNum
=
oldIndex
.
getLastSegmentNum
();
int
oldIndexLastSegmentNum
=
oldIndex
.
getLastSegmentNum
();
long
oldIndexEndTimeUs
=
oldIndex
.
getTimeUs
(
oldIndexLastSegmentNum
)
long
oldIndexEndTimeUs
=
oldIndex
.
getTimeUs
(
oldIndexLastSegmentNum
)
+
oldIndex
.
getDurationUs
(
oldIndexLastSegmentNum
);
+
oldIndex
.
getDurationUs
(
oldIndexLastSegmentNum
);
DashSegmentIndex
newIndex
=
newRepresentation
.
getIndex
();
int
newIndexFirstSegmentNum
=
newIndex
.
getFirstSegmentNum
();
int
newIndexFirstSegmentNum
=
newIndex
.
getFirstSegmentNum
();
long
newIndexStartTimeUs
=
newIndex
.
getTimeUs
(
newIndexFirstSegmentNum
);
long
newIndexStartTimeUs
=
newIndex
.
getTimeUs
(
newIndexFirstSegmentNum
);
int
segmentNumShift
;
if
(
oldIndexEndTimeUs
==
newIndexStartTimeUs
)
{
if
(
oldIndexEndTimeUs
==
newIndexStartTimeUs
)
{
// The new manifest continues where the old one ended, with no overlap.
// The new manifest continues where the old one ended, with no overlap.
segmentNumShift
=
oldIndex
.
getLastSegmentNum
()
+
1
-
newIndexFirstSegmentNum
;
segmentNumShift
+
=
oldIndex
.
getLastSegmentNum
()
+
1
-
newIndexFirstSegmentNum
;
}
else
if
(
oldIndexEndTimeUs
<
newIndexStartTimeUs
)
{
}
else
if
(
oldIndexEndTimeUs
<
newIndexStartTimeUs
)
{
// There's a gap between the old manifest and the new one which means we've slipped
// There's a gap between the old manifest and the new one which means we've slipped
// behind the live window and can't proceed.
// behind the live window and can't proceed.
throw
new
BehindLiveWindowException
();
throw
new
BehindLiveWindowException
();
}
else
{
}
else
{
// The new manifest overlaps with the old one.
// The new manifest overlaps with the old one.
segmentNumShift
=
oldIndex
.
getSegmentNum
(
newIndexStartTimeUs
)
-
newIndexFirstSegmentNum
;
segmentNumShift
+
=
oldIndex
.
getSegmentNum
(
newIndexStartTimeUs
)
-
newIndexFirstSegmentNum
;
}
}
representation
=
newRepresentation
;
segmentIndex
=
newIndex
;
this
.
segmentNumShift
+=
segmentNumShift
;
}
}
public
int
getSegmentNum
(
long
positionUs
)
{
public
int
getSegmentNum
(
long
positionUs
)
{
...
...
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