Add Thread.currentThread().interrupt() for InterruptedExceptions.

PiperOrigin-RevId: 549975878
This commit is contained in:
huangdarwin 2023-07-21 17:59:07 +01:00 committed by Rohit Singh
parent 5858723a06
commit d7b5ab9f23
9 changed files with 23 additions and 6 deletions

View File

@ -112,6 +112,7 @@ public final class DefaultVideoFrameProcessorVideoFrameRenderingTest {
// to swap buffers, to avoid this behavior.
Thread.sleep(PER_FRAME_RENDERING_WAIT_TIME_MS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IllegalStateException(e);
}
},
@ -228,6 +229,7 @@ public final class DefaultVideoFrameProcessorVideoFrameRenderingTest {
// to swap buffers, to avoid this behavior.
Thread.sleep(PER_FRAME_RENDERING_WAIT_TIME_MS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IllegalStateException(e);
}
},

View File

@ -146,7 +146,10 @@ public abstract class BitmapOverlay extends TextureOverlay {
ListenableFuture<Bitmap> future = bitmapLoader.loadBitmap(overlayBitmapUri);
try {
lastBitmap = future.get();
} catch (ExecutionException | InterruptedException e) {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new VideoFrameProcessingException(e);
} catch (ExecutionException e) {
throw new VideoFrameProcessingException(e);
}
}

View File

@ -202,10 +202,13 @@ public class TransformerAndroidTestRunner {
throw exportTestResult.analysisException;
}
return exportTestResult;
} catch (InterruptedException
| IOException
| TimeoutException
| UnsupportedOperationException e) {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
resultJson.put(
"exportResult",
new JSONObject().put("testException", AndroidTestUtil.exceptionAsJsonObject(e)));
throw e;
} catch (IOException | TimeoutException | UnsupportedOperationException e) {
resultJson.put(
"exportResult",
new JSONObject().put("testException", AndroidTestUtil.exceptionAsJsonObject(e)));
@ -404,6 +407,7 @@ public class TransformerAndroidTestRunner {
/* distortedVideoPath= */ outputVideoFile.getPath());
testResultBuilder.setSsim(ssim);
} catch (InterruptedException interruptedException) {
Thread.currentThread().interrupt();
// InterruptedException is a special unexpected case because it is not related to Ssim
// calculation, so it should be thrown, rather than processed as part of the
// ExportTestResult.

View File

@ -558,6 +558,7 @@ public final class DefaultVideoFrameProcessorTextureOutputPixelTest {
try {
videoFrameProcessorTestRunner.endFrameProcessing(VIDEO_FRAME_PROCESSING_WAIT_MS / 2);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new VideoFrameProcessingException(e);
}
releaseOutputTextureCallback.release(presentationTimeUs);

View File

@ -46,7 +46,10 @@ import java.util.concurrent.ExecutionException;
trackGroupArray =
MetadataRetriever.retrieveMetadata(context, MediaItem.fromUri("file://" + filePath))
.get();
} catch (ExecutionException | InterruptedException e) {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IllegalStateException(e);
} catch (ExecutionException e) {
throw new IllegalStateException(e);
}

View File

@ -116,6 +116,7 @@ public class ExoPlayerAssetLoaderTest {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
exceptionRef.set(e);
}
}

View File

@ -94,6 +94,7 @@ public class ImageAssetLoaderTest {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
exceptionRef.set(e);
}
}

View File

@ -1239,6 +1239,7 @@ public final class MediaItemExportTest {
try {
Thread.sleep(delayBetweenReadsMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IllegalStateException(e);
}
return extractor.read(input, seekPosition);

View File

@ -95,6 +95,7 @@ public class TextureAssetLoaderTest {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
exceptionRef.set(e);
}
}