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
d443be2a
authored
Sep 13, 2019
by
olly
Committed by
Oliver Woodman
Sep 16, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clear supplementalData in DecoderInputBuffer.clear
PiperOrigin-RevId: 268894250
parent
1d3d92ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
library/core/src/main/java/com/google/android/exoplayer2/decoder/DecoderInputBuffer.java
library/core/src/main/java/com/google/android/exoplayer2/decoder/DecoderInputBuffer.java
View file @
d443be2a
...
@@ -95,14 +95,19 @@ public class DecoderInputBuffer extends Buffer {
...
@@ -95,14 +95,19 @@ public class DecoderInputBuffer extends Buffer {
this
.
bufferReplacementMode
=
bufferReplacementMode
;
this
.
bufferReplacementMode
=
bufferReplacementMode
;
}
}
/** Resets {@link #supplementalData} in preparation for storing {@code length} bytes. */
/**
* Clears {@link #supplementalData} and ensures that it's large enough to accommodate {@code
* length} bytes.
*
* @param length The length of the supplemental data that must be accommodated, in bytes.
*/
@EnsuresNonNull
(
"supplementalData"
)
@EnsuresNonNull
(
"supplementalData"
)
public
void
resetSupplementalData
(
int
length
)
{
public
void
resetSupplementalData
(
int
length
)
{
if
(
supplementalData
==
null
||
supplementalData
.
capacity
()
<
length
)
{
if
(
supplementalData
==
null
||
supplementalData
.
capacity
()
<
length
)
{
supplementalData
=
ByteBuffer
.
allocate
(
length
);
supplementalData
=
ByteBuffer
.
allocate
(
length
);
}
else
{
supplementalData
.
clear
();
}
}
supplementalData
.
position
(
0
);
supplementalData
.
limit
(
length
);
}
}
/**
/**
...
@@ -134,8 +139,7 @@ public class DecoderInputBuffer extends Buffer {
...
@@ -134,8 +139,7 @@ public class DecoderInputBuffer extends Buffer {
ByteBuffer
newData
=
createReplacementByteBuffer
(
requiredCapacity
);
ByteBuffer
newData
=
createReplacementByteBuffer
(
requiredCapacity
);
// Copy data up to the current position from the old buffer to the new one.
// Copy data up to the current position from the old buffer to the new one.
if
(
position
>
0
)
{
if
(
position
>
0
)
{
data
.
position
(
0
);
data
.
flip
();
data
.
limit
(
position
);
newData
.
put
(
data
);
newData
.
put
(
data
);
}
}
// Set the new buffer.
// Set the new buffer.
...
@@ -158,7 +162,7 @@ public class DecoderInputBuffer extends Buffer {
...
@@ -158,7 +162,7 @@ public class DecoderInputBuffer extends Buffer {
}
}
/**
/**
* Flips {@link #data} in preparation for being queued to a decoder.
* Flips {@link #data}
and {@link #supplementalData}
in preparation for being queued to a decoder.
*
*
* @see java.nio.Buffer#flip()
* @see java.nio.Buffer#flip()
*/
*/
...
@@ -175,6 +179,9 @@ public class DecoderInputBuffer extends Buffer {
...
@@ -175,6 +179,9 @@ public class DecoderInputBuffer extends Buffer {
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
data
.
clear
();
data
.
clear
();
}
}
if
(
supplementalData
!=
null
)
{
supplementalData
.
clear
();
}
}
}
private
ByteBuffer
createReplacementByteBuffer
(
int
requiredCapacity
)
{
private
ByteBuffer
createReplacementByteBuffer
(
int
requiredCapacity
)
{
...
...
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