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
d8e5e2de
authored
Mar 31, 2022
by
samrobinson
Committed by
Ian Baker
Apr 06, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Re-use test runner in each loop of RepeatedTranscodeTransformationTest
PiperOrigin-RevId: 438542239
parent
839f342e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
34 deletions
libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/RepeatedTranscodeTransformationTest.java
libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/RepeatedTranscodeTransformationTest.java
View file @
d8e5e2de
...
@@ -40,13 +40,17 @@ public final class RepeatedTranscodeTransformationTest {
...
@@ -40,13 +40,17 @@ public final class RepeatedTranscodeTransformationTest {
@Test
@Test
public
void
repeatedTranscode_givesConsistentLengthOutput
()
throws
Exception
{
public
void
repeatedTranscode_givesConsistentLengthOutput
()
throws
Exception
{
Context
context
=
ApplicationProvider
.
getApplicationContext
();
Context
context
=
ApplicationProvider
.
getApplicationContext
();
Transformer
transformer
=
new
Transformer
.
Builder
(
context
)
TransformerAndroidTestRunner
transformerRunner
=
.
setTransformationRequest
(
new
TransformerAndroidTestRunner
.
Builder
(
new
TransformationRequest
.
Builder
()
context
,
.
setRotationDegrees
(
45
)
new
Transformer
.
Builder
(
context
)
// Video MIME type is H264.
.
setTransformationRequest
(
.
setAudioMimeType
(
MimeTypes
.
AUDIO_AAC
)
new
TransformationRequest
.
Builder
()
.
setRotationDegrees
(
45
)
// Video MIME type is H264.
.
setAudioMimeType
(
MimeTypes
.
AUDIO_AAC
)
.
build
())
.
build
())
.
build
())
.
build
();
.
build
();
...
@@ -54,11 +58,9 @@ public final class RepeatedTranscodeTransformationTest {
...
@@ -54,11 +58,9 @@ public final class RepeatedTranscodeTransformationTest {
for
(
int
i
=
0
;
i
<
TRANSCODE_COUNT
;
i
++)
{
for
(
int
i
=
0
;
i
<
TRANSCODE_COUNT
;
i
++)
{
// Use a long video in case an error occurs a while after the start of the video.
// Use a long video in case an error occurs a while after the start of the video.
TransformationTestResult
testResult
=
TransformationTestResult
testResult
=
new
TransformerAndroidTestRunner
.
Builder
(
context
,
transformer
)
transformerRunner
.
run
(
.
build
()
/* testId= */
"repeatedTranscode_givesConsistentLengthOutput_"
+
i
,
.
run
(
AndroidTestUtil
.
MP4_REMOTE_H264_MP3_URI_STRING
);
/* testId= */
"repeatedTranscode_givesConsistentLengthOutput_"
+
i
,
AndroidTestUtil
.
MP4_REMOTE_H264_MP3_URI_STRING
);
differentOutputSizesBytes
.
add
(
checkNotNull
(
testResult
.
transformationResult
.
fileSizeBytes
));
differentOutputSizesBytes
.
add
(
checkNotNull
(
testResult
.
transformationResult
.
fileSizeBytes
));
}
}
...
@@ -71,13 +73,16 @@ public final class RepeatedTranscodeTransformationTest {
...
@@ -71,13 +73,16 @@ public final class RepeatedTranscodeTransformationTest {
@Test
@Test
public
void
repeatedTranscodeNoAudio_givesConsistentLengthOutput
()
throws
Exception
{
public
void
repeatedTranscodeNoAudio_givesConsistentLengthOutput
()
throws
Exception
{
Context
context
=
ApplicationProvider
.
getApplicationContext
();
Context
context
=
ApplicationProvider
.
getApplicationContext
();
Transformer
transformer
=
TransformerAndroidTestRunner
transformerRunner
=
new
Transformer
.
Builder
(
context
)
new
TransformerAndroidTestRunner
.
Builder
(
.
setRemoveAudio
(
true
)
context
,
.
setTransformationRequest
(
new
Transformer
.
Builder
(
context
)
new
TransformationRequest
.
Builder
()
.
setRemoveAudio
(
true
)
// Video MIME type is H264.
.
setTransformationRequest
(
.
setRotationDegrees
(
45
)
new
TransformationRequest
.
Builder
()
// Video MIME type is H264.
.
setRotationDegrees
(
45
)
.
build
())
.
build
())
.
build
())
.
build
();
.
build
();
...
@@ -85,11 +90,9 @@ public final class RepeatedTranscodeTransformationTest {
...
@@ -85,11 +90,9 @@ public final class RepeatedTranscodeTransformationTest {
for
(
int
i
=
0
;
i
<
TRANSCODE_COUNT
;
i
++)
{
for
(
int
i
=
0
;
i
<
TRANSCODE_COUNT
;
i
++)
{
// Use a long video in case an error occurs a while after the start of the video.
// Use a long video in case an error occurs a while after the start of the video.
TransformationTestResult
testResult
=
TransformationTestResult
testResult
=
new
TransformerAndroidTestRunner
.
Builder
(
context
,
transformer
)
transformerRunner
.
run
(
.
build
()
/* testId= */
"repeatedTranscodeNoAudio_givesConsistentLengthOutput_"
+
i
,
.
run
(
AndroidTestUtil
.
MP4_REMOTE_H264_MP3_URI_STRING
);
/* testId= */
"repeatedTranscodeNoAudio_givesConsistentLengthOutput_"
+
i
,
AndroidTestUtil
.
MP4_REMOTE_H264_MP3_URI_STRING
);
differentOutputSizesBytes
.
add
(
checkNotNull
(
testResult
.
transformationResult
.
fileSizeBytes
));
differentOutputSizesBytes
.
add
(
checkNotNull
(
testResult
.
transformationResult
.
fileSizeBytes
));
}
}
...
@@ -102,22 +105,25 @@ public final class RepeatedTranscodeTransformationTest {
...
@@ -102,22 +105,25 @@ public final class RepeatedTranscodeTransformationTest {
@Test
@Test
public
void
repeatedTranscodeNoVideo_givesConsistentLengthOutput
()
throws
Exception
{
public
void
repeatedTranscodeNoVideo_givesConsistentLengthOutput
()
throws
Exception
{
Context
context
=
ApplicationProvider
.
getApplicationContext
();
Context
context
=
ApplicationProvider
.
getApplicationContext
();
Transformer
transformer
=
TransformerAndroidTestRunner
transformerRunner
=
new
Transformer
.
Builder
(
context
)
new
TransformerAndroidTestRunner
.
Builder
(
.
setRemoveVideo
(
true
)
context
,
.
setTransformationRequest
(
new
Transformer
.
Builder
(
context
)
new
TransformationRequest
.
Builder
().
setAudioMimeType
(
MimeTypes
.
AUDIO_AAC
).
build
())
.
setRemoveVideo
(
true
)
.
setTransformationRequest
(
new
TransformationRequest
.
Builder
()
.
setAudioMimeType
(
MimeTypes
.
AUDIO_AAC
)
.
build
())
.
build
())
.
build
();
.
build
();
Set
<
Long
>
differentOutputSizesBytes
=
new
HashSet
<>();
Set
<
Long
>
differentOutputSizesBytes
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
TRANSCODE_COUNT
;
i
++)
{
for
(
int
i
=
0
;
i
<
TRANSCODE_COUNT
;
i
++)
{
// Use a long video in case an error occurs a while after the start of the video.
// Use a long video in case an error occurs a while after the start of the video.
TransformationTestResult
testResult
=
TransformationTestResult
testResult
=
new
TransformerAndroidTestRunner
.
Builder
(
context
,
transformer
)
transformerRunner
.
run
(
.
build
()
/* testId= */
"repeatedTranscodeNoVideo_givesConsistentLengthOutput_"
+
i
,
.
run
(
AndroidTestUtil
.
MP4_REMOTE_H264_MP3_URI_STRING
);
/* testId= */
"repeatedTranscodeNoVideo_givesConsistentLengthOutput_"
+
i
,
AndroidTestUtil
.
MP4_REMOTE_H264_MP3_URI_STRING
);
differentOutputSizesBytes
.
add
(
checkNotNull
(
testResult
.
transformationResult
.
fileSizeBytes
));
differentOutputSizesBytes
.
add
(
checkNotNull
(
testResult
.
transformationResult
.
fileSizeBytes
));
}
}
...
...
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