Program: 104978
Project: 104978
Buggy source:
/** 
 * Computes a new bitrate allocation for every endpoint in the conference, and updates the state of this instance so that bitrate allocation is eventually met.
 * @param conferenceEndpoints the ordered list of {@link Endpoint}s participating in the multipoint conference with the dominant (speaker)  {@link Endpoint} at the beginning of the list i.e. the dominant speakerhistory. This parameter is optional but it can be used for performaance; if it's omitted it will be fetched from the {@link ConferenceSpeechActivity}.
 */
public void update(List<Endpoint> conferenceEndpoints){
  if (conferenceEndpoints == null) {
    conferenceEndpoints=dest.getConferenceSpeechActivity().getEndpoints();
  }
 else {
    conferenceEndpoints=new ArrayList<>(conferenceEndpoints);
  }
  long bweBps=Long.MAX_VALUE;
  EndpointBitrateAllocation[] allocations=allocate(bweBps,conferenceEndpoints);
  List<String> newForwardedEndpoints=new ArrayList<>();
  if (!ArrayUtils.isNullOrEmpty(allocations)) {
    for (    EndpointBitrateAllocation allocation : allocations) {
      int ssrc=allocation.targetSSRC, targetIdx=allocation.targetIdx;
      SimulcastController ctrl=ssrcToBitrateController.get(ssrc);
      if (ctrl == null && allocation.track != null) {
        ctrl=new SimulcastController(allocation.track);
        RTPEncodingDesc[] rtpEncodings=allocation.track.getRTPEncodings();
        for (        RTPEncodingDesc rtpEncoding : rtpEncodings) {
          ssrcToBitrateController.put((int)rtpEncoding.getPrimarySSRC(),ctrl);
          if (rtpEncoding.getRTXSSRC() != -1) {
            ssrcToBitrateController.put((int)rtpEncoding.getRTXSSRC(),ctrl);
          }
        }
      }
      if (ctrl != null) {
        ctrl.update(targetIdx);
      }
      if (targetIdx > -1) {
        newForwardedEndpoints.add(allocation.endpointID);
      }
    }
  }
  this.forwardedEndpoints=newForwardedEndpoints;
}

Fixed version (ground truth):
/** 
 * Computes a new bitrate allocation for every endpoint in the conference, and updates the state of this instance so that bitrate allocation is eventually met.
 * @param conferenceEndpoints the ordered list of {@link Endpoint}s participating in the multipoint conference with the dominant (speaker)  {@link Endpoint} at the beginning of the list i.e. the dominant speakerhistory. This parameter is optional but it can be used for performaance; if it's omitted it will be fetched from the {@link ConferenceSpeechActivity}.
 */
public void update(List<Endpoint> conferenceEndpoints){
  if (conferenceEndpoints == null) {
    conferenceEndpoints=dest.getConferenceSpeechActivity().getEndpoints();
  }
 else {
    conferenceEndpoints=new ArrayList<>(conferenceEndpoints);
  }
  long bweBps=Long.MAX_VALUE;
  EndpointBitrateAllocation[] allocations=allocate(bweBps,conferenceEndpoints);
  Set<String> oldForwardedEndpointIds=forwardedEndpointIds;
  Set<String> newForwardedEndpointIds=new HashSet<>();
  Set<String> endpointsEnteringLastNIds=new HashSet<>();
  Set<String> conferenceEndpointIds=new HashSet<>();
  if (!ArrayUtils.isNullOrEmpty(allocations)) {
    for (    EndpointBitrateAllocation allocation : allocations) {
      conferenceEndpointIds.add(allocation.endpointID);
      int ssrc=allocation.targetSSRC, targetIdx=allocation.targetIdx;
      SimulcastController ctrl=ssrcToBitrateController.get(ssrc);
      if (ctrl == null && allocation.track != null) {
        ctrl=new SimulcastController(allocation.track);
        RTPEncodingDesc[] rtpEncodings=allocation.track.getRTPEncodings();
synchronized (ssrcToBitrateController) {
          for (          RTPEncodingDesc rtpEncoding : rtpEncodings) {
            ssrcToBitrateController.put((int)rtpEncoding.getPrimarySSRC(),ctrl);
            if (rtpEncoding.getRTXSSRC() != -1) {
              ssrcToBitrateController.put((int)rtpEncoding.getRTXSSRC(),ctrl);
            }
          }
        }
        ctrl=ssrcToBitrateController.get(ssrc);
      }
      if (ctrl != null) {
        ctrl.update(targetIdx);
      }
      if (targetIdx > -1) {
        newForwardedEndpointIds.add(allocation.endpointID);
        if (!oldForwardedEndpointIds.contains(allocation.endpointID)) {
          endpointsEnteringLastNIds.add(allocation.endpointID);
        }
      }
    }
  }
  if (!newForwardedEndpointIds.equals(oldForwardedEndpointIds)) {
    dest.sendLastNEndpointsChangeEventOnDataChannel(newForwardedEndpointIds,endpointsEnteringLastNIds,conferenceEndpointIds);
  }
  this.forwardedEndpointIds=newForwardedEndpointIds;
}