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
5da086fe
authored
Jan 17, 2023
by
samrobinson
Committed by
christosts
Jan 18, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add a unit test to check 2/3 resolution supported.
PiperOrigin-RevId: 502573469
parent
345f2345
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/EncoderUtilTest.java
library/transformer/src/test/java/com/google/android/exoplayer2/transformer/EncoderUtilTest.java
View file @
5da086fe
...
...
@@ -36,7 +36,13 @@ import org.robolectric.shadows.MediaCodecInfoBuilder;
import
org.robolectric.shadows.ShadowMediaCodec
;
import
org.robolectric.shadows.ShadowMediaCodecList
;
/** Unit test for {@link EncoderUtil}. */
/**
* Unit test for {@link EncoderUtil}.
*
* <p>See {@link
* com.google.android.exoplayer2.mediacodec.MediaCodecUtil#maxH264DecodableFrameSize()} for
* information on how MediaCodec determines frame sizes.
*/
@RunWith
(
AndroidJUnit4
.
class
)
public
class
EncoderUtilTest
{
private
static
final
String
MIME_TYPE
=
MimeTypes
.
VIDEO_H264
;
...
...
@@ -102,7 +108,8 @@ public class EncoderUtilTest {
}
@Test
public
void
getSupportedResolution_withWidthTooBig_findsTwoThirdsOfTheOriginalSize
()
{
public
void
getSupportedResolution_findsThreeQuartersOfTheOriginalSize
()
{
// The supported resolution will try to match the aspect ratio where possible.
ImmutableList
<
MediaCodecInfo
>
supportedEncoders
=
EncoderUtil
.
getSupportedEncoders
(
MIME_TYPE
);
MediaCodecInfo
encoderInfo
=
supportedEncoders
.
get
(
0
);
...
...
@@ -116,19 +123,33 @@ public class EncoderUtilTest {
}
@Test
public
void
getSupportedResolution_
withWidthTooBig2_findsHalf
OfTheOriginalSize
()
{
public
void
getSupportedResolution_
findsTwoThirds
OfTheOriginalSize
()
{
ImmutableList
<
MediaCodecInfo
>
supportedEncoders
=
EncoderUtil
.
getSupportedEncoders
(
MIME_TYPE
);
MediaCodecInfo
encoderInfo
=
supportedEncoders
.
get
(
0
);
@Nullable
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
MIME_TYPE
,
3840
,
216
0
);
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
MIME_TYPE
,
2880
,
162
0
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1920
);
assertThat
(
closestSupportedResolution
.
getHeight
()).
isEqualTo
(
1080
);
}
@Test
public
void
getSupportedResolution_findsHalfOfTheOriginalSize
()
{
ImmutableList
<
MediaCodecInfo
>
supportedEncoders
=
EncoderUtil
.
getSupportedEncoders
(
MIME_TYPE
);
MediaCodecInfo
encoderInfo
=
supportedEncoders
.
get
(
0
);
@Nullable
Size
closestSupportedResolution
=
EncoderUtil
.
getSupportedResolution
(
encoderInfo
,
MIME_TYPE
,
2160
,
3840
);
assertThat
(
closestSupportedResolution
).
isNotNull
();
assertThat
(
closestSupportedResolution
.
getWidth
()).
isEqualTo
(
1080
);
assertThat
(
closestSupportedResolution
.
getHeight
()).
isEqualTo
(
1920
);
}
/**
* @see EncoderUtil#getSupportedEncoderNamesForHdrEditing(String, ColorInfo)
*/
...
...
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