Program: 107654
Project: 107654
Buggy source:
/** 
 * Sets the <tt>MediaFormatImpl</tt> of a specific <tt>TrackControl</tt> of the <tt>Processor</tt> which produces the media to be streamed by this <tt>MediaDeviceSession</tt> to the remote peer. Allows extenders to override the set procedure and to detect when the JMF <tt>Format</tt> of the specified <tt>TrackControl</tt> changes.
 * @param trackControl the <tt>TrackControl</tt> to set the JMF<tt>Format</tt> of
 * @param mediaFormat the <tt>MediaFormatImpl</tt> to be set on thespecified <tt>TrackControl</tt>. Though <tt>mediaFormat</tt> encapsulates a JMF <tt>Format</tt>, <tt>format</tt> is to be set on the specified <tt>trackControl</tt> because it may be more specific. In any case, the two JMF <tt>Format</tt>s match. The <tt>MediaFormatImpl</tt> is provided anyway because it carries additional information such as format parameters.
 * @param format the JMF <tt>Format</tt> to be set on the specified<tt>TrackControl</tt>. Though <tt>mediaFormat</tt> encapsulates a JMF <tt>Format</tt>, the specified <tt>format</tt> is to be set on the specified <tt>trackControl</tt> because it may be more specific than the JMF <tt>Format</tt> of the <tt>mediaFormat</tt>
 * @return the JMF <tt>Format</tt> set on <tt>TrackControl</tt> after theattempt to set the specified <tt>mediaFormat</tt> or <tt>null</tt> if the specified <tt>format</tt> was found to be incompatible with <tt>trackControl</tt>
 * @see MediaDeviceSession#setProcessorFormat(TrackControl,MediaFormatImpl,Format)
 */
@Override protected Format setProcessorFormat(TrackControl trackControl,MediaFormatImpl<? extends Format> mediaFormat,Format format){
  JNIEncoder encoder=null;
  SwScale scaler=null;
  int codecCount=0;
  if (!OSUtils.IS_ANDROID && "String_Node_Str".equalsIgnoreCase(format.getEncoding())) {
    encoder=new JNIEncoder();
{
      Map<String,String> formatParameters=mediaFormat.getFormatParameters();
      String packetizationMode=(formatParameters == null) ? null : formatParameters.get(JNIEncoder.PACKETIZATION_MODE_FMTP);
      encoder.setPacketizationMode(packetizationMode);
    }
{
      encoder.setAdditionalCodecSettings(mediaFormat.getAdditionalCodecSettings());
    }
    if (usePLI) {
      try {
        ((ControlTransformInputStream)rtpConnector.getControlInputStream()).addRTCPFeedbackListener(encoder);
      }
 catch (      IOException ioe) {
        logger.error("String_Node_Str",ioe);
      }
    }
    if (keyFrameControl != null)     encoder.setKeyFrameControl(keyFrameControl);
    codecCount++;
  }
  if (outputSize != null) {
    scaler=new SwScale();
    scaler.setOutputSize(outputSize);
    codecCount++;
  }
  Codec[] codecs=new Codec[codecCount];
  codecCount=0;
  if (scaler != null)   codecs[codecCount++]=scaler;
  if (encoder != null)   codecs[codecCount++]=encoder;
  if (codecCount != 0) {
    try {
      trackControl.setCodecChain(codecs);
    }
 catch (    UnsupportedPlugInException upiex) {
      logger.error("String_Node_Str",upiex);
    }
  }
  return super.setProcessorFormat(trackControl,mediaFormat,format);
}

Fixed version (ground truth):
/** 
 * Sets the <tt>MediaFormatImpl</tt> of a specific <tt>TrackControl</tt> of the <tt>Processor</tt> which produces the media to be streamed by this <tt>MediaDeviceSession</tt> to the remote peer. Allows extenders to override the set procedure and to detect when the JMF <tt>Format</tt> of the specified <tt>TrackControl</tt> changes.
 * @param trackControl the <tt>TrackControl</tt> to set the JMF<tt>Format</tt> of
 * @param mediaFormat the <tt>MediaFormatImpl</tt> to be set on thespecified <tt>TrackControl</tt>. Though <tt>mediaFormat</tt> encapsulates a JMF <tt>Format</tt>, <tt>format</tt> is to be set on the specified <tt>trackControl</tt> because it may be more specific. In any case, the two JMF <tt>Format</tt>s match. The <tt>MediaFormatImpl</tt> is provided anyway because it carries additional information such as format parameters.
 * @param format the JMF <tt>Format</tt> to be set on the specified<tt>TrackControl</tt>. Though <tt>mediaFormat</tt> encapsulates a JMF <tt>Format</tt>, the specified <tt>format</tt> is to be set on the specified <tt>trackControl</tt> because it may be more specific than the JMF <tt>Format</tt> of the <tt>mediaFormat</tt>
 * @return the JMF <tt>Format</tt> set on <tt>TrackControl</tt> after theattempt to set the specified <tt>mediaFormat</tt> or <tt>null</tt> if the specified <tt>format</tt> was found to be incompatible with <tt>trackControl</tt>
 * @see MediaDeviceSession#setProcessorFormat(TrackControl,MediaFormatImpl,Format)
 */
@Override protected Format setProcessorFormat(TrackControl trackControl,MediaFormatImpl<? extends Format> mediaFormat,Format format){
  JNIEncoder encoder=null;
  SwScale scaler=null;
  int codecCount=0;
  if (!OSUtils.IS_ANDROID && "String_Node_Str".equalsIgnoreCase(format.getEncoding())) {
    encoder=new JNIEncoder();
{
      Map<String,String> formatParameters=mediaFormat.getFormatParameters();
      String packetizationMode=(formatParameters == null) ? null : formatParameters.get(JNIEncoder.PACKETIZATION_MODE_FMTP);
      encoder.setPacketizationMode(packetizationMode);
    }
{
      encoder.setAdditionalCodecSettings(mediaFormat.getAdditionalCodecSettings());
    }
    this.encoder=encoder;
    onRTCPFeedbackCreate(encoder);
synchronized (rtcpFeedbackCreateListners) {
      for (      RTCPFeedbackCreateListener l : rtcpFeedbackCreateListners) {
        l.onRTCPFeedbackCreate(encoder);
      }
    }
    if (keyFrameControl != null)     encoder.setKeyFrameControl(keyFrameControl);
    codecCount++;
  }
  if (outputSize != null) {
    scaler=new SwScale();
    scaler.setOutputSize(outputSize);
    codecCount++;
  }
  Codec[] codecs=new Codec[codecCount];
  codecCount=0;
  if (scaler != null)   codecs[codecCount++]=scaler;
  if (encoder != null)   codecs[codecCount++]=encoder;
  if (codecCount != 0) {
    try {
      trackControl.setCodecChain(codecs);
    }
 catch (    UnsupportedPlugInException upiex) {
      logger.error("String_Node_Str",upiex);
    }
  }
  return super.setProcessorFormat(trackControl,mediaFormat,format);
}