Program: 107528
Project: 107528
Buggy source:
/** 
 * @param pkt
 * @param nowMs
 * @return the {@link SourceFrameDesc} that was updated, otherwise null.
 */
SourceFrameDesc update(RawPacket pkt,long nowMs){
  rateStatistics.update(pkt.getLength(),nowMs);
  long ts=pkt.getTimestamp();
  SourceFrameDesc frame=frames.get(ts);
  if (frame == null) {
synchronized (frames) {
      frames.put(ts,frame=new SourceFrameDesc(this));
    }
    lastStableBitrateBps=getBitrateBps(nowMs);
  }
  boolean frameChanged=frame.update(pkt);
  if (frameChanged) {
    Map.Entry<Long,SourceFrameDesc> ceilingEntry=frames.ceilingEntry((ts + 1) & 0xFFFFFFFFL);
    if (ceilingEntry != null) {
      SourceFrameDesc ceilingFrame=ceilingEntry.getValue();
      if (ceilingFrame.getStart() != -1 || frame.getEnd() != -1) {
        int diff=RTPUtils.sequenceNumberDiff(ceilingFrame.getMinSeen(),frame.getMaxSeen());
        if (Math.abs(diff) < 3) {
          frame.setEnd((frame.getMaxSeen() + 1) & 0xFFFF);
          ceilingFrame.setStart((ceilingFrame.getMinSeen() - 1) & 0xFFFF);
        }
      }
    }
    Map.Entry<Long,SourceFrameDesc> floorEntry=frames.floorEntry((ts - 1) & 0xFFFFFFFFL);
    if (floorEntry != null) {
      SourceFrameDesc floorFrame=floorEntry.getValue();
      if (floorFrame.getEnd() != -1 || frame.getStart() != -1) {
        int diff=RTPUtils.sequenceNumberDiff(frame.getMinSeen(),floorFrame.getMaxSeen());
        if (Math.abs(diff) < 3) {
          frame.setStart((frame.getMinSeen() - 1) & 0xFFFF);
          floorFrame.setEnd((floorFrame.getMaxSeen() + 1) & 0xFFFF);
        }
      }
    }
  }
  return frameChanged ? frame : null;
}

Fixed version (ground truth):
/** 
 * @param pkt
 * @param nowMs
 * @return the {@link SourceFrameDesc} that was updated, otherwise null.
 */
SourceFrameDesc update(RawPacket pkt,long nowMs){
  rateStatistics.update(pkt.getLength(),nowMs);
  long ts=pkt.getTimestamp();
  SourceFrameDesc frame=frames.get(ts);
  if (frame == null) {
synchronized (frames) {
      frames.put(ts,frame=new SourceFrameDesc(this,ts));
    }
    lastStableBitrateBps=getBitrateBps(nowMs);
  }
  boolean frameChanged=frame.update(pkt);
  if (frameChanged) {
    Map.Entry<Long,SourceFrameDesc> ceilingEntry=frames.ceilingEntry((ts + 1) & 0xFFFFFFFFL);
    if (ceilingEntry != null) {
      SourceFrameDesc ceilingFrame=ceilingEntry.getValue();
      long tsDiff=(ceilingFrame.getTimestamp() - ts) & 0xFFFFFFFFL;
      if (tsDiff < (1L << 31) && (ceilingFrame.getStart() != -1 || frame.getEnd() != -1)) {
        int minSeen=ceilingFrame.getMinSeen();
        int maxSeen=frame.getMaxSeen();
        int snDiff=(minSeen - maxSeen) & 0xFFFF;
        if (snDiff < 3) {
          frame.setEnd((maxSeen + 1) & 0xFFFF);
          ceilingFrame.setStart((minSeen - 1) & 0xFFFF);
        }
      }
    }
    Map.Entry<Long,SourceFrameDesc> floorEntry=frames.floorEntry((ts - 1) & 0xFFFFFFFFL);
    if (floorEntry != null) {
      SourceFrameDesc floorFrame=floorEntry.getValue();
      long tsDiff=(floorFrame.getTimestamp() - ts) & 0xFFFFFFFFL;
      if (tsDiff < (1L << 31) && (floorFrame.getEnd() != -1 || frame.getStart() != -1)) {
        int minSeen=frame.getMinSeen();
        int maxSeen=floorFrame.getMaxSeen();
        int snDiff=(minSeen - maxSeen) & 0xFFFF;
        if (snDiff < 3) {
          frame.setStart((minSeen - 1) & 0xFFFF);
          floorFrame.setEnd((maxSeen + 1) & 0xFFFF);
        }
      }
    }
  }
  return frameChanged ? frame : null;
}