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
fb0330d4
authored
Apr 02, 2020
by
olly
Committed by
Oliver Woodman
Apr 06, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Propagate playback position through LoadControl shouldContinueLoading.
PiperOrigin-RevId: 304420177
parent
6438e1cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
library/core/src/main/java/com/google/android/exoplayer2/LoadControl.java
RELEASENOTES.md
View file @
fb0330d4
...
...
@@ -3,6 +3,7 @@
### dev-v2 (not yet released) ###
*
Core library:
*
Add playbackPositionUs parameter to 'LoadControl.shouldContinueLoading'.
*
The
`DefaultLoadControl`
default minimum buffer is set to 50 seconds,
equal to the default maximum buffer.
`DefaultLoadControl`
applies the
same behavior for audio and video.
...
...
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
View file @
fb0330d4
...
...
@@ -1945,9 +1945,16 @@ import java.util.concurrent.atomic.AtomicBoolean;
if
(!
isLoadingPossible
())
{
return
false
;
}
MediaPeriodHolder
loadingPeriodHolder
=
queue
.
getLoadingPeriod
();
long
bufferedDurationUs
=
getTotalBufferedDurationUs
(
queue
.
getLoadingPeriod
().
getNextLoadPositionUs
());
return
loadControl
.
shouldContinueLoading
(
bufferedDurationUs
,
mediaClock
.
getPlaybackSpeed
());
getTotalBufferedDurationUs
(
loadingPeriodHolder
.
getNextLoadPositionUs
());
long
playbackPositionUs
=
loadingPeriodHolder
==
queue
.
getPlayingPeriod
()
?
loadingPeriodHolder
.
toPeriodTime
(
rendererPositionUs
)
:
loadingPeriodHolder
.
toPeriodTime
(
rendererPositionUs
)
-
loadingPeriodHolder
.
info
.
startPositionUs
;
return
loadControl
.
shouldContinueLoading
(
playbackPositionUs
,
bufferedDurationUs
,
mediaClock
.
getPlaybackSpeed
());
}
private
boolean
isLoadingPossible
()
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/LoadControl.java
View file @
fb0330d4
...
...
@@ -87,14 +87,28 @@ public interface LoadControl {
*/
boolean
retainBackBufferFromKeyframe
();
/** @deprecated Use {@link LoadControl#shouldContinueLoading(long, long, float)}. */
@Deprecated
default
boolean
shouldContinueLoading
(
long
bufferedDurationUs
,
float
playbackSpeed
)
{
return
false
;
}
/**
* Called by the player to determine whether it should continue to load the source.
*
* @param playbackPositionUs The current playback position in microseconds, relative to the start
* of the {@link Timeline.Period period} that will continue to be loaded if this method
* returns {@code true}. If the playback for this period has not yet started, the value will
* negative and equal in magnitude to the duration of any media in previous periods still to
* be played.
* @param bufferedDurationUs The duration of media that's currently buffered.
* @param playbackSpeed The current playback speed.
* @return Whether the loading should continue.
*/
boolean
shouldContinueLoading
(
long
bufferedDurationUs
,
float
playbackSpeed
);
default
boolean
shouldContinueLoading
(
long
playbackPositionUs
,
long
bufferedDurationUs
,
float
playbackSpeed
)
{
return
shouldContinueLoading
(
bufferedDurationUs
,
playbackSpeed
);
}
/**
* Called repeatedly by the player when it's loading the source, has yet to start playback, and
...
...
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