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
3abdec17
authored
Dec 23, 2020
by
olly
Committed by
Oliver Woodman
Dec 23, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Some no-op cleanup to bypass mode
PiperOrigin-RevId: 348795995
parent
5f3d1c1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecRenderer.java
View file @
3abdec17
...
...
@@ -2133,54 +2133,59 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
*/
private
boolean
bypassRender
(
long
positionUs
,
long
elapsedRealtimeUs
)
throws
ExoPlaybackException
{
BatchBuffer
batchBuffer
=
bypassBatchBuffer
;
// Process any data in the batch buffer.
checkState
(!
outputStreamEnded
);
if
(!
b
atchBuffer
.
isEmpty
())
{
// Optimisation: Do not process buffer if empty.
if
(!
b
ypassBatchBuffer
.
isEmpty
())
{
if
(
processOutputBuffer
(
positionUs
,
elapsedRealtimeUs
,
/* codec= */
null
,
batchBuffer
.
data
,
b
ypassB
atchBuffer
.
data
,
outputIndex
,
/* bufferFlags= */
0
,
batchBuffer
.
getAccessUnitCount
(),
batchBuffer
.
getFirstAccessUnitTimeUs
(),
batchBuffer
.
isDecodeOnly
(),
batchBuffer
.
isEndOfStream
(),
b
ypassB
atchBuffer
.
getAccessUnitCount
(),
b
ypassB
atchBuffer
.
getFirstAccessUnitTimeUs
(),
b
ypassB
atchBuffer
.
isDecodeOnly
(),
b
ypassB
atchBuffer
.
isEndOfStream
(),
outputFormat
))
{
onProcessedOutputBuffer
(
batchBuffer
.
getLastAccessUnitTimeUs
());
onProcessedOutputBuffer
(
b
ypassB
atchBuffer
.
getLastAccessUnitTimeUs
());
}
else
{
// Could not process the whole buffer. Try again later.
return
false
;
}
}
// Process
the end of stream, if it has been
reached.
if
(
batchBuffer
.
isEndOfStream
())
{
// Process
end of stream, if
reached.
if
(
b
ypassB
atchBuffer
.
isEndOfStream
())
{
outputStreamEnded
=
true
;
return
false
;
}
batchBuffer
.
batchWasConsumed
();
bypassBatchBuffer
.
batchWasConsumed
();
if
(
bypassDrainAndReinitialize
)
{
if
(!
batchBuffer
.
isEmpty
())
{
return
true
;
// Drain the batch buffer before propagating the format change.
if
(!
bypassBatchBuffer
.
isEmpty
())
{
// The bypassBatchBuffer.batchWasConsumed() call above caused a pending access unit to be
// made available inside the batch buffer, meaning it's once again non-empty. We need to
// process this data before we can re-initialize.
return
true
;
}
disableBypass
();
// The new format might require a codec.
// The new format might require using a codec rather than bypass.
disableBypass
();
bypassDrainAndReinitialize
=
false
;
maybeInitCodecOrBypass
();
if
(!
bypassEnabled
)
{
return
false
;
// The new format is not supported in codec bypass.
// We're no longer in bypass mode.
return
false
;
}
}
//
Now refill the empty
buffer for the next iteration.
//
Fill the batch
buffer for the next iteration.
checkState
(!
inputStreamEnded
);
FormatHolder
formatHolder
=
getFormatHolder
();
boolean
formatChange
=
readBatchFromSource
(
formatHolder
,
batchBuffer
);
boolean
formatChange
=
readBatchFromSource
(
formatHolder
,
b
ypassB
atchBuffer
);
if
(!
batchBuffer
.
isEmpty
()
&&
waitingForFirstSampleInFormat
)
{
if
(!
b
ypassB
atchBuffer
.
isEmpty
()
&&
waitingForFirstSampleInFormat
)
{
// This is the first buffer in a new format, the output format must be updated.
outputFormat
=
checkNotNull
(
inputFormat
);
onOutputFormatChanged
(
outputFormat
,
/* mediaFormat= */
null
);
...
...
@@ -2192,12 +2197,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
}
boolean
haveDataToProcess
=
false
;
if
(
batchBuffer
.
isEndOfStream
())
{
if
(
b
ypassB
atchBuffer
.
isEndOfStream
())
{
inputStreamEnded
=
true
;
haveDataToProcess
=
true
;
}
if
(!
batchBuffer
.
isEmpty
())
{
batchBuffer
.
flip
();
if
(!
b
ypassB
atchBuffer
.
isEmpty
())
{
b
ypassB
atchBuffer
.
flip
();
haveDataToProcess
=
true
;
}
...
...
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