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
fbef465c
authored
Jul 19, 2018
by
Nicola Verbeeck
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Allow specifying the default live presentation delay instead of using hardcoded constant
parent
a076924c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletions
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
View file @
fbef465c
...
...
@@ -79,6 +79,7 @@ public final class DashMediaSource extends BaseMediaSource {
private
CompositeSequenceableLoaderFactory
compositeSequenceableLoaderFactory
;
private
int
minLoadableRetryCount
;
private
long
livePresentationDelayMs
;
private
long
defaultLivePresentationDelayMs
;
private
boolean
isCreateCalled
;
private
@Nullable
Object
tag
;
...
...
@@ -98,6 +99,7 @@ public final class DashMediaSource extends BaseMediaSource {
this
.
manifestDataSourceFactory
=
manifestDataSourceFactory
;
minLoadableRetryCount
=
DEFAULT_MIN_LOADABLE_RETRY_COUNT
;
livePresentationDelayMs
=
DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS
;
defaultLivePresentationDelayMs
=
DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS
;
compositeSequenceableLoaderFactory
=
new
DefaultCompositeSequenceableLoaderFactory
();
}
...
...
@@ -147,6 +149,23 @@ public final class DashMediaSource extends BaseMediaSource {
this
.
livePresentationDelayMs
=
livePresentationDelayMs
;
return
this
;
}
/**
* Sets the duration in milliseconds by which the default start position should precede the end
* of the live window for live playbacks if the value is not present in the manifest. The default value is {@link
* #DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS}.
*
* @param defaultLivePresentationDelayMs For live playbacks, the duration in milliseconds by which the
* default start position should precede the end of the live window if the duration is not specifed in the manifest
* or overwritten using @{link setLivePresentationDelayMs).
* @return This factory, for convenience.
* @throws IllegalStateException If one of the {@code create} methods has already been called.
*/
public
Factory
setDefaultLivePresentationDelayMs
(
long
defaultLivePresentationDelayMs
)
{
Assertions
.
checkState
(!
isCreateCalled
);
this
.
defaultLivePresentationDelayMs
=
defaultLivePresentationDelayMs
;
return
this
}
/**
* Sets the manifest parser to parse loaded manifest data when loading a manifest URI.
...
...
@@ -885,7 +904,7 @@ public final class DashMediaSource extends BaseMediaSource {
long
presentationDelayForManifestMs
=
livePresentationDelayMs
;
if
(
presentationDelayForManifestMs
==
DEFAULT_LIVE_PRESENTATION_DELAY_PREFER_MANIFEST_MS
)
{
presentationDelayForManifestMs
=
manifest
.
suggestedPresentationDelayMs
!=
C
.
TIME_UNSET
?
manifest
.
suggestedPresentationDelayMs
:
DEFAULT_LIVE_PRESENTATION_DELAY_FIXED_MS
;
?
manifest
.
suggestedPresentationDelayMs
:
defaultLivePresentationDelayMs
;
}
// Snap the default position to the start of the segment containing it.
windowDefaultStartPositionUs
=
windowDurationUs
-
C
.
msToUs
(
presentationDelayForManifestMs
);
...
...
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