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
2d3e6d4d
authored
Jan 20, 2021
by
aquilescanta
Committed by
kim-vde
Jan 22, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Test SampleQueue.peek
PiperOrigin-RevId: 352781639
parent
4eaa6111
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java
library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java
View file @
2d3e6d4d
...
...
@@ -204,6 +204,22 @@ public final class SampleQueueTest {
}
@Test
public
void
peekConsumesDownstreamFormat
()
{
sampleQueue
.
format
(
FORMAT_1
);
clearFormatHolderAndInputBuffer
();
int
result
=
sampleQueue
.
peek
(
formatHolder
,
inputBuffer
,
/* formatRequired= */
false
,
/* loadingFinished= */
false
);
assertThat
(
result
).
isEqualTo
(
RESULT_FORMAT_READ
);
// formatHolder should be populated.
assertThat
(
formatHolder
.
format
).
isEqualTo
(
FORMAT_1
);
result
=
sampleQueue
.
peek
(
formatHolder
,
inputBuffer
,
/* formatRequired= */
false
,
/* loadingFinished= */
false
);
assertThat
(
result
).
isEqualTo
(
RESULT_NOTHING_READ
);
}
@Test
public
void
equalFormatsDeduplicated
()
{
sampleQueue
.
format
(
FORMAT_1
);
assertReadFormat
(
false
,
FORMAT_1
);
...
...
@@ -1625,10 +1641,32 @@ public final class SampleQueueTest {
byte
[]
sampleData
,
int
offset
,
int
length
)
{
// Check that peeks yields the expected values.
clearFormatHolderAndInputBuffer
();
int
result
=
sampleQueue
.
peek
(
formatHolder
,
inputBuffer
,
/* formatRequired= */
false
,
/* loadingFinished= */
false
);
assertBufferReadResult
(
result
,
timeUs
,
isKeyFrame
,
isDecodeOnly
,
isEncrypted
,
sampleData
,
offset
,
length
);
// Check that read yields the expected values.
clearFormatHolderAndInputBuffer
();
result
=
sampleQueue
.
read
(
formatHolder
,
inputBuffer
,
/* formatRequired= */
false
,
/* loadingFinished= */
false
);
assertBufferReadResult
(
result
,
timeUs
,
isKeyFrame
,
isDecodeOnly
,
isEncrypted
,
sampleData
,
offset
,
length
);
}
private
void
assertBufferReadResult
(
int
result
,
long
timeUs
,
boolean
isKeyFrame
,
boolean
isDecodeOnly
,
boolean
isEncrypted
,
byte
[]
sampleData
,
int
offset
,
int
length
)
{
assertThat
(
result
).
isEqualTo
(
RESULT_BUFFER_READ
);
// formatHolder should not be populated.
assertThat
(
formatHolder
.
format
).
isNull
();
...
...
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