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
c095a9ff
authored
Feb 03, 2020
by
olly
Committed by
Oliver Woodman
Feb 03, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Make SingleSampleMediaSource.Factory reusable
PiperOrigin-RevId: 292879934
parent
b6bd57ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaSource.java
library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaSource.java
View file @
c095a9ff
...
...
@@ -59,7 +59,6 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
private
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
;
private
boolean
treatLoadErrorsAsEndOfStream
;
private
boolean
isCreateCalled
;
@Nullable
private
Object
tag
;
/**
...
...
@@ -81,8 +80,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
* @return This factory, for convenience.
* @throws IllegalStateException If one of the {@code create} methods has already been called.
*/
public
Factory
setTag
(
Object
tag
)
{
Assertions
.
checkState
(!
isCreateCalled
);
public
Factory
setTag
(
@Nullable
Object
tag
)
{
this
.
tag
=
tag
;
return
this
;
}
...
...
@@ -115,9 +113,12 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
* @return This factory, for convenience.
* @throws IllegalStateException If one of the {@code create} methods has already been called.
*/
public
Factory
setLoadErrorHandlingPolicy
(
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
)
{
Assertions
.
checkState
(!
isCreateCalled
);
this
.
loadErrorHandlingPolicy
=
loadErrorHandlingPolicy
;
public
Factory
setLoadErrorHandlingPolicy
(
@Nullable
LoadErrorHandlingPolicy
loadErrorHandlingPolicy
)
{
this
.
loadErrorHandlingPolicy
=
loadErrorHandlingPolicy
!=
null
?
loadErrorHandlingPolicy
:
new
DefaultLoadErrorHandlingPolicy
();
return
this
;
}
...
...
@@ -132,7 +133,6 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
* @throws IllegalStateException If one of the {@code create} methods has already been called.
*/
public
Factory
setTreatLoadErrorsAsEndOfStream
(
boolean
treatLoadErrorsAsEndOfStream
)
{
Assertions
.
checkState
(!
isCreateCalled
);
this
.
treatLoadErrorsAsEndOfStream
=
treatLoadErrorsAsEndOfStream
;
return
this
;
}
...
...
@@ -146,7 +146,6 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
* @return The new {@link SingleSampleMediaSource}.
*/
public
SingleSampleMediaSource
createMediaSource
(
Uri
uri
,
Format
format
,
long
durationUs
)
{
isCreateCalled
=
true
;
return
new
SingleSampleMediaSource
(
uri
,
dataSourceFactory
,
...
...
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