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
e4c8f7fc
authored
Apr 18, 2023
by
kimvde
Committed by
Rohit Singh
Apr 18, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix video timestamp 0 set to large value in some cases
PiperOrigin-RevId: 525064269
parent
3c281dc2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/VideoSamplePipeline.java
library/transformer/src/main/java/com/google/android/exoplayer2/transformer/VideoSamplePipeline.java
View file @
e4c8f7fc
...
...
@@ -67,6 +67,7 @@ import org.checkerframework.dataflow.qual.Pure;
private
final
EncoderWrapper
encoderWrapper
;
private
final
DecoderInputBuffer
encoderOutputBuffer
;
private
volatile
boolean
encoderExpectsTimestampZero
;
/**
* The timestamp of the last buffer processed before {@linkplain
* VideoFrameProcessor.Listener#onEnded() frame processing has ended}.
...
...
@@ -158,6 +159,9 @@ import org.checkerframework.dataflow.qual.Pure;
@Override
public
void
onOutputFrameAvailable
(
long
presentationTimeUs
)
{
// Frames are released automatically.
if
(
presentationTimeUs
==
0
)
{
encoderExpectsTimestampZero
=
true
;
}
lastProcessedFramePresentationTimeUs
=
presentationTimeUs
;
}
...
...
@@ -254,15 +258,15 @@ import org.checkerframework.dataflow.qual.Pure;
return
null
;
}
MediaCodec
.
BufferInfo
bufferInfo
=
checkNotNull
(
encoderWrapper
.
getOutputBufferInfo
());
if
(
finalFramePresentationTimeUs
!=
C
.
TIME_UNSET
&&
bufferInfo
.
size
>
0
&&
bufferInfo
.
presentationTimeUs
==
0
)
{
if
(
bufferInfo
.
presentationTimeUs
==
0
)
{
// Internal ref b/235045165: Some encoder incorrectly set a zero presentation time on the
// penultimate buffer (before EOS), and sets the actual timestamp on the EOS buffer. Use the
// last processed frame presentation time instead.
// bufferInfo.presentationTimeUs should never be 0 because we apply streamOffsetUs to the
// buffer presentationTimeUs.
bufferInfo
.
presentationTimeUs
=
finalFramePresentationTimeUs
;
if
(
encoderExpectsTimestampZero
)
{
encoderExpectsTimestampZero
=
false
;
}
else
if
(
finalFramePresentationTimeUs
!=
C
.
TIME_UNSET
&&
bufferInfo
.
size
>
0
)
{
bufferInfo
.
presentationTimeUs
=
finalFramePresentationTimeUs
;
}
}
encoderOutputBuffer
.
timeUs
=
bufferInfo
.
presentationTimeUs
;
encoderOutputBuffer
.
setFlags
(
bufferInfo
.
flags
);
...
...
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