Program: 110453
Project: 110453
Buggy source:
@Override public void continueBuffering(long playbackPositionUs){
  if (manifestFetcher == null || !currentManifest.dynamic || fatalError != null) {
    return;
  }
  MediaPresentationDescription newManifest=manifestFetcher.getManifest();
  if (currentManifest != newManifest && newManifest != null) {
    Representation[] newRepresentations=DashChunkSource.getFilteredRepresentations(newManifest,adaptationSetIndex,representationIndices);
    for (    Representation representation : newRepresentations) {
      RepresentationHolder representationHolder=representationHolders.get(representation.format.id);
      DashSegmentIndex oldIndex=representationHolder.segmentIndex;
      DashSegmentIndex newIndex=representation.getIndex();
      int newFirstSegmentNum=newIndex.getFirstSegmentNum();
      int segmentNumShift=oldIndex.getSegmentNum(newIndex.getTimeUs(newFirstSegmentNum)) - newFirstSegmentNum;
      representationHolder.segmentNumShift+=segmentNumShift;
      representationHolder.segmentIndex=newIndex;
    }
    currentManifest=newManifest;
    finishedCurrentManifest=false;
    long nowUs=getNowUs();
    updateAvailableSegmentBounds(newRepresentations[0].getIndex(),nowUs);
    updateSeekRange(newRepresentations[0].getIndex(),nowUs);
  }
  long minUpdatePeriod=currentManifest.minUpdatePeriod;
  if (minUpdatePeriod == 0) {
    minUpdatePeriod=5000;
  }
  if (finishedCurrentManifest && (android.os.SystemClock.elapsedRealtime() > manifestFetcher.getManifestLoadTimestamp() + minUpdatePeriod)) {
    manifestFetcher.requestRefresh();
  }
}

Fixed version (ground truth):
@Override public void continueBuffering(long playbackPositionUs){
  if (manifestFetcher == null || !currentManifest.dynamic || fatalError != null) {
    return;
  }
  MediaPresentationDescription newManifest=manifestFetcher.getManifest();
  if (currentManifest != newManifest && newManifest != null) {
    Representation[] newRepresentations=DashChunkSource.getFilteredRepresentations(newManifest,adaptationSetIndex,representationIndices);
    for (    Representation representation : newRepresentations) {
      RepresentationHolder representationHolder=representationHolders.get(representation.format.id);
      DashSegmentIndex oldIndex=representationHolder.segmentIndex;
      int oldIndexLastSegmentNum=oldIndex.getLastSegmentNum();
      long oldIndexEndTimeUs=oldIndex.getTimeUs(oldIndexLastSegmentNum) + oldIndex.getDurationUs(oldIndexLastSegmentNum);
      DashSegmentIndex newIndex=representation.getIndex();
      int newIndexFirstSegmentNum=newIndex.getFirstSegmentNum();
      long newIndexStartTimeUs=newIndex.getTimeUs(newIndexFirstSegmentNum);
      if (oldIndexEndTimeUs < newIndexStartTimeUs) {
        fatalError=new BehindLiveWindowException();
        return;
      }
      int segmentNumShift;
      if (oldIndexEndTimeUs == newIndexStartTimeUs) {
        segmentNumShift=oldIndex.getLastSegmentNum() + 1 - newIndexFirstSegmentNum;
      }
 else {
        segmentNumShift=oldIndex.getSegmentNum(newIndexStartTimeUs) - newIndexFirstSegmentNum;
      }
      representationHolder.segmentNumShift+=segmentNumShift;
      representationHolder.segmentIndex=newIndex;
    }
    currentManifest=newManifest;
    finishedCurrentManifest=false;
    long nowUs=getNowUs();
    updateAvailableSegmentBounds(newRepresentations[0].getIndex(),nowUs);
    updateSeekRange(newRepresentations[0].getIndex(),nowUs);
  }
  long minUpdatePeriod=currentManifest.minUpdatePeriod;
  if (minUpdatePeriod == 0) {
    minUpdatePeriod=5000;
  }
  if (finishedCurrentManifest && (android.os.SystemClock.elapsedRealtime() > manifestFetcher.getManifestLoadTimestamp() + minUpdatePeriod)) {
    manifestFetcher.requestRefresh();
  }
}