Program: 47251
Project: 47251
Buggy source:
/** 
 * Returns a list of <code>String</code>s representing ffmpeg output options (i.e. options that define the output file's video codec, audio codec and container) compatible with the renderer's <code>TranscodeVideo</code> profile.
 * @param dlna
 * @param media the media metadata for the video being streamed. May contain unset/null values (e.g. for web videos).
 * @param params output parameters
 * @return a {@link List} of <code>String</code>s representing the FFmpeg output parameters for the renderer accordingto its <code>TranscodeVideo</code> profile.
 */
public synchronized List<String> getVideoTranscodeOptions(DLNAResource dlna,DLNAMediaInfo media,OutputParams params){
  List<String> transcodeOptions=new ArrayList<>();
  final String filename=dlna.getSystemName();
  final RendererConfiguration renderer=params.mediaRenderer;
  String customFFmpegOptions=renderer.getCustomFFmpegOptions();
  if (renderer.isTranscodeToWMV() && !renderer.isXBOX()) {
    transcodeOptions.add("String_Node_Str");
    transcodeOptions.add("String_Node_Str");
    if (!customFFmpegOptions.contains("String_Node_Str")) {
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
    }
    transcodeOptions.add("String_Node_Str");
    transcodeOptions.add("String_Node_Str");
  }
 else {
    final boolean isTsMuxeRVideoEngineEnabled=configuration.getEnginesAsList(PMS.get().getRegistry()).contains(TsMuxeRVideo.ID);
    dtsRemux=isTsMuxeRVideoEngineEnabled && configuration.isAudioEmbedDtsInPcm() && params.aid != null && params.aid.isDTS() && !avisynth() && renderer.isDTSPlayable();
    if (configuration.isAudioRemuxAC3() && params.aid != null && params.aid.isAC3() && !avisynth() && renderer.isTranscodeToAC3()) {
      if (!customFFmpegOptions.contains("String_Node_Str")) {
        transcodeOptions.add("String_Node_Str");
        transcodeOptions.add("String_Node_Str");
      }
    }
 else {
      if (dtsRemux) {
        transcodeOptions.add("String_Node_Str");
      }
 else       if (type() == Format.AUDIO) {
      }
 else {
        if (!customFFmpegOptions.contains("String_Node_Str")) {
          transcodeOptions.add("String_Node_Str");
          transcodeOptions.add("String_Node_Str");
        }
      }
    }
    InputFile newInput=null;
    if (filename != null) {
      newInput=new InputFile();
      newInput.setFilename(filename);
      newInput.setPush(params.stdin);
    }
    if (renderer.isTranscodeToH264TSAC3()) {
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
    }
 else     if (!dtsRemux) {
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
    }
    boolean isResolutionTooHighForRenderer=false;
    if (params.mediaRenderer.isVideoRescale() && (media.getWidth() > params.mediaRenderer.getMaxVideoWidth() || media.getHeight() > params.mediaRenderer.getMaxVideoHeight())) {
      isResolutionTooHighForRenderer=true;
    }
    if (isResolutionTooHighForRenderer) {
      int scaleWidth;
      int scaleHeight;
      double videoAspectRatio=(double)media.getWidth() / (double)media.getHeight();
      double rendererAspectRatio=(double)params.mediaRenderer.getMaxVideoWidth() / (double)params.mediaRenderer.getMaxVideoHeight();
      if (media.getWidth() == 3840 && media.getHeight() <= 1080) {
        scaleWidth=1920;
        scaleHeight=media.getHeight();
      }
 else       if (media.getWidth() == 1920 && media.getHeight() == 2160) {
        scaleWidth=1920;
        scaleHeight=1080;
      }
 else       if (media.getWidth() == 1920 && media.getHeight() == 1088) {
        scaleWidth=1920;
        scaleHeight=1088;
      }
 else {
        if (videoAspectRatio > rendererAspectRatio) {
          scaleWidth=params.mediaRenderer.getMaxVideoWidth();
          scaleHeight=(int)Math.round(params.mediaRenderer.getMaxVideoWidth() / videoAspectRatio);
        }
 else {
          scaleWidth=(int)Math.round(params.mediaRenderer.getMaxVideoHeight() * videoAspectRatio);
          scaleHeight=params.mediaRenderer.getMaxVideoHeight();
        }
      }
      scaleWidth=convertToMod4(scaleWidth);
      scaleHeight=convertToMod4(scaleHeight);
      LOGGER.info("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight+ "String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight);
    }
    transcodeOptions.add("String_Node_Str");
    if (dtsRemux) {
      transcodeOptions.add("String_Node_Str");
    }
 else     if (renderer.isTranscodeToMPEGTSAC3() || renderer.isTranscodeToH264TSAC3()) {
      transcodeOptions.add("String_Node_Str");
    }
 else {
      transcodeOptions.add("String_Node_Str");
    }
  }
  return transcodeOptions;
}

