Program: 38155
Project: 38155
Buggy source:
private void startRecordingVideo(int cameraId){
  if (null == mCameraDevice[cameraId]) {
    return;
  }
  Log.d(TAG,"String_Node_Str" + cameraId);
  mIsRecordingVideo=true;
  mMediaRecorderPausing=false;
  mUI.hideUIwhileRecording();
  mUI.clearFocus();
  mCameraHandler.removeMessages(CANCEL_TOUCH_FOCUS,cameraId);
  mState[cameraId]=STATE_PREVIEW;
  mControlAFMode=CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
  closePreviewSession();
  mFrameProcessor.onClose();
  boolean changed=mUI.setPreviewSize(mVideoSize.getWidth(),mVideoSize.getHeight());
  if (changed) {
    mUI.hideSurfaceView();
    mUI.showSurfaceView();
  }
  try {
    setUpMediaRecorder(cameraId);
    createVideoSnapshotImageReader();
    final CaptureRequest.Builder mPreviewBuilder=mCameraDevice[cameraId].createCaptureRequest(CameraDevice.TEMPLATE_RECORD);
    List<Surface> surfaces=new ArrayList<>();
    Surface surface=getPreviewSurfaceForSession(cameraId);
    mFrameProcessor.init(mVideoSize);
    if (mFrameProcessor.isFrameFilterEnabled()) {
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          mUI.getSurfaceHolder().setFixedSize(mVideoSize.getHeight(),mVideoSize.getWidth());
        }
      }
);
    }
    mFrameProcessor.setOutputSurface(surface);
    mFrameProcessor.setVideoOutputSurface(mMediaRecorder.getSurface());
    addPreviewSurface(mPreviewBuilder,surfaces,cameraId);
    if (!mHighSpeedCapture)     surfaces.add(mVideoSnapshotImageReader.getSurface());
 else     mPreviewBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE,mHighSpeedFPSRange);
    if (!mHighSpeedCapture) {
      mCameraDevice[cameraId].createCaptureSession(surfaces,new CameraCaptureSession.StateCallback(){
        @Override public void onConfigured(        CameraCaptureSession cameraCaptureSession){
          Log.d(TAG,"String_Node_Str");
          mCurrentSession=cameraCaptureSession;
          try {
            setUpVideoCaptureRequestBuilder(mPreviewBuilder);
            mCurrentSession.setRepeatingRequest(mPreviewBuilder.build(),null,mCameraHandler);
          }
 catch (          CameraAccessException e) {
            e.printStackTrace();
          }
          mMediaRecorder.start();
          mUI.clearFocus();
          mUI.resetPauseButton();
          mRecordingTotalTime=0L;
          mRecordingStartTime=SystemClock.uptimeMillis();
          mUI.showRecordingUI(true);
          updateRecordingTime();
        }
        @Override public void onConfigureFailed(        CameraCaptureSession cameraCaptureSession){
          Toast.makeText(mActivity,"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
      }
,null);
    }
 else {
      mCameraDevice[cameraId].createConstrainedHighSpeedCaptureSession(surfaces,new CameraConstrainedHighSpeedCaptureSession.StateCallback(){
        @Override public void onConfigured(        CameraCaptureSession cameraCaptureSession){
          mCurrentSession=cameraCaptureSession;
          CameraConstrainedHighSpeedCaptureSession session=(CameraConstrainedHighSpeedCaptureSession)mCurrentSession;
          try {
            List list=session.createHighSpeedRequestList(mPreviewBuilder.build());
            session.setRepeatingBurst(list,null,mCameraHandler);
          }
 catch (          CameraAccessException e) {
            Log.e(TAG,"String_Node_Str" + e.getMessage());
            e.printStackTrace();
          }
catch (          IllegalArgumentException e) {
            Log.e(TAG,"String_Node_Str" + e.getMessage());
            e.printStackTrace();
          }
catch (          IllegalStateException e) {
            Log.e(TAG,"String_Node_Str" + e.getMessage());
            e.printStackTrace();
          }
          mMediaRecorder.start();
          mUI.clearFocus();
          mUI.resetPauseButton();
          mRecordingTotalTime=0L;
          mRecordingStartTime=SystemClock.uptimeMillis();
          mUI.showRecordingUI(true);
          updateRecordingTime();
        }
        @Override public void onConfigureFailed(        CameraCaptureSession cameraCaptureSession){
          Toast.makeText(mActivity,"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
      }
,null);
    }
  }
 catch (  CameraAccessException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void startRecordingVideo(int cameraId){
  if (null == mCameraDevice[cameraId]) {
    return;
  }
  Log.d(TAG,"String_Node_Str" + cameraId);
  mIsRecordingVideo=true;
  mMediaRecorderPausing=false;
  mUI.hideUIwhileRecording();
  mUI.clearFocus();
  mCameraHandler.removeMessages(CANCEL_TOUCH_FOCUS,cameraId);
  mState[cameraId]=STATE_PREVIEW;
  mControlAFMode=CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
  closePreviewSession();
  mFrameProcessor.onClose();
  boolean changed=mUI.setPreviewSize(mVideoPreviewSize.getWidth(),mVideoPreviewSize.getHeight());
  if (changed) {
    mUI.hideSurfaceView();
    mUI.showSurfaceView();
  }
  try {
    setUpMediaRecorder(cameraId);
    createVideoSnapshotImageReader();
    final CaptureRequest.Builder mPreviewBuilder=mCameraDevice[cameraId].createCaptureRequest(CameraDevice.TEMPLATE_RECORD);
    List<Surface> surfaces=new ArrayList<>();
    Surface surface=getPreviewSurfaceForSession(cameraId);
    if (mFrameProcessor.isFrameFilterEnabled()) {
      mFrameProcessor.init(mVideoSize);
      mActivity.runOnUiThread(new Runnable(){
        public void run(){
          mUI.getSurfaceHolder().setFixedSize(mVideoSize.getHeight(),mVideoSize.getWidth());
        }
      }
);
      mFrameProcessor.setOutputSurface(surface);
      mFrameProcessor.setVideoOutputSurface(mMediaRecorder.getSurface());
      addPreviewSurface(mPreviewBuilder,surfaces,cameraId);
    }
 else {
      surfaces.add(surface);
      mPreviewBuilder.addTarget(surface);
      surfaces.add(mMediaRecorder.getSurface());
      mPreviewBuilder.addTarget(mMediaRecorder.getSurface());
    }
    if (!mHighSpeedCapture)     surfaces.add(mVideoSnapshotImageReader.getSurface());
 else     mPreviewBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE,mHighSpeedFPSRange);
    if (!mHighSpeedCapture) {
      mCameraDevice[cameraId].createCaptureSession(surfaces,new CameraCaptureSession.StateCallback(){
        @Override public void onConfigured(        CameraCaptureSession cameraCaptureSession){
          Log.d(TAG,"String_Node_Str");
          mCurrentSession=cameraCaptureSession;
          try {
            setUpVideoCaptureRequestBuilder(mPreviewBuilder);
            mCurrentSession.setRepeatingRequest(mPreviewBuilder.build(),null,mCameraHandler);
          }
 catch (          CameraAccessException e) {
            e.printStackTrace();
          }
          mMediaRecorder.start();
          mUI.clearFocus();
          mUI.resetPauseButton();
          mRecordingTotalTime=0L;
          mRecordingStartTime=SystemClock.uptimeMillis();
          mUI.showRecordingUI(true);
          updateRecordingTime();
        }
        @Override public void onConfigureFailed(        CameraCaptureSession cameraCaptureSession){
          Toast.makeText(mActivity,"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
      }
,null);
    }
 else {
      mCameraDevice[cameraId].createConstrainedHighSpeedCaptureSession(surfaces,new CameraConstrainedHighSpeedCaptureSession.StateCallback(){
        @Override public void onConfigured(        CameraCaptureSession cameraCaptureSession){
          mCurrentSession=cameraCaptureSession;
          CameraConstrainedHighSpeedCaptureSession session=(CameraConstrainedHighSpeedCaptureSession)mCurrentSession;
          try {
            List list=session.createHighSpeedRequestList(mPreviewBuilder.build());
            session.setRepeatingBurst(list,null,mCameraHandler);
          }
 catch (          CameraAccessException e) {
            Log.e(TAG,"String_Node_Str" + e.getMessage());
            e.printStackTrace();
          }
catch (          IllegalArgumentException e) {
            Log.e(TAG,"String_Node_Str" + e.getMessage());
            e.printStackTrace();
          }
catch (          IllegalStateException e) {
            Log.e(TAG,"String_Node_Str" + e.getMessage());
            e.printStackTrace();
          }
          mMediaRecorder.start();
          mUI.clearFocus();
          mUI.resetPauseButton();
          mRecordingTotalTime=0L;
          mRecordingStartTime=SystemClock.uptimeMillis();
          mUI.showRecordingUI(true);
          updateRecordingTime();
        }
        @Override public void onConfigureFailed(        CameraCaptureSession cameraCaptureSession){
          Toast.makeText(mActivity,"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
      }
,null);
    }
  }
 catch (  CameraAccessException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}