mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Report swallowed exceptions in ExternalTextureManager
The error was swallowed if ExternalTextureManager.removeAllSurfaceTextureFrames was throwing. PiperOrigin-RevId: 668480565
This commit is contained in:
parent
c2e81052e8
commit
070e8217ac
@ -110,6 +110,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
// a frame to arrive on the SurfaceTexture.
|
// a frame to arrive on the SurfaceTexture.
|
||||||
private long firstTryToRemoveAllFramesTimeMs;
|
private long firstTryToRemoveAllFramesTimeMs;
|
||||||
|
|
||||||
|
@Nullable private volatile RuntimeException releaseAllFramesException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance. The caller's thread must have a current GL context.
|
* Creates a new instance. The caller's thread must have a current GL context.
|
||||||
*
|
*
|
||||||
@ -185,6 +187,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
Log.w(TAG, "Interrupted when waiting for MediaCodec frames to arrive.");
|
Log.w(TAG, "Interrupted when waiting for MediaCodec frames to arrive.");
|
||||||
}
|
}
|
||||||
|
if (releaseAllFramesException != null) {
|
||||||
|
throw releaseAllFramesException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -350,7 +355,12 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void releaseAllFramesFromMediaCodec(CountDownLatch latch) {
|
private void releaseAllFramesFromMediaCodec(CountDownLatch latch) {
|
||||||
removeAllSurfaceTextureFrames();
|
try {
|
||||||
|
removeAllSurfaceTextureFrames();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
releaseAllFramesException = e;
|
||||||
|
latch.countDown();
|
||||||
|
}
|
||||||
|
|
||||||
if (pendingFrames.isEmpty()
|
if (pendingFrames.isEmpty()
|
||||||
// Assumes a frame that is registered would not take longer than SURFACE_TEXTURE_TIMEOUT_MS
|
// Assumes a frame that is registered would not take longer than SURFACE_TEXTURE_TIMEOUT_MS
|
||||||
|
@ -284,8 +284,8 @@ import java.util.concurrent.TimeoutException;
|
|||||||
private void handleException(Exception exception) {
|
private void handleException(Exception exception) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (shouldCancelTasks) {
|
if (shouldCancelTasks) {
|
||||||
// Ignore exception after cancelation as it can be caused by a previously reported exception
|
// Ignore exception after cancellation as it can be caused by a previously reported
|
||||||
// that is the reason for the cancelation.
|
// exception that is the reason for the cancellation.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
shouldCancelTasks = true;
|
shouldCancelTasks = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user