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
4c1f0c40
authored
Feb 28, 2020
by
olly
Committed by
Oliver Woodman
Feb 28, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Format.Builder: Simplify some test classes
PiperOrigin-RevId: 297865356
parent
3730639c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
99 deletions
library/core/src/test/java/com/google/android/exoplayer2/mediacodec/MediaCodecUtilTest.java
library/core/src/test/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelectorTest.java
library/core/src/test/java/com/google/android/exoplayer2/trackselection/MappingTrackSelectorTest.java
library/core/src/test/java/com/google/android/exoplayer2/mediacodec/MediaCodecUtilTest.java
View file @
4c1f0c40
...
@@ -96,22 +96,11 @@ public final class MediaCodecUtilTest {
...
@@ -96,22 +96,11 @@ public final class MediaCodecUtilTest {
/* colorTransfer= */
C
.
COLOR_TRANSFER_SDR
,
/* colorTransfer= */
C
.
COLOR_TRANSFER_SDR
,
/* hdrStaticInfo= */
new
byte
[]
{
1
,
2
,
3
,
4
,
5
,
6
,
7
});
/* hdrStaticInfo= */
new
byte
[]
{
1
,
2
,
3
,
4
,
5
,
6
,
7
});
Format
format
=
Format
format
=
Format
.
createVideoSampleFormat
(
new
Format
.
Builder
()
/* id= */
null
,
.
setSampleMimeType
(
MimeTypes
.
VIDEO_AV1
)
MimeTypes
.
VIDEO_AV1
,
.
setCodecs
(
"av01.0.21M.10"
)
/* codecs= */
"av01.0.21M.10"
,
.
setColorInfo
(
colorInfo
)
/* bitrate= */
Format
.
NO_VALUE
,
.
build
();
/* maxInputSize= */
Format
.
NO_VALUE
,
/* width= */
1024
,
/* height= */
768
,
/* frameRate= */
Format
.
NO_VALUE
,
/* initializationData= */
null
,
/* rotationDegrees= */
Format
.
NO_VALUE
,
/* pixelWidthHeightRatio= */
0
,
/* projectionData= */
null
,
/* stereoMode= */
Format
.
NO_VALUE
,
/* colorInfo= */
colorInfo
,
/* drmInitData */
null
);
assertCodecProfileAndLevelForFormat
(
assertCodecProfileAndLevelForFormat
(
format
,
format
,
MediaCodecInfo
.
CodecProfileLevel
.
AV1ProfileMain10HDR10
,
MediaCodecInfo
.
CodecProfileLevel
.
AV1ProfileMain10HDR10
,
...
@@ -127,22 +116,11 @@ public final class MediaCodecUtilTest {
...
@@ -127,22 +116,11 @@ public final class MediaCodecUtilTest {
/* colorTransfer= */
C
.
COLOR_TRANSFER_HLG
,
/* colorTransfer= */
C
.
COLOR_TRANSFER_HLG
,
/* hdrStaticInfo= */
null
);
/* hdrStaticInfo= */
null
);
Format
format
=
Format
format
=
Format
.
createVideoSampleFormat
(
new
Format
.
Builder
()
/* id= */
null
,
.
setSampleMimeType
(
MimeTypes
.
VIDEO_AV1
)
MimeTypes
.
VIDEO_AV1
,
.
setCodecs
(
"av01.0.21M.10"
)
/* codecs= */
"av01.0.21M.10"
,
.
setColorInfo
(
colorInfo
)
/* bitrate= */
Format
.
NO_VALUE
,
.
build
();
/* maxInputSize= */
Format
.
NO_VALUE
,
/* width= */
1024
,
/* height= */
768
,
/* frameRate= */
Format
.
NO_VALUE
,
/* initializationData= */
null
,
/* rotationDegrees= */
Format
.
NO_VALUE
,
/* pixelWidthHeightRatio= */
0
,
/* projectionData= */
null
,
/* stereoMode= */
Format
.
NO_VALUE
,
/* colorInfo= */
colorInfo
,
/* drmInitData */
null
);
assertCodecProfileAndLevelForFormat
(
assertCodecProfileAndLevelForFormat
(
format
,
format
,
MediaCodecInfo
.
CodecProfileLevel
.
AV1ProfileMain10HDR10
,
MediaCodecInfo
.
CodecProfileLevel
.
AV1ProfileMain10HDR10
,
...
@@ -161,52 +139,20 @@ public final class MediaCodecUtilTest {
...
@@ -161,52 +139,20 @@ public final class MediaCodecUtilTest {
@Test
@Test
public
void
getCodecProfileAndLevel_rejectsNullCodecString
()
{
public
void
getCodecProfileAndLevel_rejectsNullCodecString
()
{
Format
format
=
Format
format
=
new
Format
.
Builder
().
setCodecs
(
null
).
build
();
Format
.
createVideoSampleFormat
(
/* id= */
null
,
/* sampleMimeType= */
MimeTypes
.
VIDEO_UNKNOWN
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
/* maxInputSize= */
Format
.
NO_VALUE
,
/* width= */
1024
,
/* height= */
768
,
/* frameRate= */
Format
.
NO_VALUE
,
/* initializationData= */
null
,
/* drmInitData= */
null
);
assertThat
(
MediaCodecUtil
.
getCodecProfileAndLevel
(
format
)).
isNull
();
assertThat
(
MediaCodecUtil
.
getCodecProfileAndLevel
(
format
)).
isNull
();
}
}
@Test
@Test
public
void
getCodecProfileAndLevel_rejectsEmptyCodecString
()
{
public
void
getCodecProfileAndLevel_rejectsEmptyCodecString
()
{
Format
format
=
Format
format
=
new
Format
.
Builder
().
setCodecs
(
""
).
build
();
Format
.
createVideoSampleFormat
(
/* id= */
null
,
/* sampleMimeType= */
MimeTypes
.
VIDEO_UNKNOWN
,
/* codecs= */
""
,
/* bitrate= */
Format
.
NO_VALUE
,
/* maxInputSize= */
Format
.
NO_VALUE
,
/* width= */
1024
,
/* height= */
768
,
/* frameRate= */
Format
.
NO_VALUE
,
/* initializationData= */
null
,
/* drmInitData= */
null
);
assertThat
(
MediaCodecUtil
.
getCodecProfileAndLevel
(
format
)).
isNull
();
assertThat
(
MediaCodecUtil
.
getCodecProfileAndLevel
(
format
)).
isNull
();
}
}
private
static
void
assertCodecProfileAndLevelForCodecsString
(
private
static
void
assertCodecProfileAndLevelForCodecsString
(
String
m
imeType
,
String
codecs
,
int
profile
,
int
level
)
{
String
sampleM
imeType
,
String
codecs
,
int
profile
,
int
level
)
{
Format
format
=
Format
format
=
Format
.
createVideoSampleFormat
(
new
Format
.
Builder
().
setSampleMimeType
(
sampleMimeType
).
setCodecs
(
codecs
).
build
();
/* id= */
null
,
mimeType
,
/* codecs= */
codecs
,
/* bitrate= */
Format
.
NO_VALUE
,
/* maxInputSize= */
Format
.
NO_VALUE
,
/* width= */
1024
,
/* height= */
768
,
/* frameRate= */
Format
.
NO_VALUE
,
/* initializationData= */
null
,
/* drmInitData= */
null
);
assertCodecProfileAndLevelForFormat
(
format
,
profile
,
level
);
assertCodecProfileAndLevelForFormat
(
format
,
profile
,
level
);
}
}
...
...
library/core/src/test/java/com/google/android/exoplayer2/trackselection/DefaultTrackSelectorTest.java
View file @
4c1f0c40
This diff is collapsed.
Click to expand it.
library/core/src/test/java/com/google/android/exoplayer2/trackselection/MappingTrackSelectorTest.java
View file @
4c1f0c40
...
@@ -47,35 +47,9 @@ public final class MappingTrackSelectorTest {
...
@@ -47,35 +47,9 @@ public final class MappingTrackSelectorTest {
private
static
final
RendererCapabilities
METADATA_CAPABILITIES
=
private
static
final
RendererCapabilities
METADATA_CAPABILITIES
=
new
FakeRendererCapabilities
(
C
.
TRACK_TYPE_METADATA
);
new
FakeRendererCapabilities
(
C
.
TRACK_TYPE_METADATA
);
private
static
final
TrackGroup
VIDEO_TRACK_GROUP
=
private
static
final
TrackGroup
VIDEO_TRACK_GROUP
=
buildTrackGroup
(
MimeTypes
.
VIDEO_H264
);
new
TrackGroup
(
private
static
final
TrackGroup
AUDIO_TRACK_GROUP
=
buildTrackGroup
(
MimeTypes
.
AUDIO_AAC
);
Format
.
createVideoSampleFormat
(
private
static
final
TrackGroup
METADATA_TRACK_GROUP
=
buildTrackGroup
(
MimeTypes
.
APPLICATION_ID3
);
"video"
,
MimeTypes
.
VIDEO_H264
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
/* maxInputSize= */
Format
.
NO_VALUE
,
/* width= */
1024
,
/* height= */
768
,
/* frameRate= */
Format
.
NO_VALUE
,
/* initializationData= */
null
,
/* drmInitData= */
null
));
private
static
final
TrackGroup
AUDIO_TRACK_GROUP
=
new
TrackGroup
(
Format
.
createAudioSampleFormat
(
"audio"
,
MimeTypes
.
AUDIO_AAC
,
/* codecs= */
null
,
/* bitrate= */
Format
.
NO_VALUE
,
/* maxInputSize= */
Format
.
NO_VALUE
,
/* channelCount= */
2
,
/* sampleRate= */
44100
,
/* initializationData= */
null
,
/* drmInitData= */
null
,
/* selectionFlags= */
0
,
/* language= */
null
));
private
static
final
TrackGroup
METADATA_TRACK_GROUP
=
new
TrackGroup
(
Format
.
createSampleFormat
(
"metadata"
,
MimeTypes
.
APPLICATION_ID3
));
private
static
final
Timeline
TIMELINE
=
new
FakeTimeline
(
/* windowCount= */
1
);
private
static
final
Timeline
TIMELINE
=
new
FakeTimeline
(
/* windowCount= */
1
);
...
@@ -150,6 +124,10 @@ public final class MappingTrackSelectorTest {
...
@@ -150,6 +124,10 @@ public final class MappingTrackSelectorTest {
trackSelector
.
assertMappedTrackGroups
(
2
,
METADATA_TRACK_GROUP
);
trackSelector
.
assertMappedTrackGroups
(
2
,
METADATA_TRACK_GROUP
);
}
}
private
static
TrackGroup
buildTrackGroup
(
String
sampleMimeType
)
{
return
new
TrackGroup
(
new
Format
.
Builder
().
setSampleMimeType
(
sampleMimeType
).
build
());
}
/**
/**
* A {@link MappingTrackSelector} that stashes the {@link MappedTrackInfo} passed to {@link
* A {@link MappingTrackSelector} that stashes the {@link MappedTrackInfo} passed to {@link
* #selectTracks(MappedTrackInfo, int[][][], int[])}.
* #selectTracks(MappedTrackInfo, int[][][], int[])}.
...
@@ -209,7 +187,5 @@ public final class MappingTrackSelectorTest {
...
@@ -209,7 +187,5 @@ public final class MappingTrackSelectorTest {
public
int
supportsMixedMimeTypeAdaptation
()
throws
ExoPlaybackException
{
public
int
supportsMixedMimeTypeAdaptation
()
throws
ExoPlaybackException
{
return
ADAPTIVE_SEAMLESS
;
return
ADAPTIVE_SEAMLESS
;
}
}
}
}
}
}
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