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 {
private
long
elapsedTimeMs
;
private
double
ssim
;
@Nullable
private
FallbackDetails
fallbackDetails
;
@Nullable
private
Exception
testException
;
@Nullable
private
Exception
analysisException
;
/** Creates a new {@link Builder}. */
...
...
@@ -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.
*
* <p>{@code null} represents an unset or unknown value.
...
...
@@ -136,13 +121,7 @@ public class TransformationTestResult {
/** Builds the {@link TransformationTestResult} instance. */
public
TransformationTestResult
build
()
{
return
new
TransformationTestResult
(
transformationResult
,
filePath
,
elapsedTimeMs
,
ssim
,
fallbackDetails
,
testException
,
analysisException
);
transformationResult
,
filePath
,
elapsedTimeMs
,
ssim
,
fallbackDetails
,
analysisException
);
}
}
...
...
@@ -167,8 +146,6 @@ public class TransformationTestResult {
* {@code null} if no fallback occurred.
*/
@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
* was thrown.
...
...
@@ -187,7 +164,9 @@ public class TransformationTestResult {
.
putOpt
(
"colorInfo"
,
transformationResult
.
colorInfo
)
.
putOpt
(
"videoDecoderName"
,
transformationResult
.
videoDecoderName
)
.
putOpt
(
"videoEncoderName"
,
transformationResult
.
videoEncoderName
)
.
putOpt
(
"testException"
,
exceptionAsJsonObject
(
testException
))
.
putOpt
(
"testException"
,
exceptionAsJsonObject
(
transformationResult
.
transformationException
))
.
putOpt
(
"analysisException"
,
exceptionAsJsonObject
(
analysisException
));
if
(
transformationResult
.
averageAudioBitrate
!=
C
.
RATE_UNSET_INT
)
{
...
...
@@ -238,14 +217,12 @@ public class TransformationTestResult {
long
elapsedTimeMs
,
double
ssim
,
@Nullable
FallbackDetails
fallbackDetails
,
@Nullable
Exception
testException
,
@Nullable
Exception
analysisException
)
{
this
.
transformationResult
=
transformationResult
;
this
.
filePath
=
filePath
;
this
.
elapsedTimeMs
=
elapsedTimeMs
;
this
.
ssim
=
ssim
;
this
.
fallbackDetails
=
fallbackDetails
;
this
.
testException
=
testException
;
this
.
analysisException
=
analysisException
;
this
.
throughputFps
=
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 {
try
{
TransformationTestResult
transformationTestResult
=
runInternal
(
testId
,
editedMediaItem
);
resultJson
.
put
(
"transformationResult"
,
transformationTestResult
.
asJsonObject
());
if
(
transformationTestResult
.
t
est
Exception
!=
null
)
{
throw
transformationTestResult
.
t
est
Exception
;
if
(
transformationTestResult
.
t
ransformationResult
.
transformation
Exception
!=
null
)
{
throw
transformationTestResult
.
t
ransformationResult
.
transformation
Exception
;
}
if
(!
suppressAnalysisExceptions
&&
transformationTestResult
.
analysisException
!=
null
)
{
throw
transformationTestResult
.
analysisException
;
...
...
@@ -257,8 +257,6 @@ public class TransformerAndroidTestRunner {
AtomicReference
<
@NullableType
FallbackDetails
>
fallbackDetailsReference
=
new
AtomicReference
<>();
AtomicReference
<
@NullableType
TransformationException
>
transformationExceptionReference
=
new
AtomicReference
<>();
AtomicReference
<
@NullableType
Exception
>
unexpectedExceptionReference
=
new
AtomicReference
<>();
AtomicReference
<
@NullableType
TransformationResult
>
transformationResultReference
=
new
AtomicReference
<>();
...
...
@@ -282,7 +280,6 @@ public class TransformerAndroidTestRunner {
MediaItem
inputMediaItem
,
TransformationResult
result
,
TransformationException
exception
)
{
transformationExceptionReference
.
set
(
exception
);
transformationResultReference
.
set
(
result
);
countDownLatch
.
countDown
();
}
...
...
@@ -337,14 +334,12 @@ public class TransformerAndroidTestRunner {
long
elapsedTimeMs
=
SystemClock
.
DEFAULT
.
elapsedRealtime
()
-
startTimeMs
;
@Nullable
FallbackDetails
fallbackDetails
=
fallbackDetailsReference
.
get
();
@Nullable
TransformationException
transformationException
=
transformationExceptionReference
.
get
();
TransformationResult
transformationResult
=
checkNotNull
(
transformationResultReference
.
get
());
if
(
transformationException
!=
null
)
{
return
new
TransformationTestResult
.
Builder
(
checkNotNull
(
transformationResultReference
.
get
())
)
if
(
transformation
Result
.
transformation
Exception
!=
null
)
{
return
new
TransformationTestResult
.
Builder
(
transformationResult
)
.
setElapsedTimeMs
(
elapsedTimeMs
)
.
setFallbackDetails
(
fallbackDetails
)
.
setTestException
(
transformationException
)
.
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