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
a010ebf7
authored
Jan 24, 2023
by
samrobinson
Committed by
christosts
Jan 25, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Consolidate TransformationResult.transformationException test usage.
PiperOrigin-RevId: 504257627
parent
1f9a3327
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
37 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 @
a010ebf7
...
@@ -37,7 +37,6 @@ public class TransformationTestResult {
...
@@ -37,7 +37,6 @@ public class TransformationTestResult {
private
long
elapsedTimeMs
;
private
long
elapsedTimeMs
;
private
double
ssim
;
private
double
ssim
;
@Nullable
private
FallbackDetails
fallbackDetails
;
@Nullable
private
FallbackDetails
fallbackDetails
;
@Nullable
private
Exception
testException
;
@Nullable
private
Exception
analysisException
;
@Nullable
private
Exception
analysisException
;
/** Creates a new {@link Builder}. */
/** Creates a new {@link Builder}. */
...
@@ -106,20 +105,6 @@ public class TransformationTestResult {
...
@@ -106,20 +105,6 @@ public class TransformationTestResult {
}
}
/**
/**
* Sets an {@link Exception} that occurred during the test.
*
* <p>{@code null} represents an unset or unknown value.
*
* @param testException The {@link Exception} thrown during the test.
* @return This {@link Builder}.
*/
@CanIgnoreReturnValue
public
Builder
setTestException
(
@Nullable
Exception
testException
)
{
this
.
testException
=
testException
;
return
this
;
}
/**
* Sets an {@link Exception} that occurred during post-transformation analysis.
* Sets an {@link Exception} that occurred during post-transformation analysis.
*
*
* <p>{@code null} represents an unset or unknown value.
* <p>{@code null} represents an unset or unknown value.
...
@@ -136,13 +121,7 @@ public class TransformationTestResult {
...
@@ -136,13 +121,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
(
transformationResult
,
transformationResult
,
filePath
,
elapsedTimeMs
,
ssim
,
fallbackDetails
,
analysisException
);
filePath
,
elapsedTimeMs
,
ssim
,
fallbackDetails
,
testException
,
analysisException
);
}
}
}
}
...
@@ -167,8 +146,6 @@ public class TransformationTestResult {
...
@@ -167,8 +146,6 @@ public class TransformationTestResult {
* {@code null} if no fallback occurred.
* {@code null} if no fallback occurred.
*/
*/
@Nullable
public
final
FallbackDetails
fallbackDetails
;
@Nullable
public
final
FallbackDetails
fallbackDetails
;
/** The {@link Exception} thrown during the test, or {@code null} if nothing was thrown. */
@Nullable
public
final
Exception
testException
;
/**
/**
* The {@link Exception} thrown during post-transformation analysis, or {@code null} if nothing
* The {@link Exception} thrown during post-transformation analysis, or {@code null} if nothing
* was thrown.
* was thrown.
...
@@ -187,7 +164,9 @@ public class TransformationTestResult {
...
@@ -187,7 +164,9 @@ public class TransformationTestResult {
.
putOpt
(
"colorInfo"
,
transformationResult
.
colorInfo
)
.
putOpt
(
"colorInfo"
,
transformationResult
.
colorInfo
)
.
putOpt
(
"videoDecoderName"
,
transformationResult
.
videoDecoderName
)
.
putOpt
(
"videoDecoderName"
,
transformationResult
.
videoDecoderName
)
.
putOpt
(
"videoEncoderName"
,
transformationResult
.
videoEncoderName
)
.
putOpt
(
"videoEncoderName"
,
transformationResult
.
videoEncoderName
)
.
putOpt
(
"testException"
,
exceptionAsJsonObject
(
testException
))
.
putOpt
(
"testException"
,
exceptionAsJsonObject
(
transformationResult
.
transformationException
))
.
putOpt
(
"analysisException"
,
exceptionAsJsonObject
(
analysisException
));
.
putOpt
(
"analysisException"
,
exceptionAsJsonObject
(
analysisException
));
if
(
transformationResult
.
averageAudioBitrate
!=
C
.
RATE_UNSET_INT
)
{
if
(
transformationResult
.
averageAudioBitrate
!=
C
.
RATE_UNSET_INT
)
{
...
@@ -238,14 +217,12 @@ public class TransformationTestResult {
...
@@ -238,14 +217,12 @@ public class TransformationTestResult {
long
elapsedTimeMs
,
long
elapsedTimeMs
,
double
ssim
,
double
ssim
,
@Nullable
FallbackDetails
fallbackDetails
,
@Nullable
FallbackDetails
fallbackDetails
,
@Nullable
Exception
testException
,
@Nullable
Exception
analysisException
)
{
@Nullable
Exception
analysisException
)
{
this
.
transformationResult
=
transformationResult
;
this
.
transformationResult
=
transformationResult
;
this
.
filePath
=
filePath
;
this
.
filePath
=
filePath
;
this
.
elapsedTimeMs
=
elapsedTimeMs
;
this
.
elapsedTimeMs
=
elapsedTimeMs
;
this
.
ssim
=
ssim
;
this
.
ssim
=
ssim
;
this
.
fallbackDetails
=
fallbackDetails
;
this
.
fallbackDetails
=
fallbackDetails
;
this
.
testException
=
testException
;
this
.
analysisException
=
analysisException
;
this
.
analysisException
=
analysisException
;
this
.
throughputFps
=
this
.
throughputFps
=
elapsedTimeMs
!=
C
.
TIME_UNSET
&&
transformationResult
.
videoFrameCount
>
0
elapsedTimeMs
!=
C
.
TIME_UNSET
&&
transformationResult
.
videoFrameCount
>
0
...
...
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java
View file @
a010ebf7
...
@@ -204,8 +204,8 @@ public class TransformerAndroidTestRunner {
...
@@ -204,8 +204,8 @@ public class TransformerAndroidTestRunner {
try
{
try
{
TransformationTestResult
transformationTestResult
=
runInternal
(
testId
,
editedMediaItem
);
TransformationTestResult
transformationTestResult
=
runInternal
(
testId
,
editedMediaItem
);
resultJson
.
put
(
"transformationResult"
,
transformationTestResult
.
asJsonObject
());
resultJson
.
put
(
"transformationResult"
,
transformationTestResult
.
asJsonObject
());
if
(
transformationTestResult
.
t
est
Exception
!=
null
)
{
if
(
transformationTestResult
.
t
ransformationResult
.
transformation
Exception
!=
null
)
{
throw
transformationTestResult
.
t
est
Exception
;
throw
transformationTestResult
.
t
ransformationResult
.
transformation
Exception
;
}
}
if
(!
suppressAnalysisExceptions
&&
transformationTestResult
.
analysisException
!=
null
)
{
if
(!
suppressAnalysisExceptions
&&
transformationTestResult
.
analysisException
!=
null
)
{
throw
transformationTestResult
.
analysisException
;
throw
transformationTestResult
.
analysisException
;
...
@@ -257,8 +257,6 @@ public class TransformerAndroidTestRunner {
...
@@ -257,8 +257,6 @@ public class TransformerAndroidTestRunner {
AtomicReference
<
@NullableType
FallbackDetails
>
fallbackDetailsReference
=
AtomicReference
<
@NullableType
FallbackDetails
>
fallbackDetailsReference
=
new
AtomicReference
<>();
new
AtomicReference
<>();
AtomicReference
<
@NullableType
TransformationException
>
transformationExceptionReference
=
new
AtomicReference
<>();
AtomicReference
<
@NullableType
Exception
>
unexpectedExceptionReference
=
new
AtomicReference
<>();
AtomicReference
<
@NullableType
Exception
>
unexpectedExceptionReference
=
new
AtomicReference
<>();
AtomicReference
<
@NullableType
TransformationResult
>
transformationResultReference
=
AtomicReference
<
@NullableType
TransformationResult
>
transformationResultReference
=
new
AtomicReference
<>();
new
AtomicReference
<>();
...
@@ -282,7 +280,6 @@ public class TransformerAndroidTestRunner {
...
@@ -282,7 +280,6 @@ public class TransformerAndroidTestRunner {
MediaItem
inputMediaItem
,
MediaItem
inputMediaItem
,
TransformationResult
result
,
TransformationResult
result
,
TransformationException
exception
)
{
TransformationException
exception
)
{
transformationExceptionReference
.
set
(
exception
);
transformationResultReference
.
set
(
result
);
transformationResultReference
.
set
(
result
);
countDownLatch
.
countDown
();
countDownLatch
.
countDown
();
}
}
...
@@ -337,14 +334,12 @@ public class TransformerAndroidTestRunner {
...
@@ -337,14 +334,12 @@ public class TransformerAndroidTestRunner {
long
elapsedTimeMs
=
SystemClock
.
DEFAULT
.
elapsedRealtime
()
-
startTimeMs
;
long
elapsedTimeMs
=
SystemClock
.
DEFAULT
.
elapsedRealtime
()
-
startTimeMs
;
@Nullable
FallbackDetails
fallbackDetails
=
fallbackDetailsReference
.
get
();
@Nullable
FallbackDetails
fallbackDetails
=
fallbackDetailsReference
.
get
();
@Nullable
TransformationResult
transformationResult
=
checkNotNull
(
transformationResultReference
.
get
());
TransformationException
transformationException
=
transformationExceptionReference
.
get
();
if
(
transformationException
!=
null
)
{
if
(
transformation
Result
.
transformation
Exception
!=
null
)
{
return
new
TransformationTestResult
.
Builder
(
checkNotNull
(
transformationResultReference
.
get
())
)
return
new
TransformationTestResult
.
Builder
(
transformationResult
)
.
setElapsedTimeMs
(
elapsedTimeMs
)
.
setElapsedTimeMs
(
elapsedTimeMs
)
.
setFallbackDetails
(
fallbackDetails
)
.
setFallbackDetails
(
fallbackDetails
)
.
setTestException
(
transformationException
)
.
build
();
.
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