Program: 107498
Project: 107498
Buggy source:
/** 
 * Notifies this instance of an incoming packet.
 * @param arrivalTimeMs the arrival time of the packet in millis.
 * @param sendTime24bits the send time of the packet in AST format(24 bits, 6.18 fixed point).
 * @param payloadSize the payload size of the packet.
 * @param ssrc the SSRC of the packet.
 */
@Override public void incomingPacketInfo(long arrivalTimeMs,long sendTime24bits,int payloadSize,long ssrc){
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + hashCode() + "String_Node_Str"+ arrivalTimeMs+ "String_Node_Str"+ sendTime24bits+ "String_Node_Str"+ payloadSize+ "String_Node_Str"+ ssrc);
  }
  long timestamp=sendTime24bits << kAbsSendTimeInterArrivalUpshift;
  long sendTimeMs=(long)(timestamp * kTimestampToMs);
  long nowMs=System.currentTimeMillis();
  long incomingBitrate_=incomingBitrate.getRate(arrivalTimeMs);
  if (incomingBitrate_ != 0) {
    incomingBitrateInitialized=true;
  }
 else   if (incomingBitrateInitialized) {
    incomingBitrate=new RateStatistics(kBitrateWindowMs,kBitrateScale);
    incomingBitrateInitialized=false;
  }
  incomingBitrate.update(payloadSize,arrivalTimeMs);
  if (firstPacketTimeMs == -1) {
    firstPacketTimeMs=nowMs;
  }
  boolean updateEstimate=false;
  long targetBitrateBps=0;
synchronized (this) {
    timeoutStreams(nowMs);
    ssrcsMap.put(ssrc,nowMs);
    if (!ssrcs.contains(ssrc)) {
      ssrcs=Collections.unmodifiableCollection(ssrcsMap.keySet());
    }
    if (payloadSize > kMinProbePacketSize && (!remoteRate.isValidEstimate() || nowMs - firstPacketTimeMs < kInitialProbingIntervalMs)) {
      if (totalProbesReceived < kMaxProbePackets) {
        long sendDeltaMs=-1;
        long recvDeltaMs=-1;
        if (!probes.isEmpty()) {
          sendDeltaMs=sendTimeMs - probes.get(probes.size() - 1).sendTimeMs;
          recvDeltaMs=arrivalTimeMs - probes.get(probes.size() - 1).sendTimeMs;
        }
        logger.warn("String_Node_Str" + sendTimeMs + "String_Node_Str"+ arrivalTimeMs+ "String_Node_Str"+ sendDeltaMs+ "String_Node_Str"+ recvDeltaMs+ "String_Node_Str");
      }
      probes.add(new Probe(sendTimeMs,arrivalTimeMs,payloadSize));
      ++totalProbesReceived;
      if (processClusters(nowMs)) {
        updateEstimate=true;
      }
    }
    long[] deltas=this.deltas;
    deltas[0]=0;
    deltas[1]=0;
    deltas[2]=0;
    if (detector == null) {
      detector=new Detector(new OverUseDetectorOptions(),true);
      if (logger.isTraceEnabled()) {
        logger.trace("String_Node_Str" + hashCode() + "String_Node_Str"+ remoteRate.hashCode()+ "String_Node_Str"+ detector.detector.hashCode()+ "String_Node_Str"+ detector.estimator.hashCode()+ "String_Node_Str"+ detector.interArrival.hashCode());
      }
    }
    if (detector.interArrival.computeDeltas(timestamp,arrivalTimeMs,payloadSize,deltas,nowMs)) {
      double tsDeltaMs=deltas[0] * kTimestampToMs;
      detector.estimator.update(deltas[1],tsDeltaMs,(int)deltas[2],detector.detector.getState(),nowMs);
      detector.detector.detect(detector.estimator.getOffset(),tsDeltaMs,detector.estimator.getNumOfDeltas(),arrivalTimeMs);
    }
    if (!updateEstimate) {
      if (lastUpdateMs == -1 || nowMs - lastUpdateMs > remoteRate.getFeedBackInterval()) {
        updateEstimate=true;
      }
 else       if (detector.detector.getState() == BandwidthUsage.kBwOverusing) {
        long incomingRate_=incomingBitrate.getRate(arrivalTimeMs);
        if (incomingRate_ > 0 && remoteRate.isTimeToReduceFurther(nowMs,incomingBitrate_)) {
          updateEstimate=true;
        }
      }
    }
    if (updateEstimate) {
      input.bwState=detector.detector.getState();
      input.incomingBitRate=incomingBitrate.getRate(arrivalTimeMs);
      input.noiseVar=detector.estimator.getVarNoise();
      remoteRate.update(input,nowMs);
      targetBitrateBps=remoteRate.updateBandwidthEstimate(nowMs);
      updateEstimate=remoteRate.isValidEstimate();
    }
  }
  if (updateEstimate) {
    lastUpdateMs=nowMs;
    if (observer != null) {
      observer.onReceiveBitrateChanged(getSsrcs(),targetBitrateBps);
    }
  }
}

