Program: 110480
Project: 110480
Buggy source:
@Override public int readData(int track,long playbackPositionUs,FormatHolder formatHolder,SampleHolder sampleHolder,boolean onlyReadDiscontinuity) throws IOException {
  Assertions.checkState(state == STATE_ENABLED);
  Assertions.checkState(track == 0);
  if (pendingDiscontinuity) {
    pendingDiscontinuity=false;
    return DISCONTINUITY_READ;
  }
  if (onlyReadDiscontinuity) {
    return NOTHING_READ;
  }
  downstreamPositionUs=playbackPositionUs;
  if (isPendingReset()) {
    if (currentLoadableException != null) {
      throw currentLoadableException;
    }
    IOException chunkSourceException=chunkSource.getError();
    if (chunkSourceException != null) {
      throw chunkSourceException;
    }
    return NOTHING_READ;
  }
  MediaChunk mediaChunk=mediaChunks.getFirst();
  if (mediaChunk.isReadFinished()) {
    if (mediaChunks.size() > 1) {
      discardDownstreamMediaChunk();
      mediaChunk=mediaChunks.getFirst();
      mediaChunk.seekToStart();
      return readData(track,playbackPositionUs,formatHolder,sampleHolder,false);
    }
 else     if (mediaChunk.isLastChunk()) {
      return END_OF_STREAM;
    }
    IOException chunkSourceException=chunkSource.getError();
    if (chunkSourceException != null) {
      throw chunkSourceException;
    }
    return NOTHING_READ;
  }
  if (downstreamFormat == null || !downstreamFormat.equals(mediaChunk.format)) {
    notifyDownstreamFormatChanged(mediaChunk.format.id,mediaChunk.trigger,mediaChunk.startTimeUs);
    downstreamFormat=mediaChunk.format;
  }
  if (!mediaChunk.prepare()) {
    return NOTHING_READ;
  }
  MediaFormat mediaFormat=mediaChunk.getMediaFormat();
  if (mediaFormat != null && !mediaFormat.equals(downstreamMediaFormat)) {
    chunkSource.getMaxVideoDimensions(mediaFormat);
    formatHolder.format=mediaFormat;
    formatHolder.drmInitData=mediaChunk.getPsshInfo();
    downstreamMediaFormat=mediaFormat;
    return FORMAT_READ;
  }
  if (mediaChunk.read(sampleHolder)) {
    sampleHolder.decodeOnly=frameAccurateSeeking && sampleHolder.timeUs < lastSeekPositionUs;
    onSampleRead(mediaChunk,sampleHolder);
    return SAMPLE_READ;
  }
 else {
    if (currentLoadableException != null) {
      throw currentLoadableException;
    }
    return NOTHING_READ;
  }
}

Fixed version (ground truth):
@Override public int readData(int track,long playbackPositionUs,FormatHolder formatHolder,SampleHolder sampleHolder,boolean onlyReadDiscontinuity) throws IOException {
  Assertions.checkState(state == STATE_ENABLED);
  Assertions.checkState(track == 0);
  if (pendingDiscontinuity) {
    pendingDiscontinuity=false;
    return DISCONTINUITY_READ;
  }
  if (onlyReadDiscontinuity) {
    return NOTHING_READ;
  }
  downstreamPositionUs=playbackPositionUs;
  if (isPendingReset()) {
    if (currentLoadableException != null) {
      throw currentLoadableException;
    }
    IOException chunkSourceException=chunkSource.getError();
    if (chunkSourceException != null) {
      throw chunkSourceException;
    }
    return NOTHING_READ;
  }
  MediaChunk mediaChunk=mediaChunks.getFirst();
  if (mediaChunk.isReadFinished()) {
    if (mediaChunks.size() > 1) {
      discardDownstreamMediaChunk();
      mediaChunk=mediaChunks.getFirst();
      mediaChunk.seekToStart();
      return readData(track,playbackPositionUs,formatHolder,sampleHolder,false);
    }
 else     if (mediaChunk.isLastChunk()) {
      return END_OF_STREAM;
    }
    IOException chunkSourceException=chunkSource.getError();
    if (chunkSourceException != null) {
      throw chunkSourceException;
    }
    return NOTHING_READ;
  }
  if (downstreamFormat == null || !downstreamFormat.equals(mediaChunk.format)) {
    notifyDownstreamFormatChanged(mediaChunk.format.id,mediaChunk.trigger,mediaChunk.startTimeUs);
    downstreamFormat=mediaChunk.format;
  }
  if (!mediaChunk.prepare()) {
    return NOTHING_READ;
  }
  MediaFormat mediaFormat=mediaChunk.getMediaFormat();
  if (mediaFormat != null && !mediaFormat.equals(downstreamMediaFormat,true)) {
    chunkSource.getMaxVideoDimensions(mediaFormat);
    formatHolder.format=mediaFormat;
    formatHolder.drmInitData=mediaChunk.getPsshInfo();
    downstreamMediaFormat=mediaFormat;
    return FORMAT_READ;
  }
  if (mediaChunk.read(sampleHolder)) {
    sampleHolder.decodeOnly=frameAccurateSeeking && sampleHolder.timeUs < lastSeekPositionUs;
    onSampleRead(mediaChunk,sampleHolder);
    return SAMPLE_READ;
  }
 else {
    if (currentLoadableException != null) {
      throw currentLoadableException;
    }
    return NOTHING_READ;
  }
}