Program: 110398
Project: 110398
Buggy source:
@Override public final void getNextChunk(MediaChunk previous,long playbackPositionUs,ChunkHolder out){
  if (fatalError != null) {
    return;
  }
  if (enabledFormats.length > 1) {
    long bufferedDurationUs=previous != null ? (previous.endTimeUs - playbackPositionUs) : 0;
    adaptiveFormatEvaluator.evaluateFormat(bufferedDurationUs,adaptiveFormatBlacklistFlags,evaluation);
  }
 else {
    evaluation.format=enabledFormats[0];
    evaluation.trigger=Chunk.TRIGGER_MANUAL;
  }
  Format selectedFormat=evaluation.format;
  if (selectedFormat == null) {
    return;
  }
  StreamElement streamElement=currentManifest.streamElements[elementIndex];
  if (streamElement.chunkCount == 0) {
    if (currentManifest.isLive) {
      needManifestRefresh=true;
    }
 else {
      out.endOfStream=true;
    }
    return;
  }
  int chunkIndex;
  if (previous == null) {
    if (live) {
      playbackPositionUs=getLiveSeekPosition(currentManifest,liveEdgeLatencyUs);
    }
    chunkIndex=streamElement.getChunkIndex(playbackPositionUs);
  }
 else {
    chunkIndex=previous.chunkIndex + 1 - currentManifestChunkOffset;
  }
  if (live && chunkIndex < 0) {
    fatalError=new BehindLiveWindowException();
    return;
  }
 else   if (currentManifest.isLive) {
    if (chunkIndex >= streamElement.chunkCount) {
      needManifestRefresh=true;
      return;
    }
 else     if (chunkIndex == streamElement.chunkCount - 1) {
      needManifestRefresh=true;
    }
  }
 else   if (chunkIndex >= streamElement.chunkCount) {
    out.endOfStream=true;
    return;
  }
  boolean isLastChunk=!currentManifest.isLive && chunkIndex == streamElement.chunkCount - 1;
  long chunkStartTimeUs=streamElement.getStartTimeUs(chunkIndex);
  long chunkEndTimeUs=isLastChunk ? -1 : chunkStartTimeUs + streamElement.getChunkDurationUs(chunkIndex);
  int currentAbsoluteChunkIndex=chunkIndex + currentManifestChunkOffset;
  int trackGroupTrackIndex=getTrackGroupTrackIndex(trackGroup,selectedFormat);
  ChunkExtractorWrapper extractorWrapper=extractorWrappers[trackGroupTrackIndex];
  int manifestTrackIndex=getManifestTrackIndex(streamElement,selectedFormat);
  Uri uri=streamElement.buildRequestUri(manifestTrackIndex,chunkIndex);
  Chunk mediaChunk=newMediaChunk(selectedFormat,dataSource,uri,null,currentAbsoluteChunkIndex,chunkStartTimeUs,chunkEndTimeUs,evaluation.trigger,extractorWrapper,drmInitData,selectedFormat);
  out.chunk=mediaChunk;
}

Fixed version (ground truth):
@Override public final void getNextChunk(MediaChunk previous,long playbackPositionUs,ChunkHolder out){
  if (fatalError != null) {
    return;
  }
  if (enabledFormats.length > 1) {
    long bufferedDurationUs=previous != null ? (previous.endTimeUs - playbackPositionUs) : 0;
    adaptiveFormatEvaluator.evaluateFormat(bufferedDurationUs,adaptiveFormatBlacklistFlags,evaluation);
  }
 else {
    evaluation.format=enabledFormats[0];
    evaluation.trigger=Chunk.TRIGGER_MANUAL;
  }
  Format selectedFormat=evaluation.format;
  if (selectedFormat == null) {
    return;
  }
  StreamElement streamElement=currentManifest.streamElements[elementIndex];
  if (streamElement.chunkCount == 0) {
    if (currentManifest.isLive) {
      needManifestRefresh=true;
    }
 else {
      out.endOfStream=true;
    }
    return;
  }
  int chunkIndex;
  if (previous == null) {
    if (live) {
      playbackPositionUs=getLiveSeekPosition(currentManifest,liveEdgeLatencyUs);
    }
    chunkIndex=streamElement.getChunkIndex(playbackPositionUs);
  }
 else {
    chunkIndex=previous.chunkIndex + 1 - currentManifestChunkOffset;
  }
  if (live && chunkIndex < 0) {
    fatalError=new BehindLiveWindowException();
    return;
  }
 else   if (currentManifest.isLive) {
    if (chunkIndex >= streamElement.chunkCount) {
      needManifestRefresh=true;
      return;
    }
 else     if (chunkIndex == streamElement.chunkCount - 1) {
      needManifestRefresh=true;
    }
  }
 else   if (chunkIndex >= streamElement.chunkCount) {
    out.endOfStream=true;
    return;
  }
  long chunkStartTimeUs=streamElement.getStartTimeUs(chunkIndex);
  long chunkEndTimeUs=chunkStartTimeUs + streamElement.getChunkDurationUs(chunkIndex);
  int currentAbsoluteChunkIndex=chunkIndex + currentManifestChunkOffset;
  int trackGroupTrackIndex=getTrackGroupTrackIndex(trackGroup,selectedFormat);
  ChunkExtractorWrapper extractorWrapper=extractorWrappers[trackGroupTrackIndex];
  int manifestTrackIndex=getManifestTrackIndex(streamElement,selectedFormat);
  Uri uri=streamElement.buildRequestUri(manifestTrackIndex,chunkIndex);
  Chunk mediaChunk=newMediaChunk(selectedFormat,dataSource,uri,null,currentAbsoluteChunkIndex,chunkStartTimeUs,chunkEndTimeUs,evaluation.trigger,extractorWrapper,drmInitData,selectedFormat);
  out.chunk=mediaChunk;
}