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
531f03a3
authored
Jun 23, 2022
by
olly
Committed by
Ian Baker
Jun 27, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Inform ProgressiveMediaPeriod of known length earlier
PiperOrigin-RevId: 456753343
parent
216fefd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaPeriod.java
library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaPeriod.java
View file @
531f03a3
...
...
@@ -134,7 +134,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
boolean
seenFirstTrackSelection
;
private
boolean
notifyDiscontinuity
;
private
int
enabledTrackCount
;
private
long
length
;
private
boolean
isLengthKnown
;
private
long
lastSeekPositionUs
;
private
long
pendingResetPositionUs
;
...
...
@@ -200,7 +200,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
sampleQueueTrackIds
=
new
TrackId
[
0
];
sampleQueues
=
new
SampleQueue
[
0
];
pendingResetPositionUs
=
C
.
TIME_UNSET
;
length
=
C
.
LENGTH_UNSET
;
durationUs
=
C
.
TIME_UNSET
;
dataType
=
C
.
DATA_TYPE_MEDIA
;
}
...
...
@@ -577,7 +576,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* trackSelectionData= */
null
,
/* mediaStartTimeUs= */
loadable
.
seekTimeUs
,
durationUs
);
copyLengthFromLoader
(
loadable
);
loadingFinished
=
true
;
Assertions
.
checkNotNull
(
callback
).
onContinueLoadingRequested
(
this
);
}
...
...
@@ -606,7 +604,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/* mediaStartTimeUs= */
loadable
.
seekTimeUs
,
durationUs
);
if
(!
released
)
{
copyLengthFromLoader
(
loadable
);
for
(
SampleQueue
sampleQueue
:
sampleQueues
)
{
sampleQueue
.
reset
();
}
...
...
@@ -623,7 +620,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
long
loadDurationMs
,
IOException
error
,
int
errorCount
)
{
copyLengthFromLoader
(
loadable
);
StatsDataSource
dataSource
=
loadable
.
dataSource
;
LoadEventInfo
loadEventInfo
=
new
LoadEventInfo
(
...
...
@@ -709,6 +705,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// Internal methods.
private
void
onLengthKnown
()
{
handler
.
post
(()
->
isLengthKnown
=
true
);
}
private
TrackOutput
prepareTrackOutput
(
TrackId
id
)
{
int
trackCount
=
sampleQueues
.
length
;
for
(
int
i
=
0
;
i
<
trackCount
;
i
++)
{
...
...
@@ -732,7 +732,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
void
setSeekMap
(
SeekMap
seekMap
)
{
this
.
seekMap
=
icyHeaders
==
null
?
seekMap
:
new
Unseekable
(
/* durationUs= */
C
.
TIME_UNSET
);
durationUs
=
seekMap
.
getDurationUs
();
isLive
=
length
==
C
.
LENGTH_UNSET
&&
seekMap
.
getDurationUs
()
==
C
.
TIME_UNSET
;
isLive
=
!
isLengthKnown
&&
seekMap
.
getDurationUs
()
==
C
.
TIME_UNSET
;
dataType
=
isLive
?
C
.
DATA_TYPE_MEDIA_PROGRESSIVE_LIVE
:
C
.
DATA_TYPE_MEDIA
;
listener
.
onSourceInfoRefreshed
(
durationUs
,
seekMap
.
isSeekable
(),
isLive
);
if
(!
prepared
)
{
...
...
@@ -788,12 +788,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
Assertions
.
checkNotNull
(
callback
).
onPrepared
(
this
);
}
private
void
copyLengthFromLoader
(
ExtractingLoadable
loadable
)
{
if
(
length
==
C
.
LENGTH_UNSET
)
{
length
=
loadable
.
length
;
}
}
private
void
startLoading
()
{
ExtractingLoadable
loadable
=
new
ExtractingLoadable
(
...
...
@@ -839,7 +833,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* retry.
*/
private
boolean
configureRetry
(
ExtractingLoadable
loadable
,
int
currentExtractedSampleCount
)
{
if
(
length
!=
C
.
LENGTH_UNSET
||
(
seekMap
!=
null
&&
seekMap
.
getDurationUs
()
!=
C
.
TIME_UNSET
))
{
if
(
isLengthKnown
||
(
seekMap
!=
null
&&
seekMap
.
getDurationUs
()
!=
C
.
TIME_UNSET
))
{
// We're playing an on-demand stream. Resume the current loadable, which will
// request data starting from the point it left off.
extractedSamplesCountAtStartOfLoad
=
currentExtractedSampleCount
;
...
...
@@ -969,7 +963,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private
boolean
pendingExtractorSeek
;
private
long
seekTimeUs
;
private
DataSpec
dataSpec
;
private
long
length
;
@Nullable
private
TrackOutput
icyTrackOutput
;
private
boolean
seenIcyMetadata
;
...
...
@@ -987,7 +980,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
this
.
loadCondition
=
loadCondition
;
this
.
positionHolder
=
new
PositionHolder
();
this
.
pendingExtractorSeek
=
true
;
this
.
length
=
C
.
LENGTH_UNSET
;
loadTaskId
=
LoadEventInfo
.
getNewId
();
dataSpec
=
buildDataSpec
(
/* position= */
0
);
}
...
...
@@ -1006,9 +998,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
try
{
long
position
=
positionHolder
.
position
;
dataSpec
=
buildDataSpec
(
position
);
length
=
dataSource
.
open
(
dataSpec
);
l
ong
l
ength
=
dataSource
.
open
(
dataSpec
);
if
(
length
!=
C
.
LENGTH_UNSET
)
{
length
+=
position
;
onLengthKnown
();
}
icyHeaders
=
IcyHeaders
.
parse
(
dataSource
.
getResponseHeaders
());
DataSource
extractorDataSource
=
dataSource
;
...
...
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