Program: 35746
Project: 35746
Buggy source:
private boolean prepare() throws IOException {
synchronized (PROCESS_LOCK) {
    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")) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && mime.equals(MediaFormat.MIMETYPE_VIDEO_MPEG4)) {
          return false;
        }
        mVideoDecoderTrack=i;
        mInputVideoWidth=format.getInteger(MediaFormat.KEY_WIDTH);
        mInputVideoHeight=format.getInteger(MediaFormat.KEY_HEIGHT);
        Log.e("String_Node_Str","String_Node_Str");
        mVideoDecoder=MediaCodec.createDecoderByType(mime);
        Log.e("String_Node_Str","String_Node_Str");
        mVideoTextureId=mEGLHelper.createTextureID();
        mVideoSurfaceTexture=new SurfaceTexture(mVideoTextureId);
        mVideoSurfaceTexture.setOnFrameAvailableListener(mFrameAvaListener);
        mVideoDecoder.configure(format,new Surface(mVideoSurfaceTexture),null,0);
        if (!isRenderToWindowSurface) {
          if (mOutputVideoWidth == 0 || mOutputVideoHeight == 0) {
            mOutputVideoWidth=mInputVideoWidth;
            mOutputVideoHeight=mInputVideoHeight;
          }
          MediaFormat videoFormat=MediaFormat.createVideoFormat(mime,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,24);
          videoFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL,1);
          mVideoEncoder=MediaCodec.createEncoderByType(mime);
          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);
      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);
      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")) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && mime.equals(MediaFormat.MIMETYPE_VIDEO_MPEG4)) {
          return false;
        }
        mVideoDecoderTrack=i;
        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=mEGLHelper.createTextureID();
        mVideoSurfaceTexture=new SurfaceTexture(mVideoTextureId);
        mVideoSurfaceTexture.setOnFrameAvailableListener(mFrameAvaListener);
        mVideoDecoder.configure(format,new Surface(mVideoSurfaceTexture),null,0);
        if (!isRenderToWindowSurface) {
          if (mOutputVideoWidth == 0 || mOutputVideoHeight == 0) {
            mOutputVideoWidth=mInputVideoWidth;
            mOutputVideoHeight=mInputVideoHeight;
          }
          MediaFormat videoFormat=MediaFormat.createVideoFormat(mime,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,24);
          videoFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL,1);
          mVideoEncoder=MediaCodec.createEncoderByType(mime);
          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;
}