Effect: Move common statement out of switch/case

PiperOrigin-RevId: 570323141
This commit is contained in:
huangdarwin 2023-10-03 02:35:09 -07:00 committed by Copybara-Service
parent 8953f26a5c
commit fa51f8cd4d

View file

@ -111,7 +111,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
textureManager = textureManager =
new ExternalTextureManager( new ExternalTextureManager(
glObjectsProvider, samplingShaderProgram, videoFrameProcessingTaskExecutor); glObjectsProvider, samplingShaderProgram, videoFrameProcessingTaskExecutor);
inputs.put(inputType, new Input(textureManager, samplingShaderProgram));
break; break;
case INPUT_TYPE_BITMAP: case INPUT_TYPE_BITMAP:
samplingShaderProgram = samplingShaderProgram =
@ -128,7 +127,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
textureManager = textureManager =
new BitmapTextureManager( new BitmapTextureManager(
glObjectsProvider, samplingShaderProgram, videoFrameProcessingTaskExecutor); glObjectsProvider, samplingShaderProgram, videoFrameProcessingTaskExecutor);
inputs.put(inputType, new Input(textureManager, samplingShaderProgram));
break; break;
case INPUT_TYPE_TEXTURE_ID: case INPUT_TYPE_TEXTURE_ID:
samplingShaderProgram = samplingShaderProgram =
@ -145,11 +143,11 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
textureManager = textureManager =
new TexIdTextureManager( new TexIdTextureManager(
glObjectsProvider, samplingShaderProgram, videoFrameProcessingTaskExecutor); glObjectsProvider, samplingShaderProgram, videoFrameProcessingTaskExecutor);
inputs.put(inputType, new Input(textureManager, samplingShaderProgram));
break; break;
default: default:
throw new VideoFrameProcessingException("Unsupported input type " + inputType); throw new VideoFrameProcessingException("Unsupported input type " + inputType);
} }
inputs.put(inputType, new Input(textureManager, samplingShaderProgram));
} }
/** Sets the {@link GlShaderProgram} that {@code InputSwitcher} outputs to. */ /** Sets the {@link GlShaderProgram} that {@code InputSwitcher} outputs to. */