Program: 35730
Project: 35730
Buggy source:
@Override public void run(){
  if (mOutputSurface == null) {
    Log.e(Aavt.debugTag,"String_Node_Str");
    return;
  }
  if (mPreviewWidth <= 0 || mPreviewHeight <= 0) {
    Log.e(Aavt.debugTag,"String_Node_Str");
    return;
  }
  boolean ret=mShowEGLHelper.createGLESWithSurface(new EGLConfigAttrs(),new EGLContextAttrs(),mOutputSurface);
  if (!ret) {
    Log.e(Aavt.debugTag,"String_Node_Str");
    return;
  }
  if (mRenderer == null) {
    mRenderer=new WrapRenderer(null);
  }
  mRenderer.setFlag(WrapRenderer.TYPE_CAMERA);
  mRenderer.create();
  int[] t=new int[1];
  GLES20.glGetIntegerv(GLES20.GL_FRAMEBUFFER_BINDING,t,0);
  mRenderer.sizeChanged(mPreviewWidth,mPreviewHeight);
  GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,t[0]);
  BaseFilter mShowFilter=new LazyFilter();
  BaseFilter mRecFilter=new LazyFilter();
  MatrixUtils.flip(mShowFilter.getVertexMatrix(),false,true);
  mShowFilter.create();
  mShowFilter.sizeChanged(mPreviewWidth,mPreviewHeight);
  MatrixUtils.getMatrix(mRecFilter.getVertexMatrix(),MatrixUtils.TYPE_CENTERCROP,mPreviewWidth,mPreviewHeight,mOutputWidth,mOutputHeight);
  MatrixUtils.flip(mRecFilter.getVertexMatrix(),false,true);
  mRecFilter.create();
  mRecFilter.sizeChanged(mOutputWidth,mOutputHeight);
  FrameBuffer mEncodeFrameBuffer=new FrameBuffer();
  while (mGLThreadFlag) {
    try {
      mSem.acquire();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    if (mGLThreadFlag) {
      long time=(System.currentTimeMillis() - BASE_TIME) * 1000;
      mInputTexture.updateTexImage();
      mInputTexture.getTransformMatrix(mRenderer.getTextureMatrix());
synchronized (VIDEO_LOCK) {
        if (isRecordVideoStarted) {
          if (mEGLEncodeSurface == null) {
            mEGLEncodeSurface=mShowEGLHelper.createWindowSurface(mEncodeSurface);
          }
          mShowEGLHelper.makeCurrent(mEGLEncodeSurface);
          mEncodeFrameBuffer.bindFrameBuffer(mPreviewWidth,mPreviewHeight);
          mRenderer.draw(mInputTextureId);
          mEncodeFrameBuffer.unBindFrameBuffer();
          GLES20.glViewport(0,0,mConfig.getVideoFormat().getInteger(MediaFormat.KEY_WIDTH),mConfig.getVideoFormat().getInteger(MediaFormat.KEY_HEIGHT));
          mRecFilter.draw(mEncodeFrameBuffer.getCacheTextureId());
          mShowEGLHelper.setPresentationTime(mEGLEncodeSurface,time * 1000);
          videoEncodeStep(false);
          mShowEGLHelper.swapBuffers(mEGLEncodeSurface);
          mShowEGLHelper.makeCurrent();
          GLES20.glViewport(0,0,mPreviewWidth,mPreviewHeight);
          mShowFilter.draw(mEncodeFrameBuffer.getCacheTextureId());
          mShowEGLHelper.setPresentationTime(mShowEGLHelper.getDefaultSurface(),0);
          mShowEGLHelper.swapBuffers(mShowEGLHelper.getDefaultSurface());
        }
 else {
          GLES20.glViewport(0,0,mPreviewWidth,mPreviewHeight);
          mRenderer.draw(mInputTextureId);
          mShowEGLHelper.swapBuffers(mShowEGLHelper.getDefaultSurface());
        }
      }
    }
  }
  mShowEGLHelper.destroyGLES(mShowEGLHelper.getDefaultSurface(),mShowEGLHelper.getDefaultContext());
}

