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
a60265b1
authored
Sep 19, 2019
by
bachinger
Committed by
Toni
Sep 20, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
enable/disable media source correctly when added to playlist
PiperOrigin-RevId: 270007370
parent
826fe3ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
library/core/src/main/java/com/google/android/exoplayer2/Playlist.java
library/core/src/main/java/com/google/android/exoplayer2/Playlist.java
View file @
a60265b1
...
...
@@ -132,6 +132,11 @@ import java.util.Set;
mediaSourceByUid
.
put
(
holder
.
uid
,
holder
);
if
(
isPrepared
)
{
prepareChildSource
(
holder
);
if
(
mediaSourceByMediaPeriod
.
isEmpty
())
{
enabledMediaSourceHolders
.
add
(
holder
);
}
else
{
disableChildSource
(
holder
);
}
}
}
}
...
...
@@ -267,6 +272,7 @@ import java.util.Set;
for
(
int
i
=
0
;
i
<
mediaSourceHolders
.
size
();
i
++)
{
MediaSourceHolder
mediaSourceHolder
=
mediaSourceHolders
.
get
(
i
);
prepareChildSource
(
mediaSourceHolder
);
enabledMediaSourceHolders
.
add
(
mediaSourceHolder
);
}
isPrepared
=
true
;
}
...
...
@@ -357,15 +363,19 @@ import java.util.Set;
while
(
iterator
.
hasNext
())
{
MediaSourceHolder
holder
=
iterator
.
next
();
if
(
holder
.
activeMediaPeriodIds
.
isEmpty
())
{
@Nullable
MediaSourceAndListener
disabledChild
=
childSources
.
get
(
holder
);
if
(
disabledChild
!=
null
)
{
disabledChild
.
mediaSource
.
disable
(
disabledChild
.
caller
);
}
disableChildSource
(
holder
);
iterator
.
remove
();
}
}
}
private
void
disableChildSource
(
MediaSourceHolder
holder
)
{
@Nullable
MediaSourceAndListener
disabledChild
=
childSources
.
get
(
holder
);
if
(
disabledChild
!=
null
)
{
disabledChild
.
mediaSource
.
disable
(
disabledChild
.
caller
);
}
}
private
void
removeMediaSourcesInternal
(
int
fromIndex
,
int
toIndex
)
{
for
(
int
index
=
toIndex
-
1
;
index
>=
fromIndex
;
index
--)
{
MediaSourceHolder
holder
=
mediaSourceHolders
.
remove
(
index
);
...
...
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