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
f146bad4
authored
Jan 16, 2020
by
olly
Committed by
Oliver Woodman
Jan 17, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
HLS: Fix slow seeking into long MP3 segments
Issue: #6155 PiperOrigin-RevId: 290117324
parent
0456b638
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
3 deletions
RELEASENOTES.md
library/core/src/main/java/com/google/android/exoplayer2/source/SampleQueue.java
library/core/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java
RELEASENOTES.md
View file @
f146bad4
...
...
@@ -22,10 +22,11 @@
(
[
#6845
](
https://github.com/google/ExoPlayer/issues/6845
)
).
*
Support "twos" codec (big endian PCM) in MP4
(
[
#5789
](
https://github.com/google/ExoPlayer/issues/5789
)
).
*
WAV: Support IMA ADPCM encoded data.
*
Show ad group markers in
`DefaultTimeBar`
even if they are after the end of
the current window
(
[
#6552
](
https://github.com/google/ExoPlayer/issues/6552
)
).
*
HLS: Fix slow seeking into long MP3 segments
(
[
#6155
](
https://github.com/google/ExoPlayer/issues/6155
)
).
*
WAV:
*
Support IMA ADPCM encoded data.
*
Improve support for G.711 A-law and mu-law encoded data.
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/SampleQueue.java
View file @
f146bad4
...
...
@@ -507,7 +507,23 @@ public class SampleQueue implements TrackOutput {
boolean
loadingFinished
,
long
decodeOnlyUntilUs
,
SampleExtrasHolder
extrasHolder
)
{
if
(!
hasNextSample
())
{
// This is a temporary fix for https://github.com/google/ExoPlayer/issues/6155.
// TODO: Remove it and replace it with a fix that discards samples when writing to the queue.
boolean
hasNextSample
;
int
relativeReadIndex
=
C
.
INDEX_UNSET
;
while
((
hasNextSample
=
hasNextSample
()))
{
relativeReadIndex
=
getRelativeIndex
(
readPosition
);
long
timeUs
=
timesUs
[
relativeReadIndex
];
if
(
timeUs
<
decodeOnlyUntilUs
&&
MimeTypes
.
allSamplesAreSyncSamples
(
formats
[
relativeReadIndex
].
sampleMimeType
))
{
readPosition
++;
}
else
{
break
;
}
}
if
(!
hasNextSample
)
{
if
(
loadingFinished
||
isLastSampleQueued
)
{
buffer
.
setFlags
(
C
.
BUFFER_FLAG_END_OF_STREAM
);
return
C
.
RESULT_BUFFER_READ
;
...
...
@@ -519,7 +535,6 @@ public class SampleQueue implements TrackOutput {
}
}
int
relativeReadIndex
=
getRelativeIndex
(
readPosition
);
if
(
formatRequired
||
formats
[
relativeReadIndex
]
!=
downstreamFormat
)
{
onFormatResult
(
formats
[
relativeReadIndex
],
formatHolder
);
return
C
.
RESULT_FORMAT_READ
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java
View file @
f146bad4
...
...
@@ -143,6 +143,31 @@ public final class MimeTypes {
}
/**
* Returns true if it is known that all samples in a stream of the given sample MIME type are
* guaranteed to be sync samples (i.e., {@link C#BUFFER_FLAG_KEY_FRAME} is guaranteed to be set on
* every sample).
*
* @param mimeType The sample MIME type.
* @return True if it is known that all samples in a stream of the given sample MIME type are
* guaranteed to be sync samples. False otherwise, including if {@code null} is passed.
*/
public
static
boolean
allSamplesAreSyncSamples
(
@Nullable
String
mimeType
)
{
if
(
mimeType
==
null
)
{
return
false
;
}
// TODO: Consider adding additional audio MIME types here.
switch
(
mimeType
)
{
case
AUDIO_AAC:
case
AUDIO_MPEG:
case
AUDIO_MPEG_L1:
case
AUDIO_MPEG_L2:
return
true
;
default
:
return
false
;
}
}
/**
* Derives a video sample mimeType from a codecs attribute.
*
* @param codecs The codecs attribute.
...
...
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