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
71f094f2
authored
Feb 05, 2022
by
Dustin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
MpegAudioChunkHandler seek fixes
parent
247b5769
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/MpegAudioChunkHandler.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/MpegAudioChunkHandler.java
View file @
71f094f2
...
@@ -21,6 +21,7 @@ import com.google.android.exoplayer2.C;
...
@@ -21,6 +21,7 @@ import com.google.android.exoplayer2.C;
import
com.google.android.exoplayer2.audio.MpegAudioUtil
;
import
com.google.android.exoplayer2.audio.MpegAudioUtil
;
import
com.google.android.exoplayer2.extractor.ExtractorInput
;
import
com.google.android.exoplayer2.extractor.ExtractorInput
;
import
com.google.android.exoplayer2.extractor.TrackOutput
;
import
com.google.android.exoplayer2.extractor.TrackOutput
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -104,7 +105,9 @@ public class MpegAudioChunkHandler extends ChunkHandler {
...
@@ -104,7 +105,9 @@ public class MpegAudioChunkHandler extends ChunkHandler {
}
}
scratch
.
skipBytes
(-
3
);
scratch
.
skipBytes
(-
3
);
}
}
toRead
=
Math
.
min
(
chunkRemaining
,
128
);
// 16 is small, but if we end up reading multiple frames into scratch, things get complicated.
// We should only loop on seek, so this is the lesser of the evils.
toRead
=
Math
.
min
(
chunkRemaining
,
16
);
}
}
return
false
;
return
false
;
}
}
...
@@ -140,11 +143,17 @@ public class MpegAudioChunkHandler extends ChunkHandler {
...
@@ -140,11 +143,17 @@ public class MpegAudioChunkHandler extends ChunkHandler {
public
void
setIndex
(
int
index
)
{
public
void
setIndex
(
int
index
)
{
super
.
setIndex
(
index
);
super
.
setIndex
(
index
);
syncTime
();
syncTime
();
if
(
frameRemaining
!=
0
)
{
// We have a partial frame in the output, no way to clear it, so just send it as is.
// Next frame should be key frame, so the codec should recover.
trackOutput
.
sampleMetadata
(
timeUs
,
0
,
header
.
frameSize
-
frameRemaining
,
0
,
null
);
frameRemaining
=
0
;
}
}
}
private
void
syncTime
()
{
private
void
syncTime
()
{
timeUs
=
clock
.
getUs
();
timeUs
=
clock
.
getUs
();
frameRemaining
=
0
;
}
}
@VisibleForTesting
(
otherwise
=
VisibleForTesting
.
NONE
)
@VisibleForTesting
(
otherwise
=
VisibleForTesting
.
NONE
)
...
...
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