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
aa249e9f
authored
May 28, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fixed issue in which the segment/chunk shift value could become incorrect.
parent
99edc6a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
7 deletions
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingChunkSource.java
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
View file @
aa249e9f
...
...
@@ -309,10 +309,26 @@ public class DashChunkSource implements ChunkSource {
RepresentationHolder
representationHolder
=
representationHolders
.
get
(
representation
.
format
.
id
);
DashSegmentIndex
oldIndex
=
representationHolder
.
segmentIndex
;
int
oldIndexLastSegmentNum
=
oldIndex
.
getLastSegmentNum
();
long
oldIndexEndTimeUs
=
oldIndex
.
getTimeUs
(
oldIndexLastSegmentNum
)
+
oldIndex
.
getDurationUs
(
oldIndexLastSegmentNum
);
DashSegmentIndex
newIndex
=
representation
.
getIndex
();
int
newFirstSegmentNum
=
newIndex
.
getFirstSegmentNum
();
int
segmentNumShift
=
oldIndex
.
getSegmentNum
(
newIndex
.
getTimeUs
(
newFirstSegmentNum
))
-
newFirstSegmentNum
;
int
newIndexFirstSegmentNum
=
newIndex
.
getFirstSegmentNum
();
long
newIndexStartTimeUs
=
newIndex
.
getTimeUs
(
newIndexFirstSegmentNum
);
if
(
oldIndexEndTimeUs
<
newIndexStartTimeUs
)
{
// 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.
fatalError
=
new
BehindLiveWindowException
();
return
;
}
int
segmentNumShift
;
if
(
oldIndexEndTimeUs
==
newIndexStartTimeUs
)
{
// The new manifest continues where the old one ended, with no overlap.
segmentNumShift
=
oldIndex
.
getLastSegmentNum
()
+
1
-
newIndexFirstSegmentNum
;
}
else
{
// The new manifest overlaps with the old one.
segmentNumShift
=
oldIndex
.
getSegmentNum
(
newIndexStartTimeUs
)
-
newIndexFirstSegmentNum
;
}
representationHolder
.
segmentNumShift
+=
segmentNumShift
;
representationHolder
.
segmentIndex
=
newIndex
;
}
...
...
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingChunkSource.java
View file @
aa249e9f
...
...
@@ -217,11 +217,22 @@ public class SmoothStreamingChunkSource implements ChunkSource {
SmoothStreamingManifest
newManifest
=
manifestFetcher
.
getManifest
();
if
(
currentManifest
!=
newManifest
&&
newManifest
!=
null
)
{
StreamElement
currentElement
=
getElement
(
currentManifest
);
int
currentElementChunkCount
=
currentElement
.
chunkCount
;
StreamElement
newElement
=
getElement
(
newManifest
);
if
(
newElement
.
chunkCount
==
0
)
{
currentManifestChunkOffset
+=
currentElement
.
chunkCount
;
}
else
if
(
currentElement
.
chunkCount
>
0
)
{
currentManifestChunkOffset
+=
currentElement
.
getChunkIndex
(
newElement
.
getStartTimeUs
(
0
));
if
(
currentElementChunkCount
==
0
||
newElement
.
chunkCount
==
0
)
{
// There's no overlap between the old and new elements because at least one is empty.
currentManifestChunkOffset
+=
currentElementChunkCount
;
}
else
{
long
currentElementEndTimeUs
=
currentElement
.
getStartTimeUs
(
currentElementChunkCount
-
1
)
+
currentElement
.
getChunkDurationUs
(
currentElementChunkCount
-
1
);
long
newElementStartTimeUs
=
newElement
.
getStartTimeUs
(
0
);
if
(
currentElementEndTimeUs
<=
newElementStartTimeUs
)
{
// There's no overlap between the old and new elements.
currentManifestChunkOffset
+=
currentElementChunkCount
;
}
else
{
// The new element overlaps with the old one.
currentManifestChunkOffset
+=
currentElement
.
getChunkIndex
(
newElementStartTimeUs
);
}
}
currentManifest
=
newManifest
;
finishedCurrentManifest
=
false
;
...
...
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