Effect: Clearly state what callers must do onError.
Instead of invoking "undefined behavior" may occur when a class is used incorrectly, which is clear but not very helpful to callers, specify what Apps or users of a class should do when issues occur. Apply this to Compositor as well, where this otherwise might seem unclear. PiperOrigin-RevId: 563406219
This commit is contained in:
parent
3835aa5344
commit
19878b0b8b
@ -149,7 +149,8 @@ public interface VideoFrameProcessor {
|
|||||||
/**
|
/**
|
||||||
* Called when an exception occurs during asynchronous video frame processing.
|
* Called when an exception occurs during asynchronous video frame processing.
|
||||||
*
|
*
|
||||||
* <p>Using {@code VideoFrameProcessor} after an error happens is undefined behavior.
|
* <p>If this is called, the calling {@link VideoFrameProcessor} must immediately be {@linkplain
|
||||||
|
* VideoFrameProcessor#release() released}.
|
||||||
*/
|
*/
|
||||||
void onError(VideoFrameProcessingException exception);
|
void onError(VideoFrameProcessingException exception);
|
||||||
|
|
||||||
@ -345,6 +346,8 @@ public interface VideoFrameProcessor {
|
|||||||
* <p>This method blocks until all resources are released or releasing times out.
|
* <p>This method blocks until all resources are released or releasing times out.
|
||||||
*
|
*
|
||||||
* <p>Can be called on any thread.
|
* <p>Can be called on any thread.
|
||||||
|
*
|
||||||
|
* <p>This {@link VideoFrameProcessor} instance must not be used after this method is called.
|
||||||
*/
|
*/
|
||||||
void release();
|
void release();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ public interface VideoCompositor extends GlTextureProducer {
|
|||||||
/**
|
/**
|
||||||
* Called when an exception occurs during asynchronous frame compositing.
|
* Called when an exception occurs during asynchronous frame compositing.
|
||||||
*
|
*
|
||||||
* <p>Using {@link VideoCompositor} after an error happens is undefined behavior.
|
* <p>If this is called, the calling {@link VideoCompositor} must immediately be {@linkplain
|
||||||
|
* VideoCompositor#release() released}.
|
||||||
*/
|
*/
|
||||||
void onError(VideoFrameProcessingException exception);
|
void onError(VideoFrameProcessingException exception);
|
||||||
|
|
||||||
@ -87,6 +88,10 @@ public interface VideoCompositor extends GlTextureProducer {
|
|||||||
GlTextureInfo inputTexture,
|
GlTextureInfo inputTexture,
|
||||||
long presentationTimeUs);
|
long presentationTimeUs);
|
||||||
|
|
||||||
/** Releases all resources. */
|
/**
|
||||||
|
* Releases all resources.
|
||||||
|
*
|
||||||
|
* <p>This {@link VideoCompositor} instance must not be used after this method is called.
|
||||||
|
*/
|
||||||
void release();
|
void release();
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ import java.util.concurrent.RejectedExecutionException;
|
|||||||
/**
|
/**
|
||||||
* Called when an exception occurs while executing submitted tasks.
|
* Called when an exception occurs while executing submitted tasks.
|
||||||
*
|
*
|
||||||
* <p>Using the {@link VideoFrameProcessingTaskExecutor} after an error happens is undefined
|
* <p>If this is called, the calling {@link VideoFrameProcessingTaskExecutor} must immediately
|
||||||
* behavior.
|
* be {@linkplain VideoFrameProcessingTaskExecutor#release} released}.
|
||||||
*/
|
*/
|
||||||
void onError(VideoFrameProcessingException exception);
|
void onError(VideoFrameProcessingException exception);
|
||||||
}
|
}
|
||||||
@ -160,6 +160,9 @@ import java.util.concurrent.RejectedExecutionException;
|
|||||||
* <p>If {@code shouldShutdownExecutorService} is {@code true}, shuts down the {@linkplain
|
* <p>If {@code shouldShutdownExecutorService} is {@code true}, shuts down the {@linkplain
|
||||||
* ExecutorService background thread}.
|
* ExecutorService background thread}.
|
||||||
*
|
*
|
||||||
|
* <p>This {@link VideoFrameProcessingTaskExecutor} instance must not be used after this method is
|
||||||
|
* called.
|
||||||
|
*
|
||||||
* @param releaseTask A {@link Task} to execute before shutting down the background thread.
|
* @param releaseTask A {@link Task} to execute before shutting down the background thread.
|
||||||
* @throws InterruptedException If interrupted while releasing resources.
|
* @throws InterruptedException If interrupted while releasing resources.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user