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
04e60614
authored
Feb 13, 2019
by
aquilescanta
Committed by
Andrew Lewis
Feb 18, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Reduce the number of parameters required to create an HlsMediaChunk
PiperOrigin-RevId: 233765839
parent
cc153cfc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
32 deletions
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsChunkSource.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaChunk.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsChunkSource.java
View file @
04e60614
...
@@ -290,8 +290,8 @@ import java.util.List;
...
@@ -290,8 +290,8 @@ import java.util.List;
}
}
}
}
int
chunkIndex
=
(
int
)
(
chunkMediaSequence
-
mediaPlaylist
.
mediaSequence
);
int
segmentIndexInPlaylist
=
(
int
)
(
chunkMediaSequence
-
mediaPlaylist
.
mediaSequence
);
if
(
chunkIndex
>=
mediaPlaylist
.
segments
.
size
())
{
if
(
segmentIndexInPlaylist
>=
mediaPlaylist
.
segments
.
size
())
{
if
(
mediaPlaylist
.
hasEndTag
)
{
if
(
mediaPlaylist
.
hasEndTag
)
{
out
.
endOfStream
=
true
;
out
.
endOfStream
=
true
;
}
else
/* Live */
{
}
else
/* Live */
{
...
@@ -306,7 +306,7 @@ import java.util.List;
...
@@ -306,7 +306,7 @@ import java.util.List;
expectedPlaylistUrl
=
null
;
expectedPlaylistUrl
=
null
;
// Handle encryption.
// Handle encryption.
HlsMediaPlaylist
.
Segment
segment
=
mediaPlaylist
.
segments
.
get
(
chunkIndex
);
HlsMediaPlaylist
.
Segment
segment
=
mediaPlaylist
.
segments
.
get
(
segmentIndexInPlaylist
);
// Check if the segment is completely encrypted using the identity key format.
// Check if the segment is completely encrypted using the identity key format.
if
(
segment
.
fullSegmentEncryptionKeyUri
!=
null
)
{
if
(
segment
.
fullSegmentEncryptionKeyUri
!=
null
)
{
...
@@ -324,44 +324,20 @@ import java.util.List;
...
@@ -324,44 +324,20 @@ import java.util.List;
clearEncryptionData
();
clearEncryptionData
();
}
}
DataSpec
initDataSpec
=
null
;
Segment
initSegment
=
segment
.
initializationSegment
;
if
(
initSegment
!=
null
)
{
Uri
initSegmentUri
=
UriUtil
.
resolveToUri
(
mediaPlaylist
.
baseUri
,
initSegment
.
url
);
initDataSpec
=
new
DataSpec
(
initSegmentUri
,
initSegment
.
byterangeOffset
,
initSegment
.
byterangeLength
,
null
);
}
// Compute start time of the next chunk.
long
segmentStartTimeInPeriodUs
=
startOfPlaylistInPeriodUs
+
segment
.
relativeStartTimeUs
;
int
discontinuitySequence
=
mediaPlaylist
.
discontinuitySequence
+
segment
.
relativeDiscontinuitySequence
;
TimestampAdjuster
timestampAdjuster
=
timestampAdjusterProvider
.
getAdjuster
(
discontinuitySequence
);
// Configure the data source and spec for the chunk.
Uri
chunkUri
=
UriUtil
.
resolveToUri
(
mediaPlaylist
.
baseUri
,
segment
.
url
);
DataSpec
dataSpec
=
new
DataSpec
(
chunkUri
,
segment
.
byterangeOffset
,
segment
.
byterangeLength
,
null
);
out
.
chunk
=
out
.
chunk
=
new
HlsMediaChunk
(
HlsMediaChunk
.
createInstance
(
extractorFactory
,
extractorFactory
,
mediaDataSource
,
mediaDataSource
,
dataSpec
,
startOfPlaylistInPeriodUs
,
initDataSpec
,
mediaPlaylist
,
segmentIndexInPlaylist
,
selectedUrl
,
selectedUrl
,
muxedCaptionFormats
,
muxedCaptionFormats
,
trackSelection
.
getSelectionReason
(),
trackSelection
.
getSelectionReason
(),
trackSelection
.
getSelectionData
(),
trackSelection
.
getSelectionData
(),
segmentStartTimeInPeriodUs
,
segmentStartTimeInPeriodUs
+
segment
.
durationUs
,
chunkMediaSequence
,
discontinuitySequence
,
segment
.
hasGapTag
,
isTimestampMaster
,
isTimestampMaster
,
timestampAdjuster
,
timestampAdjuster
Provider
,
previous
,
previous
,
segment
.
drmInitData
,
encryptionKey
,
encryptionKey
,
encryptionIv
);
encryptionIv
);
}
}
...
...
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaChunk.java
View file @
04e60614
This diff is collapsed.
Click to expand it.
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