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
6e458249
authored
Sep 06, 2022
by
claincly
Committed by
Marc Baechinger
Oct 19, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Include CamcorderProfile resolution in encoder capability test
PiperOrigin-RevId: 472459423
parent
ce0e3a4f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/mh/analysis/EncoderCapabilityAnalysisTest.java
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/mh/analysis/EncoderCapabilityAnalysisTest.java
View file @
6e458249
...
...
@@ -21,6 +21,7 @@ import static android.media.MediaCodecInfo.EncoderCapabilities.BITRATE_MODE_CBR_
import
static
android
.
media
.
MediaCodecInfo
.
EncoderCapabilities
.
BITRATE_MODE_CQ
;
import
static
android
.
media
.
MediaCodecInfo
.
EncoderCapabilities
.
BITRATE_MODE_VBR
;
import
android.media.CamcorderProfile
;
import
android.media.MediaCodecInfo
;
import
android.util.Pair
;
import
android.util.Range
;
...
...
@@ -53,6 +54,44 @@ public class EncoderCapabilityAnalysisTest {
*/
private
static
final
String
FEATURE_EncodingStatistics
=
"encoding-statistics"
;
private
static
final
String
CAMCORDER_FORMAT_STRING
=
"%dx%d@%dfps:%dkbps"
;
private
static
final
String
CAMCORDER_TIMELAPSE_FORMAT_STRING
=
"timelapse_%dx%d@%dfps:%dkbps"
;
private
static
final
String
CAMCORDER_HIGH_SPEED_FORMAT_STRING
=
"highspeed_%dx%d@%dfps:%dkbps"
;
private
static
final
ImmutableList
<
Integer
>
DEFINED_CAMCORDER_PROFILES
=
ImmutableList
.
of
(
CamcorderProfile
.
QUALITY_QCIF
,
CamcorderProfile
.
QUALITY_CIF
,
CamcorderProfile
.
QUALITY_480P
,
CamcorderProfile
.
QUALITY_720P
,
CamcorderProfile
.
QUALITY_1080P
,
CamcorderProfile
.
QUALITY_QVGA
,
CamcorderProfile
.
QUALITY_2160P
,
CamcorderProfile
.
QUALITY_VGA
,
CamcorderProfile
.
QUALITY_4KDCI
,
CamcorderProfile
.
QUALITY_QHD
,
CamcorderProfile
.
QUALITY_2K
,
CamcorderProfile
.
QUALITY_8KUHD
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_QCIF
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_CIF
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_480P
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_720P
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_1080P
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_QVGA
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_2160P
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_VGA
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_4KDCI
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_QHD
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_2K
,
CamcorderProfile
.
QUALITY_TIME_LAPSE_8KUHD
,
CamcorderProfile
.
QUALITY_HIGH_SPEED_480P
,
CamcorderProfile
.
QUALITY_HIGH_SPEED_720P
,
CamcorderProfile
.
QUALITY_HIGH_SPEED_1080P
,
CamcorderProfile
.
QUALITY_HIGH_SPEED_2160P
,
CamcorderProfile
.
QUALITY_HIGH_SPEED_CIF
,
CamcorderProfile
.
QUALITY_HIGH_SPEED_VGA
,
CamcorderProfile
.
QUALITY_HIGH_SPEED_4KDCI
);
@Test
public
void
logEncoderCapabilities
()
throws
Exception
{
ImmutableSet
<
String
>
supportedVideoMimeTypes
=
EncoderUtil
.
getSupportedVideoMimeTypes
();
...
...
@@ -138,6 +177,7 @@ public class EncoderCapabilityAnalysisTest {
JSONObject
resultJson
=
new
JSONObject
();
resultJson
.
put
(
"encoder_capabilities"
,
JSONObject
.
wrap
(
mimeTypeToEncoderInfo
));
resultJson
.
put
(
"camcorder_profiles_supported"
,
getSupportedCamcorderProfileConfigurations
());
AndroidTestUtil
.
writeTestSummaryToFile
(
ApplicationProvider
.
getApplicationContext
(),
/* testId= */
"encoderCapabilityAnalysisTest"
,
...
...
@@ -194,4 +234,26 @@ public class EncoderCapabilityAnalysisTest {
private
static
String
sizeToString
(
@Nullable
Size
size
)
{
return
size
==
null
?
"0x0"
:
Util
.
formatInvariant
(
"%dx%d"
,
size
.
getWidth
(),
size
.
getHeight
());
}
private
static
ImmutableList
<
String
>
getSupportedCamcorderProfileConfigurations
()
{
ImmutableList
.
Builder
<
String
>
supportedConfigurations
=
new
ImmutableList
.
Builder
<>();
for
(
int
profileIndex
:
DEFINED_CAMCORDER_PROFILES
)
{
if
(
CamcorderProfile
.
hasProfile
(
profileIndex
))
{
CamcorderProfile
profile
=
CamcorderProfile
.
get
(
profileIndex
);
supportedConfigurations
.
add
(
Util
.
formatInvariant
(
profileIndex
>
CamcorderProfile
.
QUALITY_HIGH_SPEED_LOW
?
CAMCORDER_HIGH_SPEED_FORMAT_STRING
:
profileIndex
>
CamcorderProfile
.
QUALITY_TIME_LAPSE_LOW
?
CAMCORDER_TIMELAPSE_FORMAT_STRING
:
CAMCORDER_FORMAT_STRING
,
profile
.
videoFrameWidth
,
profile
.
videoFrameHeight
,
profile
.
videoFrameRate
,
// Converts bps to kbps.
profile
.
videoBitRate
/
1000
));
}
}
return
supportedConfigurations
.
build
();
}
}
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