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
3055de94
authored
Jan 19, 2023
by
samrobinson
Committed by
christosts
Jan 23, 2023
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Don't use transformationResult with timeout/unexpected exceptions.
PiperOrigin-RevId: 503187291
parent
aa23920e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java
library/transformer/src/androidTest/java/com/google/android/exoplayer2/transformer/TransformerAndroidTestRunner.java
View file @
3055de94
...
...
@@ -211,7 +211,10 @@ public class TransformerAndroidTestRunner {
throw
transformationTestResult
.
analysisException
;
}
return
transformationTestResult
;
}
catch
(
UnsupportedOperationException
|
InterruptedException
|
IOException
e
)
{
}
catch
(
InterruptedException
|
IOException
|
TimeoutException
|
UnsupportedOperationException
e
)
{
resultJson
.
put
(
"transformationResult"
,
new
JSONObject
().
put
(
"testException"
,
AndroidTestUtil
.
exceptionAsJsonObject
(
e
)));
...
...
@@ -227,12 +230,16 @@ public class TransformerAndroidTestRunner {
* @param testId An identifier for the test.
* @param editedMediaItem The {@link EditedMediaItem} to transform.
* @return The {@link TransformationTestResult}.
* @throws IllegalStateException See {@link Transformer#startTransformation(EditedMediaItem,
* String)}.
* @throws InterruptedException If the thread is interrupted whilst waiting for transformer to
* complete.
* @throws IOException If an error occurs opening the output file for writing.
* @throws TimeoutException If the transformation has not completed after {@linkplain
* Builder#setTimeoutSeconds(int) the given timeout}.
*/
private
TransformationTestResult
runInternal
(
String
testId
,
EditedMediaItem
editedMediaItem
)
throws
InterruptedException
,
IOException
{
throws
InterruptedException
,
IOException
,
TimeoutException
{
MediaItem
mediaItem
=
editedMediaItem
.
mediaItem
;
if
(!
mediaItem
.
clippingConfiguration
.
equals
(
MediaItem
.
ClippingConfiguration
.
UNSET
)
&&
requestCalculateSsim
)
{
...
...
@@ -319,31 +326,25 @@ public class TransformerAndroidTestRunner {
});
// Block here until timeout reached or latch is counted down.
boolean
timeoutReached
=
!
countDownLatch
.
await
(
timeoutSeconds
,
SECONDS
);
long
elapsedTimeMs
=
SystemClock
.
DEFAULT
.
elapsedRealtime
()
-
startTimeMs
;
if
(!
countDownLatch
.
await
(
timeoutSeconds
,
SECONDS
))
{
throw
new
TimeoutException
(
"Transformer timed out after "
+
timeoutSeconds
+
" seconds."
);
}
@Nullable
Exception
unexpectedException
=
unexpectedExceptionReference
.
get
();
if
(
unexpectedException
!=
null
)
{
throw
new
IllegalStateException
(
"Unexpected exception starting the transformer."
,
unexpectedException
);
}
long
elapsedTimeMs
=
SystemClock
.
DEFAULT
.
elapsedRealtime
()
-
startTimeMs
;
@Nullable
FallbackDetails
fallbackDetails
=
fallbackDetailsReference
.
get
();
@Nullable
Exception
unexpectedException
=
unexpectedExceptionReference
.
get
();
@Nullable
TransformationException
transformationException
=
transformationExceptionReference
.
get
();
@Nullable
Exception
testException
=
null
;
if
(
timeoutReached
)
{
testException
=
new
TimeoutException
(
"Transformer timed out after "
+
timeoutSeconds
+
" seconds."
);
}
else
if
(
unexpectedException
!=
null
)
{
testException
=
new
IllegalStateException
(
"Unexpected exception starting the transformer."
,
unexpectedException
);
}
else
if
(
transformationException
!=
null
)
{
testException
=
transformationException
;
}
if
(
testException
!=
null
)
{
if
(
transformationException
!=
null
)
{
return
new
TransformationTestResult
.
Builder
(
checkNotNull
(
transformationResultReference
.
get
()))
.
setElapsedTimeMs
(
elapsedTimeMs
)
.
setFallbackDetails
(
fallbackDetails
)
.
setTestException
(
t
est
Exception
)
.
setTestException
(
t
ransformation
Exception
)
.
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