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
694f9844
authored
Jan 24, 2020
by
kimvde
Committed by
Andrew Lewis
Jan 27, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
MP3 extractor: refactor seeker initialization
PiperOrigin-RevId: 291405419
parent
3fc61de7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp3/Mp3Extractor.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp3/Mp3Extractor.java
View file @
694f9844
...
@@ -190,24 +190,7 @@ public final class Mp3Extractor implements Extractor {
...
@@ -190,24 +190,7 @@ public final class Mp3Extractor implements Extractor {
}
}
}
}
if
(
seeker
==
null
)
{
if
(
seeker
==
null
)
{
// Read past any seek frame and set the seeker based on metadata or a seek frame. Metadata
seeker
=
computeSeeker
(
input
);
// takes priority as it can provide greater precision.
Seeker
seekFrameSeeker
=
maybeReadSeekFrame
(
input
);
Seeker
metadataSeeker
=
maybeHandleSeekMetadata
(
metadata
,
input
.
getPosition
());
if
(
disableSeeking
)
{
seeker
=
new
UnseekableSeeker
();
}
else
{
if
(
metadataSeeker
!=
null
)
{
seeker
=
metadataSeeker
;
}
else
if
(
seekFrameSeeker
!=
null
)
{
seeker
=
seekFrameSeeker
;
}
if
(
seeker
==
null
||
(!
seeker
.
isSeekable
()
&&
(
flags
&
FLAG_ENABLE_CONSTANT_BITRATE_SEEKING
)
!=
0
))
{
seeker
=
getConstantBitrateSeeker
(
input
);
}
}
extractorOutput
.
seekMap
(
seeker
);
extractorOutput
.
seekMap
(
seeker
);
trackOutput
.
format
(
trackOutput
.
format
(
Format
.
createAudioSampleFormat
(
Format
.
createAudioSampleFormat
(
...
@@ -385,6 +368,31 @@ public final class Mp3Extractor implements Extractor {
...
@@ -385,6 +368,31 @@ public final class Mp3Extractor implements Extractor {
}
}
}
}
private
Seeker
computeSeeker
(
ExtractorInput
input
)
throws
IOException
,
InterruptedException
{
// Read past any seek frame and set the seeker based on metadata or a seek frame. Metadata
// takes priority as it can provide greater precision.
Seeker
seekFrameSeeker
=
maybeReadSeekFrame
(
input
);
Seeker
metadataSeeker
=
maybeHandleSeekMetadata
(
metadata
,
input
.
getPosition
());
if
(
disableSeeking
)
{
return
new
UnseekableSeeker
();
}
@Nullable
Seeker
resultSeeker
=
null
;
if
(
metadataSeeker
!=
null
)
{
resultSeeker
=
metadataSeeker
;
}
else
if
(
seekFrameSeeker
!=
null
)
{
resultSeeker
=
seekFrameSeeker
;
}
if
(
resultSeeker
==
null
||
(!
resultSeeker
.
isSeekable
()
&&
(
flags
&
FLAG_ENABLE_CONSTANT_BITRATE_SEEKING
)
!=
0
))
{
resultSeeker
=
getConstantBitrateSeeker
(
input
);
}
return
resultSeeker
;
}
/**
/**
* Consumes the next frame from the {@code input} if it contains VBRI or Xing seeking metadata,
* Consumes the next frame from the {@code input} if it contains VBRI or Xing seeking metadata,
* returning a {@link Seeker} if the metadata was present and valid, or {@code null} otherwise.
* returning a {@link Seeker} if the metadata was present and valid, or {@code null} otherwise.
...
...
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