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
aecc8109
authored
Dec 16, 2022
by
samrobinson
Committed by
Tianyi Feng
Dec 21, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Pass required value into TransformationTestResult.Builder constructor
PiperOrigin-RevId: 495842393
parent
c566b774
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
36 deletions
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformationTestResult.java
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformationTestResult.java
View file @
aecc8109
...
@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.transformer;
...
@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.transformer;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.errorprone.annotations.CanIgnoreReturnValue
;
import
com.google.errorprone.annotations.CanIgnoreReturnValue
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
...
@@ -29,7 +28,7 @@ public class TransformationTestResult {
...
@@ -29,7 +28,7 @@ public class TransformationTestResult {
/** A builder for {@link TransformationTestResult}. */
/** A builder for {@link TransformationTestResult}. */
public
static
class
Builder
{
public
static
class
Builder
{
@Nullable
private
TransformationResult
transformationResult
;
private
final
TransformationResult
transformationResult
;
@Nullable
private
String
filePath
;
@Nullable
private
String
filePath
;
private
long
elapsedTimeMs
;
private
long
elapsedTimeMs
;
private
double
ssim
;
private
double
ssim
;
...
@@ -37,26 +36,13 @@ public class TransformationTestResult {
...
@@ -37,26 +36,13 @@ public class TransformationTestResult {
@Nullable
private
Exception
analysisException
;
@Nullable
private
Exception
analysisException
;
/** Creates a new {@link Builder}. */
/** Creates a new {@link Builder}. */
public
Builder
()
{
public
Builder
(
TransformationResult
transformationResult
)
{
this
.
transformationResult
=
transformationResult
;
this
.
elapsedTimeMs
=
C
.
TIME_UNSET
;
this
.
elapsedTimeMs
=
C
.
TIME_UNSET
;
this
.
ssim
=
SSIM_UNSET
;
this
.
ssim
=
SSIM_UNSET
;
}
}
/**
/**
* Sets the {@link TransformationResult} of the transformation.
*
* <p>This field must be set.
*
* @param transformationResult The {@link TransformationResult}.
* @return This {@link Builder}
*/
@CanIgnoreReturnValue
public
Builder
setTransformationResult
(
TransformationResult
transformationResult
)
{
this
.
transformationResult
=
transformationResult
;
return
this
;
}
/**
* Sets the file path of the output file.
* Sets the file path of the output file.
*
*
* <p>{@code null} represents an unset or unknown value.
* <p>{@code null} represents an unset or unknown value.
...
@@ -130,12 +116,7 @@ public class TransformationTestResult {
...
@@ -130,12 +116,7 @@ public class TransformationTestResult {
/** Builds the {@link TransformationTestResult} instance. */
/** Builds the {@link TransformationTestResult} instance. */
public
TransformationTestResult
build
()
{
public
TransformationTestResult
build
()
{
return
new
TransformationTestResult
(
return
new
TransformationTestResult
(
Assertions
.
checkNotNull
(
transformationResult
),
transformationResult
,
filePath
,
elapsedTimeMs
,
ssim
,
testException
,
analysisException
);
filePath
,
elapsedTimeMs
,
ssim
,
testException
,
analysisException
);
}
}
}
}
...
...
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java
View file @
aecc8109
...
@@ -297,10 +297,7 @@ public class TransformerAndroidTestRunner {
...
@@ -297,10 +297,7 @@ public class TransformerAndroidTestRunner {
// Block here until timeout reached or latch is counted down.
// Block here until timeout reached or latch is counted down.
boolean
timeoutReached
=
!
countDownLatch
.
await
(
timeoutSeconds
,
SECONDS
);
boolean
timeoutReached
=
!
countDownLatch
.
await
(
timeoutSeconds
,
SECONDS
);
long
elapsedTimeMs
=
SystemClock
.
DEFAULT
.
elapsedRealtime
()
-
startTimeMs
;
TransformationTestResult
.
Builder
testResultBuilder
=
new
TransformationTestResult
.
Builder
()
.
setElapsedTimeMs
(
SystemClock
.
DEFAULT
.
elapsedRealtime
()
-
startTimeMs
);
@Nullable
Exception
unexpectedException
=
unexpectedExceptionReference
.
get
();
@Nullable
Exception
unexpectedException
=
unexpectedExceptionReference
.
get
();
@Nullable
@Nullable
...
@@ -319,20 +316,21 @@ public class TransformerAndroidTestRunner {
...
@@ -319,20 +316,21 @@ public class TransformerAndroidTestRunner {
}
}
if
(
testException
!=
null
)
{
if
(
testException
!=
null
)
{
return
testResultBuilder
return
new
TransformationTestResult
.
Builder
(
checkNotNull
(
transformationResultReference
.
get
()))
.
set
TransformationResult
(
checkNotNull
(
transformationResultReference
.
get
())
)
.
set
ElapsedTimeMs
(
elapsedTimeMs
)
.
setTestException
(
testException
)
.
setTestException
(
testException
)
.
build
();
.
build
();
}
}
// No exceptions raised, transformation has succeeded.
// No exceptions raised, transformation has succeeded.
testResultBuilder
TransformationTestResult
.
Builder
testResultBuilder
=
.
setTransformationResult
(
new
TransformationTestResult
.
Builder
(
checkNotNull
(
transformationResultReference
.
get
())
checkNotNull
(
transformationResultReference
.
get
())
.
buildUpon
()
.
buildUpon
()
.
setFileSizeBytes
(
outputVideoFile
.
length
())
.
setFileSizeBytes
(
outputVideoFile
.
length
())
.
build
())
.
build
())
.
setFilePath
(
outputVideoFile
.
getPath
());
.
setElapsedTimeMs
(
elapsedTimeMs
)
.
setFilePath
(
outputVideoFile
.
getPath
());
if
(!
requestCalculateSsim
)
{
if
(!
requestCalculateSsim
)
{
return
testResultBuilder
.
build
();
return
testResultBuilder
.
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