docs: private void handleSetSurfaceTexture(int textureId) throws IOException {
          synchronized (mSurfaceTextureFence) {
              if (mSurfaceTexture != null) {
                  // We're hot-swapping the display EGLContext after
                  // creating the initial SurfaceTexture for camera display
                  mInputWindowSurface.makeCurrent();
                  mSurfaceTexture.detachFromGLContext();
                  // Release the EGLSurface and EGLContext.
                  mInputWindowSurface.releaseEglSurface();
                  mFullScreen.release();
                  mEglCore.release();
  
                  // Create a new EGLContext and recreate the window surface.
                  mEglCore = new EglCore(mEglSaver.getSavedEGLContext(), EglCore.FLAG_RECORDABLE);
                  mInputWindowSurface.recreate(mEglCore);
                  mInputWindowSurface.makeCurrent();
  
                  // Create new programs and such for the new context.
                  mTextureId = textureId;
                  mFullScreen = new FullFrameRect(
                          new Texture2dProgram(Texture2dProgram.ProgramType.TEXTURE_EXT));
                  mFullScreen.getProgram().setTexSize(mSessionConfig.getVideoWidth(), mSessionConfig.getVideoHeight());
                  mIncomingSizeUpdated = true;
                  mSurfaceTexture.attachToGLContext(mTextureId);
                  //mEglSaver.makeNothingCurrent();
              } else {
                  // We're setting up the initial SurfaceTexture
                  prepareEncoder(mEglSaver.getSavedEGLContext(),
                          mSessionConfig.getVideoWidth(),
                          mSessionConfig.getVideoHeight(),
                          mSessionConfig.getVideoBitrate(),
                          mSessionConfig.getMuxer());
                  mTextureId = textureId;
                  mSurfaceTexture = new SurfaceTexture(mTextureId);
                  if (VERBOSE)
                      Log.i(TAG + "-SurfaceTexture", " SurfaceTexture created. pre setOnFrameAvailableListener");
                  mSurfaceTexture.setOnFrameAvailableListener(this);
                  openAndAttachCameraToSurfaceTexture();
                  mReadyForFrames = true;
              }
          }
      }