mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08: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 1c172e0bed7937282fca630efde497319f2ae82a)
This commit is contained in:
parent
6e74b1770c
commit
2713f81fd0
@ -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));
|
||||
listener.onError(
|
||||
new VideoFrameProcessingException(
|
||||
"Release timed out. OpenGL resources may not be cleaned up properly."));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user