Fixed version (ground truth):
/** 
 * Returns a list of <code>String</code>s representing ffmpeg output options (i.e. options that define the output file's video codec, audio codec and container) compatible with the renderer's <code>TranscodeVideo</code> profile.
 * @param dlna
 * @param media the media metadata for the video being streamed. May contain unset/null values (e.g. for web videos).
 * @param params output parameters
 * @return a {@link List} of <code>String</code>s representing the FFmpeg output parameters for the renderer accordingto its <code>TranscodeVideo</code> profile.
 */
public synchronized List<String> getVideoTranscodeOptions(DLNAResource dlna,DLNAMediaInfo media,OutputParams params){
  List<String> transcodeOptions=new ArrayList<>();
  final String filename=dlna.getSystemName();
  final RendererConfiguration renderer=params.mediaRenderer;
  String customFFmpegOptions=renderer.getCustomFFmpegOptions();
  if (renderer.isTranscodeToWMV() && !renderer.isXBOX()) {
    transcodeOptions.add("String_Node_Str");
    transcodeOptions.add("String_Node_Str");
    if (!customFFmpegOptions.contains("String_Node_Str")) {
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
    }
    transcodeOptions.add("String_Node_Str");
    transcodeOptions.add("String_Node_Str");
  }
 else {
    final boolean isTsMuxeRVideoEngineEnabled=configuration.getEnginesAsList(PMS.get().getRegistry()).contains(TsMuxeRVideo.ID);
    dtsRemux=isTsMuxeRVideoEngineEnabled && configuration.isAudioEmbedDtsInPcm() && params.aid != null && params.aid.isDTS() && !avisynth() && renderer.isDTSPlayable();
    boolean isSubtitlesAndTimeseek=!isDisableSubtitles(params) && params.sid != null && params.timeseek > 0;
    if (configuration.isAudioRemuxAC3() && params.aid != null && params.aid.isAC3() && !avisynth() && renderer.isTranscodeToAC3() && !isSubtitlesAndTimeseek) {
      if (!customFFmpegOptions.contains("String_Node_Str")) {
        transcodeOptions.add("String_Node_Str");
        transcodeOptions.add("String_Node_Str");
      }
    }
 else {
      if (dtsRemux) {
        transcodeOptions.add("String_Node_Str");
      }
 else       if (type() == Format.AUDIO) {
      }
 else {
        if (!customFFmpegOptions.contains("String_Node_Str")) {
          transcodeOptions.add("String_Node_Str");
          transcodeOptions.add("String_Node_Str");
        }
      }
    }
    InputFile newInput=null;
    if (filename != null) {
      newInput=new InputFile();
      newInput.setFilename(filename);
      newInput.setPush(params.stdin);
    }
    if (renderer.isTranscodeToH264TSAC3()) {
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
    }
 else     if (!dtsRemux) {
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str");
    }
    boolean isResolutionTooHighForRenderer=false;
    if (params.mediaRenderer.isVideoRescale() && (media.getWidth() > params.mediaRenderer.getMaxVideoWidth() || media.getHeight() > params.mediaRenderer.getMaxVideoHeight())) {
      isResolutionTooHighForRenderer=true;
    }
    if (isResolutionTooHighForRenderer) {
      int scaleWidth;
      int scaleHeight;
      double videoAspectRatio=(double)media.getWidth() / (double)media.getHeight();
      double rendererAspectRatio=(double)params.mediaRenderer.getMaxVideoWidth() / (double)params.mediaRenderer.getMaxVideoHeight();
      if (media.getWidth() == 3840 && media.getHeight() <= 1080) {
        scaleWidth=1920;
        scaleHeight=media.getHeight();
      }
 else       if (media.getWidth() == 1920 && media.getHeight() == 2160) {
        scaleWidth=1920;
        scaleHeight=1080;
      }
 else       if (media.getWidth() == 1920 && media.getHeight() == 1088) {
        scaleWidth=1920;
        scaleHeight=1088;
      }
 else {
        if (videoAspectRatio > rendererAspectRatio) {
          scaleWidth=params.mediaRenderer.getMaxVideoWidth();
          scaleHeight=(int)Math.round(params.mediaRenderer.getMaxVideoWidth() / videoAspectRatio);
        }
 else {
          scaleWidth=(int)Math.round(params.mediaRenderer.getMaxVideoHeight() * videoAspectRatio);
          scaleHeight=params.mediaRenderer.getMaxVideoHeight();
        }
      }
      scaleWidth=convertToMod4(scaleWidth);
      scaleHeight=convertToMod4(scaleHeight);
      LOGGER.info("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight+ "String_Node_Str");
      transcodeOptions.add("String_Node_Str");
      transcodeOptions.add("String_Node_Str" + scaleWidth + "String_Node_Str"+ scaleHeight);
    }
    transcodeOptions.add("String_Node_Str");
    if (dtsRemux) {
      transcodeOptions.add("String_Node_Str");
    }
 else     if (renderer.isTranscodeToMPEGTSAC3() || renderer.isTranscodeToH264TSAC3()) {
      transcodeOptions.add("String_Node_Str");
    }
 else {
      transcodeOptions.add("String_Node_Str");
    }
  }
  return transcodeOptions;
}