Program: 47221
Project: 47221
Buggy source:
/** 
 * Returns the video bitrate spec for the current transcode according to the limits/requirements of the renderer and the user's settings.
 * @param dlna
 * @param media the media metadata for the video being streamed. May contain unset/null values (e.g. for web videos).
 * @param params
 * @return a {@link List} of <code>String</code>s representing the video bitrate options for this transcode
 */
public List<String> getVideoBitrateOptions(DLNAResource dlna,DLNAMediaInfo media,OutputParams params){
  List<String> videoBitrateOptions=new ArrayList<>();
  int defaultMaxBitrates[]=getVideoBitrateConfig(configuration.getMaximumBitrate());
  int rendererMaxBitrates[]=new int[2];
  if (StringUtils.isNotEmpty(params.mediaRenderer.getMaxVideoBitrate())) {
    rendererMaxBitrates=getVideoBitrateConfig(params.mediaRenderer.getMaxVideoBitrate());
  }
  if (rendererMaxBitrates[0] > 0 && rendererMaxBitrates[0] < defaultMaxBitrates[0]) {
    defaultMaxBitrates=rendererMaxBitrates;
    LOGGER.trace("String_Node_Str" + rendererMaxBitrates[0] + "String_Node_Str"+ defaultMaxBitrates[0]+ "String_Node_Str");
  }
 else {
    LOGGER.trace("String_Node_Str" + defaultMaxBitrates[0] + "String_Node_Str");
  }
  if (params.mediaRenderer.getCBRVideoBitrate() == 0 && params.timeend == 0) {
    if (rendererMaxBitrates[0] < 0) {
      defaultMaxBitrates[0]=300;
    }
 else {
      defaultMaxBitrates[0]=1000 * defaultMaxBitrates[0];
    }
    defaultMaxBitrates[0]/=2;
    LOGGER.trace("String_Node_Str" + defaultMaxBitrates[0]);
    int bufSize=1835;
    boolean bitrateLevel41Limited=false;
    if (params.mediaRenderer.isTranscodeToMPEGTSH264AC3() || params.mediaRenderer.isTranscodeToMPEGTSH264AAC()) {
      if (params.mediaRenderer.isH264Level41Limited() && defaultMaxBitrates[0] > 31250) {
        defaultMaxBitrates[0]=31250;
        bitrateLevel41Limited=true;
        LOGGER.trace("String_Node_Str");
      }
      bufSize=defaultMaxBitrates[0];
    }
 else {
      if (media.isHDVideo()) {
        bufSize=defaultMaxBitrates[0] / 3;
      }
      if (bufSize > 7000) {
        bufSize=7000;
      }
      if (defaultMaxBitrates[1] > 0) {
        bufSize=defaultMaxBitrates[1];
      }
      if (params.mediaRenderer.isDefaultVBVSize() && rendererMaxBitrates[1] == 0) {
        bufSize=1835;
      }
    }
    if (!bitrateLevel41Limited) {
      if (dtsRemux) {
        defaultMaxBitrates[0]-=1510;
      }
 else {
        defaultMaxBitrates[0]-=configuration.getAudioBitrate();
      }
      defaultMaxBitrates[0]=defaultMaxBitrates[0] / 1000 * 1000;
      LOGGER.trace("String_Node_Str" + defaultMaxBitrates[0] + "String_Node_Str");
    }
    bufSize*=1000;
    defaultMaxBitrates[0]*=1000;
    videoBitrateOptions.add("String_Node_Str");
    videoBitrateOptions.add(String.valueOf(bufSize));
    videoBitrateOptions.add("String_Node_Str");
    videoBitrateOptions.add(String.valueOf(defaultMaxBitrates[0]));
  }
  if (!params.mediaRenderer.isTranscodeToMPEGTSH264AC3() && !params.mediaRenderer.isTranscodeToMPEGTSH264AAC()) {
    String mpeg2Options=configuration.getMPEG2MainSettingsFFmpeg();
    String mpeg2OptionsRenderer=params.mediaRenderer.getCustomFFmpegMPEG2Options();
    if (isNotBlank(mpeg2OptionsRenderer)) {
      mpeg2Options=mpeg2OptionsRenderer;
    }
 else     if (mpeg2Options.contains("String_Node_Str")) {
      mpeg2Options="String_Node_Str";
      if (params.mediaRenderer.isPS3()) {
        mpeg2Options="String_Node_Str";
      }
      if (mpeg2Options.contains("String_Node_Str") || defaultMaxBitrates[0] < 70) {
        if (media.getWidth() > 1280) {
          mpeg2Options="String_Node_Str";
        }
 else         if (media.getWidth() > 720) {
          mpeg2Options="String_Node_Str";
        }
      }
    }
    String[] customOptions=StringUtils.split(mpeg2Options);
    videoBitrateOptions.addAll(new ArrayList<>(Arrays.asList(customOptions)));
  }
 else {
    String x264CRF=configuration.getx264ConstantRateFactor();
    if (x264CRF.contains("String_Node_Str")) {
      x264CRF=x264CRF.substring(x264CRF.indexOf("String_Node_Str"));
    }
    if (x264CRF.contains("String_Node_Str")) {
      x264CRF="String_Node_Str";
      if (media.getWidth() > 720) {
        x264CRF="String_Node_Str";
      }
    }
    videoBitrateOptions.add("String_Node_Str");
    videoBitrateOptions.add(x264CRF);
  }
  return videoBitrateOptions;
}