Fixed version (ground truth):
/** 
 * Notifies this instance of an incoming packet.
 * @param arrivalTimeMs the arrival time of the packet in millis.
 * @param sendTime24bits the send time of the packet in AST format(24 bits, 6.18 fixed point).
 * @param payloadSize the payload size of the packet.
 * @param ssrc the SSRC of the packet.
 */
@Override public void incomingPacketInfo(long arrivalTimeMs,long sendTime24bits,int payloadSize,long ssrc){
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + hashCode() + "String_Node_Str"+ arrivalTimeMs+ "String_Node_Str"+ sendTime24bits+ "String_Node_Str"+ payloadSize+ "String_Node_Str"+ ssrc);
  }
  long timestamp=sendTime24bits << kAbsSendTimeInterArrivalUpshift;
  long sendTimeMs=(long)(timestamp * kTimestampToMs);
  long nowMs=System.currentTimeMillis();
  long incomingBitrate_=incomingBitrate.getRate(arrivalTimeMs);
  if (incomingBitrate_ != 0) {
    incomingBitrateInitialized=true;
  }
 else   if (incomingBitrateInitialized) {
    incomingBitrate=new RateStatistics(kBitrateWindowMs,kBitrateScale);
    incomingBitrateInitialized=false;
  }
  incomingBitrate.update(payloadSize,arrivalTimeMs);
  if (firstPacketTimeMs == -1) {
    firstPacketTimeMs=nowMs;
  }
  boolean updateEstimate=false;
  long targetBitrateBps=0;
synchronized (this) {
    timeoutStreams(nowMs);
    ssrcsMap.put(ssrc,nowMs);
    if (!ssrcs.contains(ssrc)) {
      ssrcs=Collections.unmodifiableCollection(ssrcsMap.keySet());
    }
    if (payloadSize > kMinProbePacketSize && (!remoteRate.isValidEstimate() || nowMs - firstPacketTimeMs < kInitialProbingIntervalMs)) {
      if (totalProbesReceived < kMaxProbePackets) {
        long sendDeltaMs=-1;
        long recvDeltaMs=-1;
        if (!probes.isEmpty()) {
          sendDeltaMs=sendTimeMs - probes.get(probes.size() - 1).sendTimeMs;
          recvDeltaMs=arrivalTimeMs - probes.get(probes.size() - 1).recvTimeMs;
        }
        logger.warn("String_Node_Str" + sendTimeMs + "String_Node_Str"+ arrivalTimeMs+ "String_Node_Str"+ sendDeltaMs+ "String_Node_Str"+ recvDeltaMs+ "String_Node_Str");
      }
      probes.add(new Probe(sendTimeMs,arrivalTimeMs,payloadSize));
      ++totalProbesReceived;
      if (processClusters(nowMs)) {
        updateEstimate=true;
      }
    }
    long[] deltas=this.deltas;
    deltas[0]=0;
    deltas[1]=0;
    deltas[2]=0;
    if (detector == null) {
      detector=new Detector(new OverUseDetectorOptions(),true);
      if (logger.isTraceEnabled()) {
        logger.trace("String_Node_Str" + hashCode() + "String_Node_Str"+ remoteRate.hashCode()+ "String_Node_Str"+ detector.detector.hashCode()+ "String_Node_Str"+ detector.estimator.hashCode()+ "String_Node_Str"+ detector.interArrival.hashCode());
      }
    }
    if (detector.interArrival.computeDeltas(timestamp,arrivalTimeMs,payloadSize,deltas,nowMs)) {
      double tsDeltaMs=deltas[0] * kTimestampToMs;
      detector.estimator.update(deltas[1],tsDeltaMs,(int)deltas[2],detector.detector.getState(),nowMs);
      detector.detector.detect(detector.estimator.getOffset(),tsDeltaMs,detector.estimator.getNumOfDeltas(),arrivalTimeMs);
    }
    if (!updateEstimate) {
      if (lastUpdateMs == -1 || nowMs - lastUpdateMs > remoteRate.getFeedBackInterval()) {
        updateEstimate=true;
      }
 else       if (detector.detector.getState() == BandwidthUsage.kBwOverusing) {
        long incomingRate_=incomingBitrate.getRate(arrivalTimeMs);
        if (incomingRate_ > 0 && remoteRate.isTimeToReduceFurther(nowMs,incomingBitrate_)) {
          updateEstimate=true;
        }
      }
    }
    if (updateEstimate) {
      input.bwState=detector.detector.getState();
      input.incomingBitRate=incomingBitrate.getRate(arrivalTimeMs);
      input.noiseVar=detector.estimator.getVarNoise();
      remoteRate.update(input,nowMs);
      targetBitrateBps=remoteRate.updateBandwidthEstimate(nowMs);
      updateEstimate=remoteRate.isValidEstimate();
    }
  }
  if (updateEstimate) {
    lastUpdateMs=nowMs;
    if (observer != null) {
      observer.onReceiveBitrateChanged(getSsrcs(),targetBitrateBps);
    }
  }
}