Fixed version (ground truth):
@Override public void run(){
  if (mOutputSurface == null) {
    AvLog.d("String_Node_Str");
    return;
  }
  if (mPreviewWidth <= 0 || mPreviewHeight <= 0) {
    AvLog.d("String_Node_Str");
    return;
  }
  boolean ret=mShowEGLHelper.createGLESWithSurface(new EGLConfigAttrs(),new EGLContextAttrs(),mOutputSurface);
  if (!ret) {
    AvLog.d("String_Node_Str");
    return;
  }
  if (mRenderer == null) {
    mRenderer=new WrapRenderer(null);
  }
  mRenderer.setFlag(WrapRenderer.TYPE_CAMERA);
  mRenderer.create();
  int[] t=new int[1];
  GLES20.glGetIntegerv(GLES20.GL_FRAMEBUFFER_BINDING,t,0);
  mRenderer.sizeChanged(mPreviewWidth,mPreviewHeight);
  GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,t[0]);
  BaseFilter mShowFilter=new LazyFilter();
  BaseFilter mRecFilter=new LazyFilter();
  MatrixUtils.flip(mShowFilter.getVertexMatrix(),false,true);
  mShowFilter.create();
  mShowFilter.sizeChanged(mPreviewWidth,mPreviewHeight);
  MatrixUtils.getMatrix(mRecFilter.getVertexMatrix(),MatrixUtils.TYPE_CENTERCROP,mPreviewWidth,mPreviewHeight,mOutputWidth,mOutputHeight);
  MatrixUtils.flip(mRecFilter.getVertexMatrix(),false,true);
  mRecFilter.create();
  mRecFilter.sizeChanged(mOutputWidth,mOutputHeight);
  FrameBuffer mEncodeFrameBuffer=new FrameBuffer();
  while (mGLThreadFlag) {
    try {
      mSem.acquire();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    if (mGLThreadFlag) {
      long time=(System.currentTimeMillis() - BASE_TIME) * 1000;
      mInputTexture.updateTexImage();
      mInputTexture.getTransformMatrix(mRenderer.getTextureMatrix());
synchronized (VIDEO_LOCK) {
        if (isRecordVideoStarted) {
          if (mEGLEncodeSurface == null) {
            mEGLEncodeSurface=mShowEGLHelper.createWindowSurface(mEncodeSurface);
          }
          mShowEGLHelper.makeCurrent(mEGLEncodeSurface);
          mEncodeFrameBuffer.bindFrameBuffer(mPreviewWidth,mPreviewHeight);
          mRenderer.draw(mInputTextureId);
          mEncodeFrameBuffer.unBindFrameBuffer();
          GLES20.glViewport(0,0,mConfig.getVideoFormat().getInteger(MediaFormat.KEY_WIDTH),mConfig.getVideoFormat().getInteger(MediaFormat.KEY_HEIGHT));
          mRecFilter.draw(mEncodeFrameBuffer.getCacheTextureId());
          mShowEGLHelper.setPresentationTime(mEGLEncodeSurface,time * 1000);
          videoEncodeStep(false);
          mShowEGLHelper.swapBuffers(mEGLEncodeSurface);
          mShowEGLHelper.makeCurrent();
          GLES20.glViewport(0,0,mPreviewWidth,mPreviewHeight);
          mShowFilter.draw(mEncodeFrameBuffer.getCacheTextureId());
          mShowEGLHelper.setPresentationTime(mShowEGLHelper.getDefaultSurface(),0);
          mShowEGLHelper.swapBuffers(mShowEGLHelper.getDefaultSurface());
        }
 else {
          GLES20.glViewport(0,0,mPreviewWidth,mPreviewHeight);
          mRenderer.draw(mInputTextureId);
          mShowEGLHelper.swapBuffers(mShowEGLHelper.getDefaultSurface());
        }
      }
    }
  }
  mShowEGLHelper.destroyGLES(mShowEGLHelper.getDefaultSurface(),mShowEGLHelper.getDefaultContext());
}