mirror of
https://github.com/samsonjs/media.git
synced 2026-03-30 10:15:48 +00:00
Effect: Remove extra wait on taskExecutor release()
This future.get() duplicates the wait done in
singleThreadExecutorService.awaitTermination(). If awaitTermination times out, this future.get() would also result in unnecessary blocking.
PiperOrigin-RevId: 536442153
(cherry picked from commit 1c172e0bed)
This commit is contained in:
parent
6e74b1770c
commit
2713f81fd0
1 changed files with 5 additions and 9 deletions
|
|
@ -24,7 +24,6 @@ import androidx.media3.common.VideoFrameProcessor;
|
|||
import androidx.media3.common.util.UnstableApi;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
|
@ -150,16 +149,13 @@ import java.util.concurrent.RejectedExecutionException;
|
|||
shouldCancelTasks = true;
|
||||
highPriorityTasks.clear();
|
||||
}
|
||||
Future<?> releaseFuture =
|
||||
Future<?> unused =
|
||||
wrapTaskAndSubmitToExecutorService(releaseTask, /* isFlushOrReleaseTask= */ true);
|
||||
singleThreadExecutorService.shutdown();
|
||||
try {
|
||||
if (!singleThreadExecutorService.awaitTermination(releaseWaitTimeMs, MILLISECONDS)) {
|
||||
listener.onError(new VideoFrameProcessingException("Release timed out"));
|
||||
}
|
||||
releaseFuture.get();
|
||||
} catch (ExecutionException e) {
|
||||
listener.onError(new VideoFrameProcessingException(e));
|
||||
if (!singleThreadExecutorService.awaitTermination(releaseWaitTimeMs, MILLISECONDS)) {
|
||||
listener.onError(
|
||||
new VideoFrameProcessingException(
|
||||
"Release timed out. OpenGL resources may not be cleaned up properly."));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue