Check thread name for GL methods.
The thread name is used to verify the thread in both createOpenGlObjectsAndInitializeFrameProcessors() and processFrame(). Also remove glThread field that was only used for this verification. PiperOrigin-RevId: 437730804
This commit is contained in:
parent
1b52739dfb
commit
827cf51dc9
@ -72,8 +72,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
private final EGLContext eglContext;
|
private final EGLContext eglContext;
|
||||||
/** Some OpenGL commands may block, so all OpenGL commands are run on a background thread. */
|
/** Some OpenGL commands may block, so all OpenGL commands are run on a background thread. */
|
||||||
private final ExecutorService singleThreadExecutorService;
|
private final ExecutorService singleThreadExecutorService;
|
||||||
/** The {@link #singleThreadExecutorService} thread. */
|
|
||||||
private @MonotonicNonNull Thread glThread;
|
|
||||||
/** Futures corresponding to the executor service's pending tasks. */
|
/** Futures corresponding to the executor service's pending tasks. */
|
||||||
private final ConcurrentLinkedQueue<Future<?>> futures;
|
private final ConcurrentLinkedQueue<Future<?>> futures;
|
||||||
/** Number of frames {@link #registerInputFrame() registered} but not fully processed. */
|
/** Number of frames {@link #registerInputFrame() registered} but not fully processed. */
|
||||||
@ -355,7 +353,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
@EnsuresNonNull("eglSurface")
|
@EnsuresNonNull("eglSurface")
|
||||||
private Void createOpenGlObjectsAndInitializeFrameProcessors(
|
private Void createOpenGlObjectsAndInitializeFrameProcessors(
|
||||||
Surface outputSurface, @Nullable SurfaceView debugSurfaceView) throws IOException {
|
Surface outputSurface, @Nullable SurfaceView debugSurfaceView) throws IOException {
|
||||||
glThread = Thread.currentThread();
|
checkState(Thread.currentThread().getName().equals(THREAD_NAME));
|
||||||
|
|
||||||
if (enableExperimentalHdrEditing) {
|
if (enableExperimentalHdrEditing) {
|
||||||
// TODO(b/209404935): Don't assume BT.2020 PQ input/output.
|
// TODO(b/209404935): Don't assume BT.2020 PQ input/output.
|
||||||
eglSurface = GlUtil.getEglSurfaceBt2020Pq(eglDisplay, outputSurface);
|
eglSurface = GlUtil.getEglSurfaceBt2020Pq(eglDisplay, outputSurface);
|
||||||
@ -396,7 +395,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
*/
|
*/
|
||||||
@RequiresNonNull({"inputSurfaceTexture", "eglSurface"})
|
@RequiresNonNull({"inputSurfaceTexture", "eglSurface"})
|
||||||
private void processFrame() {
|
private void processFrame() {
|
||||||
checkState(Thread.currentThread().equals(glThread));
|
checkState(Thread.currentThread().getName().equals(THREAD_NAME));
|
||||||
|
|
||||||
if (frameProcessors.isEmpty()) {
|
if (frameProcessors.isEmpty()) {
|
||||||
GlUtil.focusEglSurface(eglDisplay, eglContext, eglSurface, outputWidth, outputHeight);
|
GlUtil.focusEglSurface(eglDisplay, eglContext, eglSurface, outputWidth, outputHeight);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user