Program: 35735
Project: 35735
Buggy source:
private boolean prepare() throws IOException {
synchronized (PROCESS_LOCK) {
    int videoRotation=0;
    MediaMetadataRetriever mMetRet=new MediaMetadataRetriever();
    mMetRet.setDataSource(mInputPath);
    mExtractor=new MediaExtractor();
    mExtractor.setDataSource(mInputPath);
    int count=mExtractor.getTrackCount();
    for (int i=0; i < count; i++) {
      MediaFormat format=mExtractor.getTrackFormat(i);
      String mime=format.getString(MediaFormat.KEY_MIME);
      Log.d(Aavt.debugTag,"String_Node_Str" + mExtractor.getTrackFormat(i));
      if (mime.startsWith("String_Node_Str")) {
        mAudioDecoderTrack=i;
      }
 else       if (mime.startsWith("String_Node_Str")) {
        mVideoDecoderTrack=i;
        MediaFormat originFormat=mExtractor.getTrackFormat(mVideoDecoderTrack);
        int frameRate=originFormat.getInteger(MediaFormat.KEY_FRAME_RATE);
        frameRate=frameRate == 0 ? 24 : frameRate;
        mTotalVideoTime=Long.valueOf(mMetRet.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
        String rotation=mMetRet.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
        if (rotation != null) {
          videoRotation=Integer.valueOf(rotation);
        }
        if (videoRotation == 90 || videoRotation == 270) {
          mInputVideoHeight=format.getInteger(MediaFormat.KEY_WIDTH);
          mInputVideoWidth=format.getInteger(MediaFormat.KEY_HEIGHT);
        }
 else {
          mInputVideoWidth=format.getInteger(MediaFormat.KEY_WIDTH);
          mInputVideoHeight=format.getInteger(MediaFormat.KEY_HEIGHT);
        }
        Log.e(Aavt.debugTag,"String_Node_Str");
        mVideoDecoder=MediaCodec.createDecoderByType(mime);
        Log.e(Aavt.debugTag,"String_Node_Str");
        mVideoTextureId=GpuUtils.createTextureID(true);
        mVideoSurfaceTexture=new SurfaceTexture(mVideoTextureId);
        mVideoDecoder.configure(format,new Surface(mVideoSurfaceTexture),null,0);
        if (!isRenderToWindowSurface) {
          if (mOutputVideoWidth == 0 || mOutputVideoHeight == 0) {
            mOutputVideoWidth=mInputVideoWidth;
            mOutputVideoHeight=mInputVideoHeight;
          }
          MediaFormat videoFormat=MediaFormat.createVideoFormat("String_Node_Str",mOutputVideoWidth,mOutputVideoHeight);
          videoFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT,MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
          videoFormat.setInteger(MediaFormat.KEY_BIT_RATE,mOutputVideoHeight * mOutputVideoWidth * 5);
          videoFormat.setInteger(MediaFormat.KEY_FRAME_RATE,frameRate);
          videoFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL,frameRate * 10);
          mVideoEncoder=MediaCodec.createEncoderByType("String_Node_Str");
          mVideoEncoder.configure(videoFormat,null,null,MediaCodec.CONFIGURE_FLAG_ENCODE);
          mOutputSurface=mVideoEncoder.createInputSurface();
          Bundle bundle=new Bundle();
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            bundle.putInt(MediaCodec.PARAMETER_KEY_VIDEO_BITRATE,mOutputVideoHeight * mOutputVideoWidth * 5);
            mVideoEncoder.setParameters(bundle);
          }
        }
      }
    }
    if (!isRenderToWindowSurface) {
      mMuxer=new MediaMuxer(mOutputPath,MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
      Log.d(Aavt.debugTag,"String_Node_Str" + videoRotation);
      if (mAudioDecoderTrack >= 0) {
        MediaFormat format=mExtractor.getTrackFormat(mAudioDecoderTrack);
        Log.d(Aavt.debugTag,"String_Node_Str" + format.toString());
        mAudioEncoderTrack=mMuxer.addTrack(format);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean prepare() throws IOException {
synchronized (PROCESS_LOCK) {
    int videoRotation=0;
    MediaMetadataRetriever mMetRet=new MediaMetadataRetriever();
    mMetRet.setDataSource(mInputPath);
    mExtractor=new MediaExtractor();
    mExtractor.setDataSource(mInputPath);
    int count=mExtractor.getTrackCount();
    for (int i=0; i < count; i++) {
      MediaFormat format=mExtractor.getTrackFormat(i);
      String mime=format.getString(MediaFormat.KEY_MIME);
      AvLog.d("String_Node_Str" + mExtractor.getTrackFormat(i));
      if (mime.startsWith("String_Node_Str")) {
        mAudioDecoderTrack=i;
      }
 else       if (mime.startsWith("String_Node_Str")) {
        mVideoDecoderTrack=i;
        MediaFormat originFormat=mExtractor.getTrackFormat(mVideoDecoderTrack);
        int frameRate=originFormat.getInteger(MediaFormat.KEY_FRAME_RATE);
        frameRate=frameRate == 0 ? 24 : frameRate;
        mTotalVideoTime=Long.valueOf(mMetRet.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
        String rotation=mMetRet.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
        if (rotation != null) {
          videoRotation=Integer.valueOf(rotation);
        }
        if (videoRotation == 90 || videoRotation == 270) {
          mInputVideoHeight=format.getInteger(MediaFormat.KEY_WIDTH);
          mInputVideoWidth=format.getInteger(MediaFormat.KEY_HEIGHT);
        }
 else {
          mInputVideoWidth=format.getInteger(MediaFormat.KEY_WIDTH);
          mInputVideoHeight=format.getInteger(MediaFormat.KEY_HEIGHT);
        }
        AvLog.d("String_Node_Str");
        mVideoDecoder=MediaCodec.createDecoderByType(mime);
        AvLog.d("String_Node_Str");
        mVideoTextureId=GpuUtils.createTextureID(true);
        mVideoSurfaceTexture=new SurfaceTexture(mVideoTextureId);
        mVideoDecoder.configure(format,new Surface(mVideoSurfaceTexture),null,0);
        if (!isRenderToWindowSurface) {
          if (mOutputVideoWidth == 0 || mOutputVideoHeight == 0) {
            mOutputVideoWidth=mInputVideoWidth;
            mOutputVideoHeight=mInputVideoHeight;
          }
          MediaFormat videoFormat=MediaFormat.createVideoFormat("String_Node_Str",mOutputVideoWidth,mOutputVideoHeight);
          videoFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT,MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
          videoFormat.setInteger(MediaFormat.KEY_BIT_RATE,mOutputVideoHeight * mOutputVideoWidth * 5);
          videoFormat.setInteger(MediaFormat.KEY_FRAME_RATE,frameRate);
          videoFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL,frameRate * 10);
          mVideoEncoder=MediaCodec.createEncoderByType("String_Node_Str");
          mVideoEncoder.configure(videoFormat,null,null,MediaCodec.CONFIGURE_FLAG_ENCODE);
          mOutputSurface=mVideoEncoder.createInputSurface();
          Bundle bundle=new Bundle();
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            bundle.putInt(MediaCodec.PARAMETER_KEY_VIDEO_BITRATE,mOutputVideoHeight * mOutputVideoWidth * 5);
            mVideoEncoder.setParameters(bundle);
          }
        }
      }
    }
    if (!isRenderToWindowSurface) {
      mMuxer=new MediaMuxer(mOutputPath,MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
      AvLog.d("String_Node_Str" + videoRotation);
      if (mAudioDecoderTrack >= 0) {
        MediaFormat format=mExtractor.getTrackFormat(mAudioDecoderTrack);
        AvLog.d("String_Node_Str" + format.toString());
        mAudioEncoderTrack=mMuxer.addTrack(format);
      }
    }
  }
  return true;
}