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
51e4f7b2
authored
Oct 22, 2019
by
andrewlewis
Committed by
Oliver Woodman
Oct 30, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix supplemental data handling with dropped frames
PiperOrigin-RevId: 276024935
parent
3e6fe458
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
8 deletions
extensions/av1/src/main/java/com/google/android/exoplayer2/ext/av1/Gav1Decoder.java
extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/VpxDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/video/VideoDecoderOutputBuffer.java
extensions/av1/src/main/java/com/google/android/exoplayer2/ext/av1/Gav1Decoder.java
View file @
51e4f7b2
...
@@ -101,10 +101,7 @@ import java.nio.ByteBuffer;
...
@@ -101,10 +101,7 @@ import java.nio.ByteBuffer;
boolean
decodeOnly
=
inputBuffer
.
isDecodeOnly
();
boolean
decodeOnly
=
inputBuffer
.
isDecodeOnly
();
if
(!
decodeOnly
)
{
if
(!
decodeOnly
)
{
@Nullable
outputBuffer
.
init
(
inputBuffer
.
timeUs
,
outputMode
,
/* supplementalData= */
null
);
ByteBuffer
supplementalData
=
inputBuffer
.
hasSupplementalData
()
?
inputBuffer
.
supplementalData
:
null
;
outputBuffer
.
init
(
inputBuffer
.
timeUs
,
outputMode
,
supplementalData
);
}
}
// We need to dequeue the decoded frame from the decoder even when the input data is
// We need to dequeue the decoded frame from the decoder even when the input data is
// decode-only.
// decode-only.
...
...
extensions/vp9/src/main/java/com/google/android/exoplayer2/ext/vp9/VpxDecoder.java
View file @
51e4f7b2
...
@@ -22,6 +22,7 @@ import com.google.android.exoplayer2.decoder.CryptoInfo;
...
@@ -22,6 +22,7 @@ import com.google.android.exoplayer2.decoder.CryptoInfo;
import
com.google.android.exoplayer2.decoder.SimpleDecoder
;
import
com.google.android.exoplayer2.decoder.SimpleDecoder
;
import
com.google.android.exoplayer2.drm.DecryptionException
;
import
com.google.android.exoplayer2.drm.DecryptionException
;
import
com.google.android.exoplayer2.drm.ExoMediaCrypto
;
import
com.google.android.exoplayer2.drm.ExoMediaCrypto
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.video.VideoDecoderInputBuffer
;
import
com.google.android.exoplayer2.video.VideoDecoderInputBuffer
;
import
com.google.android.exoplayer2.video.VideoDecoderOutputBuffer
;
import
com.google.android.exoplayer2.video.VideoDecoderOutputBuffer
;
...
@@ -40,6 +41,8 @@ import java.nio.ByteBuffer;
...
@@ -40,6 +41,8 @@ import java.nio.ByteBuffer;
@Nullable
private
final
ExoMediaCrypto
exoMediaCrypto
;
@Nullable
private
final
ExoMediaCrypto
exoMediaCrypto
;
private
final
long
vpxDecContext
;
private
final
long
vpxDecContext
;
@Nullable
private
ByteBuffer
lastSupplementalData
;
@C
.
VideoOutputMode
private
volatile
int
outputMode
;
@C
.
VideoOutputMode
private
volatile
int
outputMode
;
/**
/**
...
@@ -124,6 +127,11 @@ import java.nio.ByteBuffer;
...
@@ -124,6 +127,11 @@ import java.nio.ByteBuffer;
@Nullable
@Nullable
protected
VpxDecoderException
decode
(
protected
VpxDecoderException
decode
(
VideoDecoderInputBuffer
inputBuffer
,
VideoDecoderOutputBuffer
outputBuffer
,
boolean
reset
)
{
VideoDecoderInputBuffer
inputBuffer
,
VideoDecoderOutputBuffer
outputBuffer
,
boolean
reset
)
{
if
(
reset
&&
lastSupplementalData
!=
null
)
{
// Don't propagate supplemental data across calls to flush the decoder.
lastSupplementalData
.
clear
();
}
ByteBuffer
inputData
=
Util
.
castNonNull
(
inputBuffer
.
data
);
ByteBuffer
inputData
=
Util
.
castNonNull
(
inputBuffer
.
data
);
int
inputSize
=
inputData
.
limit
();
int
inputSize
=
inputData
.
limit
();
CryptoInfo
cryptoInfo
=
inputBuffer
.
cryptoInfo
;
CryptoInfo
cryptoInfo
=
inputBuffer
.
cryptoInfo
;
...
@@ -143,11 +151,22 @@ import java.nio.ByteBuffer;
...
@@ -143,11 +151,22 @@ import java.nio.ByteBuffer;
}
}
}
}
if
(
inputBuffer
.
hasSupplementalData
())
{
ByteBuffer
supplementalData
=
Assertions
.
checkNotNull
(
inputBuffer
.
supplementalData
);
int
size
=
supplementalData
.
remaining
();
if
(
size
>
0
)
{
if
(
lastSupplementalData
==
null
||
lastSupplementalData
.
capacity
()
<
size
)
{
lastSupplementalData
=
ByteBuffer
.
allocate
(
size
);
}
else
{
lastSupplementalData
.
clear
();
}
lastSupplementalData
.
put
(
supplementalData
);
lastSupplementalData
.
flip
();
}
}
if
(!
inputBuffer
.
isDecodeOnly
())
{
if
(!
inputBuffer
.
isDecodeOnly
())
{
@Nullable
outputBuffer
.
init
(
inputBuffer
.
timeUs
,
outputMode
,
lastSupplementalData
);
ByteBuffer
supplementalData
=
inputBuffer
.
hasSupplementalData
()
?
inputBuffer
.
supplementalData
:
null
;
outputBuffer
.
init
(
inputBuffer
.
timeUs
,
outputMode
,
supplementalData
);
int
getFrameResult
=
vpxGetFrame
(
vpxDecContext
,
outputBuffer
);
int
getFrameResult
=
vpxGetFrame
(
vpxDecContext
,
outputBuffer
);
if
(
getFrameResult
==
1
)
{
if
(
getFrameResult
==
1
)
{
outputBuffer
.
addFlag
(
C
.
BUFFER_FLAG_DECODE_ONLY
);
outputBuffer
.
addFlag
(
C
.
BUFFER_FLAG_DECODE_ONLY
);
...
@@ -162,6 +181,7 @@ import java.nio.ByteBuffer;
...
@@ -162,6 +181,7 @@ import java.nio.ByteBuffer;
@Override
@Override
public
void
release
()
{
public
void
release
()
{
super
.
release
();
super
.
release
();
lastSupplementalData
=
null
;
vpxClose
(
vpxDecContext
);
vpxClose
(
vpxDecContext
);
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/video/VideoDecoderOutputBuffer.java
View file @
51e4f7b2
...
@@ -108,6 +108,8 @@ public class VideoDecoderOutputBuffer extends OutputBuffer {
...
@@ -108,6 +108,8 @@ public class VideoDecoderOutputBuffer extends OutputBuffer {
this
.
supplementalData
.
put
(
supplementalData
);
this
.
supplementalData
.
put
(
supplementalData
);
this
.
supplementalData
.
flip
();
this
.
supplementalData
.
flip
();
supplementalData
.
position
(
0
);
supplementalData
.
position
(
0
);
}
else
{
this
.
supplementalData
=
null
;
}
}
}
}
...
...
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