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
24f2cbb2
authored
Dec 01, 2018
by
olly
Committed by
Oliver Woodman
Dec 04, 2018
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
updateQueuedPeriods(): If known duration changed for a media period, remove all media periods after
PiperOrigin-RevId: 223603915
parent
ffbb0da8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodQueue.java
library/core/src/main/java/com/google/android/exoplayer2/MediaPeriodQueue.java
View file @
24f2cbb2
...
@@ -307,7 +307,11 @@ import com.google.android.exoplayer2.util.Assertions;
...
@@ -307,7 +307,11 @@ import com.google.android.exoplayer2.util.Assertions;
MediaPeriodHolder
periodHolder
=
getFrontPeriod
();
MediaPeriodHolder
periodHolder
=
getFrontPeriod
();
while
(
periodHolder
!=
null
)
{
while
(
periodHolder
!=
null
)
{
if
(
previousPeriodHolder
==
null
)
{
if
(
previousPeriodHolder
==
null
)
{
long
previousDurationUs
=
periodHolder
.
info
.
durationUs
;
periodHolder
.
info
=
getUpdatedMediaPeriodInfo
(
periodHolder
.
info
);
periodHolder
.
info
=
getUpdatedMediaPeriodInfo
(
periodHolder
.
info
);
if
(!
canKeepAfterMediaPeriodHolder
(
periodHolder
,
previousDurationUs
))
{
return
!
removeAfter
(
periodHolder
);
}
}
else
{
}
else
{
// Check this period holder still follows the previous one, based on the new timeline.
// Check this period holder still follows the previous one, based on the new timeline.
if
(
periodIndex
==
C
.
INDEX_UNSET
if
(
periodIndex
==
C
.
INDEX_UNSET
...
@@ -326,6 +330,8 @@ import com.google.android.exoplayer2.util.Assertions;
...
@@ -326,6 +330,8 @@ import com.google.android.exoplayer2.util.Assertions;
// Check the media period information matches the new timeline.
// Check the media period information matches the new timeline.
if
(!
canKeepMediaPeriodHolder
(
periodHolder
,
periodInfo
))
{
if
(!
canKeepMediaPeriodHolder
(
periodHolder
,
periodInfo
))
{
return
!
removeAfter
(
previousPeriodHolder
);
return
!
removeAfter
(
previousPeriodHolder
);
}
else
if
(!
canKeepAfterMediaPeriodHolder
(
periodHolder
,
periodInfo
.
durationUs
))
{
return
!
removeAfter
(
periodHolder
);
}
}
}
}
...
@@ -469,6 +475,15 @@ import com.google.android.exoplayer2.util.Assertions;
...
@@ -469,6 +475,15 @@ import com.google.android.exoplayer2.util.Assertions;
}
}
/**
/**
* Returns whether periods after {@code periodHolder} can be kept for playing given its previous
* duration.
*/
private
boolean
canKeepAfterMediaPeriodHolder
(
MediaPeriodHolder
periodHolder
,
long
previousDurationUs
)
{
return
previousDurationUs
==
C
.
TIME_UNSET
||
previousDurationUs
==
periodHolder
.
info
.
durationUs
;
}
/**
* Updates the queue for any playback mode change, and returns whether the change was fully
* Updates the queue for any playback mode change, and returns whether the change was fully
* handled. If not, it is necessary to seek to the current playback position.
* handled. If not, it is necessary to seek to the current playback position.
*/
*/
...
...
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