mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Prevent repeated release of the same EGLContext
All instances of PlaybackVideoGraphWrapper use the same VIDEO_FRAME_PROCESSOR_FACTORY_SUPPLIER which uses the same DefaultGlObjectsProvider. Each call to DefaultGlObjectsProvider.release() releases all previously created EGLContexts. Lazily create a new DefaultGlObjectsProvider for each DefaultVideoFrameProcessor (not one per factory). PiperOrigin-RevId: 693658458
This commit is contained in:
parent
ab723fc8ff
commit
f9fd8badec
@ -327,7 +327,7 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
|
||||
return new DefaultVideoFrameProcessor.Factory(
|
||||
sdrWorkingColorSpace,
|
||||
/* repeatLastRegisteredFrame= */ !requireRegisteringAllInputFrames,
|
||||
glObjectsProvider == null ? new DefaultGlObjectsProvider() : glObjectsProvider,
|
||||
glObjectsProvider,
|
||||
executorService,
|
||||
textureOutputListener,
|
||||
textureOutputCapacity,
|
||||
@ -338,7 +338,7 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
|
||||
|
||||
private final @WorkingColorSpace int sdrWorkingColorSpace;
|
||||
private final boolean repeatLastRegisteredFrame;
|
||||
private final GlObjectsProvider glObjectsProvider;
|
||||
@Nullable private final GlObjectsProvider glObjectsProvider;
|
||||
@Nullable private final ExecutorService executorService;
|
||||
@Nullable private final GlTextureProducer.Listener textureOutputListener;
|
||||
private final int textureOutputCapacity;
|
||||
@ -348,7 +348,7 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
|
||||
private Factory(
|
||||
@WorkingColorSpace int sdrWorkingColorSpace,
|
||||
boolean repeatLastRegisteredFrame,
|
||||
GlObjectsProvider glObjectsProvider,
|
||||
@Nullable GlObjectsProvider glObjectsProvider,
|
||||
@Nullable ExecutorService executorService,
|
||||
@Nullable GlTextureProducer.Listener textureOutputListener,
|
||||
int textureOutputCapacity,
|
||||
@ -411,6 +411,9 @@ public final class DefaultVideoFrameProcessor implements VideoFrameProcessor {
|
||||
new VideoFrameProcessingTaskExecutor(
|
||||
instanceExecutorService, shouldShutdownExecutorService, listener::onError);
|
||||
|
||||
GlObjectsProvider glObjectsProvider =
|
||||
this.glObjectsProvider == null ? new DefaultGlObjectsProvider() : this.glObjectsProvider;
|
||||
|
||||
Future<DefaultVideoFrameProcessor> defaultVideoFrameProcessorFuture =
|
||||
instanceExecutorService.submit(
|
||||
() ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user