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
0a0a4782
authored
Dec 05, 2019
by
aquilescanta
Committed by
Oliver Woodman
Jan 17, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add a test for SampleQueue capacity increases
Also remove redundant line PiperOrigin-RevId: 283956203
parent
14897fb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
library/core/src/main/java/com/google/android/exoplayer2/source/SampleQueue.java
library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java
library/core/src/main/java/com/google/android/exoplayer2/source/SampleQueue.java
View file @
0a0a4782
...
...
@@ -17,6 +17,7 @@ package com.google.android.exoplayer2.source;
import
android.os.Looper
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.VisibleForTesting
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.FormatHolder
;
...
...
@@ -49,7 +50,7 @@ public class SampleQueue implements TrackOutput {
public
static
final
int
ADVANCE_FAILED
=
-
1
;
private
static
final
int
SAMPLE_CAPACITY_INCREMENT
=
1000
;
@VisibleForTesting
/* package */
static
final
int
SAMPLE_CAPACITY_INCREMENT
=
1000
;
private
final
SampleDataQueue
sampleDataQueue
;
private
final
SampleExtrasHolder
extrasHolder
;
...
...
@@ -652,7 +653,6 @@ public class SampleQueue implements TrackOutput {
formats
=
newFormats
;
sourceIds
=
newSourceIds
;
relativeFirstIndex
=
0
;
length
=
capacity
;
capacity
=
newCapacity
;
}
}
...
...
library/core/src/test/java/com/google/android/exoplayer2/source/SampleQueueTest.java
View file @
0a0a4782
...
...
@@ -158,6 +158,34 @@ public final class SampleQueueTest {
}
@Test
public
void
testCapacityIncreases
()
{
int
numberOfSamplesToInput
=
3
*
SampleQueue
.
SAMPLE_CAPACITY_INCREMENT
+
1
;
sampleQueue
.
format
(
FORMAT_1
);
sampleQueue
.
sampleData
(
new
ParsableByteArray
(
numberOfSamplesToInput
),
/* length= */
numberOfSamplesToInput
);
for
(
int
i
=
0
;
i
<
numberOfSamplesToInput
;
i
++)
{
sampleQueue
.
sampleMetadata
(
/* timeUs= */
i
*
1000
,
/* flags= */
C
.
BUFFER_FLAG_KEY_FRAME
,
/* size= */
1
,
/* offset= */
numberOfSamplesToInput
-
i
-
1
,
/* cryptoData= */
null
);
}
assertReadFormat
(
/* formatRequired= */
false
,
FORMAT_1
);
for
(
int
i
=
0
;
i
<
numberOfSamplesToInput
;
i
++)
{
assertReadSample
(
/* timeUs= */
i
*
1000
,
/* isKeyFrame= */
true
,
/* isEncrypted= */
false
,
/* sampleData= */
new
byte
[
1
],
/* offset= */
0
,
/* length= */
1
);
}
assertReadNothing
(
/* formatRequired= */
false
);
}
@Test
public
void
testResetReleasesAllocations
()
{
writeTestData
();
assertAllocationCount
(
10
);
...
...
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