Fixed version (ground truth):
/** 
 * Returns the video bitrate spec for the current transcode according to the limits/requirements of the renderer and the user's settings.
 * @param dlna
 * @param media the media metadata for the video being streamed. May contain unset/null values (e.g. for web videos).
 * @param params
 * @return a {@link List} of <code>String</code>s representing the video bitrate options for this transcode
 */
public List<String> getVideoBitrateOptions(DLNAResource dlna,DLNAMediaInfo media,OutputParams params){
  List<String> videoBitrateOptions=new ArrayList<>();
  int defaultMaxBitrates[]=getVideoBitrateConfig(configuration.getMaximumBitrate());
  int rendererMaxBitrates[]=new int[2];
  if (StringUtils.isNotEmpty(params.mediaRenderer.getMaxVideoBitrate())) {
    rendererMaxBitrates=getVideoBitrateConfig(params.mediaRenderer.getMaxVideoBitrate());
  }
  if (rendererMaxBitrates[0] > 0 && rendererMaxBitrates[0] < defaultMaxBitrates[0]) {
    defaultMaxBitrates=rendererMaxBitrates;
    LOGGER.trace("String_Node_Str" + rendererMaxBitrates[0] + "String_Node_Str"+ defaultMaxBitrates[0]+ "String_Node_Str");
  }
 else {
    LOGGER.trace("String_Node_Str" + defaultMaxBitrates[0] + "String_Node_Str");
  }
  if (params.mediaRenderer.getCBRVideoBitrate() == 0 && params.timeend == 0) {
    if (rendererMaxBitrates[0] < 0) {
      defaultMaxBitrates[0]=300;
    }
 else {
      defaultMaxBitrates[0]=1000 * defaultMaxBitrates[0];
    }
    defaultMaxBitrates[0]/=2;
    LOGGER.trace("String_Node_Str" + defaultMaxBitrates[0]);
    int bufSize=1835;
    boolean bitrateLevel41Limited=false;
    if (params.mediaRenderer.isTranscodeToMPEGTSH264AC3() || params.mediaRenderer.isTranscodeToMPEGTSH264AAC()) {
      if (params.mediaRenderer.isH264Level41Limited() && defaultMaxBitrates[0] > 31250) {
        defaultMaxBitrates[0]=31250;
        bitrateLevel41Limited=true;
        LOGGER.trace("String_Node_Str");
      }
      bufSize=defaultMaxBitrates[0];
    }
 else {
      if (media.isHDVideo()) {
        bufSize=defaultMaxBitrates[0] / 3;
      }
      if (bufSize > 7000) {
        bufSize=7000;
      }
      if (defaultMaxBitrates[1] > 0) {
        bufSize=defaultMaxBitrates[1];
      }
      if (params.mediaRenderer.isDefaultVBVSize() && rendererMaxBitrates[1] == 0) {
        bufSize=1835;
      }
    }
    if (!bitrateLevel41Limited) {
      if (dtsRemux) {
        defaultMaxBitrates[0]-=1510;
      }
 else {
        defaultMaxBitrates[0]-=configuration.getAudioBitrate();
      }
      defaultMaxBitrates[0]=defaultMaxBitrates[0] / 1000 * 1000;
      LOGGER.trace("String_Node_Str" + defaultMaxBitrates[0] + "String_Node_Str");
    }
    bufSize*=1000;
    defaultMaxBitrates[0]*=1000;
    videoBitrateOptions.add("String_Node_Str");
    videoBitrateOptions.add(String.valueOf(bufSize));
    videoBitrateOptions.add("String_Node_Str");
    videoBitrateOptions.add(String.valueOf(defaultMaxBitrates[0]));
  }
  if (!params.mediaRenderer.isTranscodeToMPEGTSH264AC3() && !params.mediaRenderer.isTranscodeToMPEGTSH264AAC()) {
    String mpeg2Options=configuration.getMPEG2MainSettingsFFmpeg();
    String mpeg2OptionsRenderer=params.mediaRenderer.getCustomFFmpegMPEG2Options();
    if (isNotBlank(mpeg2OptionsRenderer)) {
      mpeg2Options=mpeg2OptionsRenderer;
    }
 else     if (mpeg2Options.contains("String_Node_Str")) {
      boolean isWireless=mpeg2Options.contains("String_Node_Str");
      mpeg2Options="String_Node_Str";
      if (params.mediaRenderer.isPS3()) {
        mpeg2Options="String_Node_Str";
      }
      if (isWireless || defaultMaxBitrates[0] < 70) {
        if (media.getWidth() > 1280) {
          mpeg2Options="String_Node_Str";
        }
 else         if (media.getWidth() > 720) {
          mpeg2Options="String_Node_Str";
        }
      }
    }
    String[] customOptions=StringUtils.split(mpeg2Options);
    videoBitrateOptions.addAll(new ArrayList<>(Arrays.asList(customOptions)));
  }
 else {
    String x264CRF=configuration.getx264ConstantRateFactor();
    if (x264CRF.contains("String_Node_Str")) {
      x264CRF=x264CRF.substring(x264CRF.indexOf("String_Node_Str"));
    }
    if (x264CRF.contains("String_Node_Str")) {
      x264CRF="String_Node_Str";
      if (media.getWidth() > 720) {
        x264CRF="String_Node_Str";
      }
    }
    videoBitrateOptions.add("String_Node_Str");
    videoBitrateOptions.add(x264CRF);
  }
  return videoBitrateOptions;
}