nus-yam/ex-repair huggingface dataset:
Program: 110223
Project: 110223
Buggy source:
@Override public synchronized SimpleCacheSpan startReadWriteNonBlocking(String key,long position) throws CacheException {
  SimpleCacheSpan cacheSpan=getSpan(key,position);
  if (cacheSpan.isCached) {
    SimpleCacheSpan newCacheSpan=index.get(key).touch(cacheSpan);
    notifySpanTouched(cacheSpan,newCacheSpan);
    return newCacheSpan;
  }
  if (!lockedSpans.containsKey(key)) {
    lockedSpans.put(key,cacheSpan);
    return cacheSpan;
  }
  return null;
}

Fixed version (ground truth):
@Override public synchronized SimpleCacheSpan startReadWriteNonBlocking(String key,long position) throws CacheException {
  SimpleCacheSpan cacheSpan=getSpan(key,position);
  if (cacheSpan.isCached) {
    SimpleCacheSpan newCacheSpan=index.get(key).touch(cacheSpan);
    notifySpanTouched(cacheSpan,newCacheSpan);
    return newCacheSpan;
  }
  CachedContent cachedContent=index.getOrAdd(key);
  if (!cachedContent.isLocked()) {
    cachedContent.setLocked(true);
    return cacheSpan;
  }
  return null;
}
Program: 110224
Project: 110224
Buggy source:
/** 
 * Asserts that the cache contains the given data for   {@code uriString} or not.
 * @throws IOException If an error occurred reading from the Cache.
 */
public static void assertDataCached(Cache cache,Uri uri,byte[] expected) throws IOException {
  CacheDataSource dataSource=new CacheDataSource(cache,DummyDataSource.INSTANCE,0);
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  DataSourceInputStream inputStream=new DataSourceInputStream(dataSource,new DataSpec(uri,DataSpec.FLAG_ALLOW_CACHING_UNKNOWN_LENGTH));
  try {
    inputStream.open();
    byte[] buffer=new byte[1024];
    int bytesRead;
    while ((bytesRead=inputStream.read(buffer)) != -1) {
      outputStream.write(buffer,0,bytesRead);
    }
  }
 catch (  IOException e) {
  }
 finally {
    inputStream.close();
  }
  assertWithMessage("String_Node_Str" + uri + "String_Node_Str").that(outputStream.toByteArray()).isEqualTo(expected);
}

Fixed version (ground truth):
/** 
 * Asserts that the cache contains the given data for   {@code uriString} or not.
 * @throws IOException If an error occurred reading from the Cache.
 */
public static void assertDataCached(Cache cache,Uri uri,byte[] expected) throws IOException {
  DataSource dataSource=new CacheDataSource(cache,DummyDataSource.INSTANCE,0);
  DataSpec dataSpec=new DataSpec(uri,DataSpec.FLAG_ALLOW_CACHING_UNKNOWN_LENGTH);
  String messageToPrepend="String_Node_Str" + uri + "String_Node_Str";
  assertReadData(dataSource,dataSpec,expected,messageToPrepend);
}
Program: 110225
Project: 110225
Buggy source:
@Override protected void tearDown() throws Exception {
  offlineLicenseHelper.release();
  offlineLicenseHelper=null;
}

Fixed version (ground truth):
@Override protected void tearDown() throws Exception {
  offlineLicenseHelper.release();
  offlineLicenseHelper=null;
  super.tearDown();
}
Program: 110226
Project: 110226
Buggy source:
@Override protected void setUp() throws Exception {
  MockitoUtil.setUpMockito(this);
  when(mediaDrm.openSession()).thenReturn(new byte[]{1,2,3});
  offlineLicenseHelper=new OfflineLicenseHelper<>(C.WIDEVINE_UUID,mediaDrm,mediaDrmCallback,null);
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  MockitoUtil.setUpMockito(this);
  when(mediaDrm.openSession()).thenReturn(new byte[]{1,2,3});
  offlineLicenseHelper=new OfflineLicenseHelper<>(C.WIDEVINE_UUID,mediaDrm,mediaDrmCallback,null);
}
Program: 110227
Project: 110227
Buggy source:
@Override protected void setUp() throws Exception {
  FakeExtractorOutput fakeExtractorOutput=new FakeExtractorOutput();
  adtsOutput=fakeExtractorOutput.track(0,C.TRACK_TYPE_AUDIO);
  id3Output=fakeExtractorOutput.track(1,C.TRACK_TYPE_METADATA);
  adtsReader=new AdtsReader(true);
  TrackIdGenerator idGenerator=new TrackIdGenerator(0,1);
  adtsReader.createTracks(fakeExtractorOutput,idGenerator);
  data=new ParsableByteArray(TEST_DATA);
  firstFeed=true;
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  FakeExtractorOutput fakeExtractorOutput=new FakeExtractorOutput();
  adtsOutput=fakeExtractorOutput.track(0,C.TRACK_TYPE_AUDIO);
  id3Output=fakeExtractorOutput.track(1,C.TRACK_TYPE_METADATA);
  adtsReader=new AdtsReader(true);
  TrackIdGenerator idGenerator=new TrackIdGenerator(0,1);
  adtsReader.createTracks(fakeExtractorOutput,idGenerator);
  data=new ParsableByteArray(TEST_DATA);
  firstFeed=true;
}
Program: 110228
Project: 110228
Buggy source:
@Override public void setUp() throws Exception {
  cacheDir=Util.createTempDirectory(getInstrumentation().getContext(),"String_Node_Str");
  index=new CachedContentIndex(cacheDir);
}

Fixed version (ground truth):
@Override public void setUp() throws Exception {
  super.setUp();
  cacheDir=Util.createTempDirectory(getInstrumentation().getContext(),"String_Node_Str");
  index=new CachedContentIndex(cacheDir);
}
Program: 110229
Project: 110229
Buggy source:
@Override protected void tearDown() throws Exception {
  Util.recursiveDelete(cacheDir);
}

Fixed version (ground truth):
@Override protected void tearDown() throws Exception {
  Util.recursiveDelete(cacheDir);
  super.tearDown();
}
Program: 110230
Project: 110230
Buggy source:
@Override protected void setUp() throws Exception {
  MockitoUtil.setUpMockito(this);
  tracker=new CachedRegionTracker(cache,CACHE_KEY,CHUNK_INDEX);
  cacheDir=Util.createTempDirectory(getInstrumentation().getContext(),"String_Node_Str");
  index=new CachedContentIndex(cacheDir);
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  MockitoUtil.setUpMockito(this);
  tracker=new CachedRegionTracker(cache,CACHE_KEY,CHUNK_INDEX);
  cacheDir=Util.createTempDirectory(getInstrumentation().getContext(),"String_Node_Str");
  index=new CachedContentIndex(cacheDir);
}
Program: 110231
Project: 110231
Buggy source:
@Override protected void tearDown() throws Exception {
  Util.recursiveDelete(cacheDir);
}

Fixed version (ground truth):
@Override protected void tearDown() throws Exception {
  Util.recursiveDelete(cacheDir);
  super.tearDown();
}
Program: 110232
Project: 110232
Buggy source:
@Override protected void setUp() throws Exception {
  cacheDir=Util.createTempDirectory(getInstrumentation().getContext(),"String_Node_Str");
  index=new CachedContentIndex(cacheDir);
}

Fixed version (ground truth):
@Override protected void setUp() throws Exception {
  super.setUp();
  cacheDir=Util.createTempDirectory(getInstrumentation().getContext(),"String_Node_Str");
  index=new CachedContentIndex(cacheDir);
}
Program: 110233
Project: 110233
Buggy source:
@Override protected void tearDown() throws Exception {
  Util.recursiveDelete(cacheDir);
}

Fixed version (ground truth):
@Override protected void tearDown() throws Exception {
  Util.recursiveDelete(cacheDir);
  super.tearDown();
}
Program: 110234
Project: 110234
Buggy source:
/** 
 * Resets the channel mapping. After calling this method, call   {@link #configure(int,int,int)}to start using the new channel map.
 */
public void setChannelMap(int[] outputChannels){
  pendingOutputChannels=outputChannels;
}

Fixed version (ground truth):
/** 
 * Resets the channel mapping. After calling this method, call   {@link #configure(int,int,int)}to start using the new channel map.
 * @see AudioSink#configure(int,int,int,int,int[],int,int)
 */
public void setChannelMap(int[] outputChannels){
  pendingOutputChannels=outputChannels;
}
Program: 110235
Project: 110235
Buggy source:
@Override public void queueInput(ByteBuffer inputBuffer){
  int position=inputBuffer.position();
  int limit=inputBuffer.limit();
  int size=limit - position;
  int resampledSize;
switch (encoding) {
case C.ENCODING_PCM_8BIT:
    resampledSize=size * 2;
  break;
case C.ENCODING_PCM_24BIT:
resampledSize=(size / 3) * 2;
break;
case C.ENCODING_PCM_32BIT:
resampledSize=size / 2;
break;
case C.ENCODING_PCM_16BIT:
case C.ENCODING_INVALID:
case Format.NO_VALUE:
default :
throw new IllegalStateException();
}
if (buffer.capacity() < resampledSize) {
buffer=ByteBuffer.allocateDirect(resampledSize).order(ByteOrder.nativeOrder());
}
 else {
buffer.clear();
}
switch (encoding) {
case C.ENCODING_PCM_8BIT:
for (int i=position; i < limit; i++) {
buffer.put((byte)0);
buffer.put((byte)((inputBuffer.get(i) & 0xFF) - 128));
}
break;
case C.ENCODING_PCM_24BIT:
for (int i=position; i < limit; i+=3) {
buffer.put(inputBuffer.get(i + 1));
buffer.put(inputBuffer.get(i + 2));
}
break;
case C.ENCODING_PCM_32BIT:
for (int i=position; i < limit; i+=4) {
buffer.put(inputBuffer.get(i + 2));
buffer.put(inputBuffer.get(i + 3));
}
break;
case C.ENCODING_PCM_16BIT:
case C.ENCODING_INVALID:
case Format.NO_VALUE:
default :
throw new IllegalStateException();
}
inputBuffer.position(inputBuffer.limit());
buffer.flip();
outputBuffer=buffer;
}

Fixed version (ground truth):
@Override public void queueInput(ByteBuffer inputBuffer){
  int position=inputBuffer.position();
  int limit=inputBuffer.limit();
  int size=limit - position;
  int resampledSize;
switch (encoding) {
case C.ENCODING_PCM_8BIT:
    resampledSize=size * 2;
  break;
case C.ENCODING_PCM_24BIT:
resampledSize=(size / 3) * 2;
break;
case C.ENCODING_PCM_32BIT:
resampledSize=size / 2;
break;
case C.ENCODING_PCM_16BIT:
case C.ENCODING_PCM_FLOAT:
case C.ENCODING_INVALID:
case Format.NO_VALUE:
default :
throw new IllegalStateException();
}
if (buffer.capacity() < resampledSize) {
buffer=ByteBuffer.allocateDirect(resampledSize).order(ByteOrder.nativeOrder());
}
 else {
buffer.clear();
}
switch (encoding) {
case C.ENCODING_PCM_8BIT:
for (int i=position; i < limit; i++) {
buffer.put((byte)0);
buffer.put((byte)((inputBuffer.get(i) & 0xFF) - 128));
}
break;
case C.ENCODING_PCM_24BIT:
for (int i=position; i < limit; i+=3) {
buffer.put(inputBuffer.get(i + 1));
buffer.put(inputBuffer.get(i + 2));
}
break;
case C.ENCODING_PCM_32BIT:
for (int i=position; i < limit; i+=4) {
buffer.put(inputBuffer.get(i + 2));
buffer.put(inputBuffer.get(i + 3));
}
break;
case C.ENCODING_PCM_16BIT:
case C.ENCODING_INVALID:
case Format.NO_VALUE:
default :
throw new IllegalStateException();
}
inputBuffer.position(inputBuffer.limit());
buffer.flip();
outputBuffer=buffer;
}
Program: 110237
Project: 110237
Buggy source:
/** 
 * Compares the score of the current track format with another   {@link AudioTrackScore}.
 * @param other The other score to compare to.
 * @return A positive integer if this score is better than the other. Zero if they areequal. A negative integer if this score is worse than the other.
 */
@Override public int compareTo(AudioTrackScore other){
  if (this.withinRendererCapabilitiesScore != other.withinRendererCapabilitiesScore) {
    return compareInts(this.withinRendererCapabilitiesScore,other.withinRendererCapabilitiesScore);
  }
 else   if (this.matchLanguageScore != other.matchLanguageScore) {
    return compareInts(this.matchLanguageScore,other.matchLanguageScore);
  }
 else   if (this.defaultSelectionFlagScore != other.defaultSelectionFlagScore) {
    return compareInts(this.defaultSelectionFlagScore,other.defaultSelectionFlagScore);
  }
 else   if (parameters.forceLowestBitrate) {
    return compareInts(other.bitrate,this.bitrate);
  }
 else {
    int resultSign=withinRendererCapabilitiesScore == 1 ? 1 : -1;
    if (this.channelCount != other.channelCount) {
      return resultSign * compareInts(this.channelCount,other.channelCount);
    }
 else     if (this.sampleRate != other.sampleRate) {
      return resultSign * compareInts(this.sampleRate,other.sampleRate);
    }
    return resultSign * compareInts(this.bitrate,other.bitrate);
  }
}

Fixed version (ground truth):
/** 
 * Compares the score of the current track format with another   {@link AudioTrackScore}.
 * @param other The other score to compare to.
 * @return A positive integer if this score is better than the other. Zero if they are equal. Anegative integer if this score is worse than the other.
 */
@Override public int compareTo(@NonNull AudioTrackScore other){
  if (this.withinRendererCapabilitiesScore != other.withinRendererCapabilitiesScore) {
    return compareInts(this.withinRendererCapabilitiesScore,other.withinRendererCapabilitiesScore);
  }
 else   if (this.matchLanguageScore != other.matchLanguageScore) {
    return compareInts(this.matchLanguageScore,other.matchLanguageScore);
  }
 else   if (this.defaultSelectionFlagScore != other.defaultSelectionFlagScore) {
    return compareInts(this.defaultSelectionFlagScore,other.defaultSelectionFlagScore);
  }
 else   if (parameters.forceLowestBitrate) {
    return compareInts(other.bitrate,this.bitrate);
  }
 else {
    int resultSign=withinRendererCapabilitiesScore == 1 ? 1 : -1;
    if (this.channelCount != other.channelCount) {
      return resultSign * compareInts(this.channelCount,other.channelCount);
    }
 else     if (this.sampleRate != other.sampleRate) {
      return resultSign * compareInts(this.sampleRate,other.sampleRate);
    }
    return resultSign * compareInts(this.bitrate,other.bitrate);
  }
}
Program: 110238
Project: 110238
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) {
    return false;
  }
  ColorInfo other=(ColorInfo)obj;
  if (colorSpace != other.colorSpace || colorRange != other.colorRange || colorTransfer != other.colorTransfer || !Arrays.equals(hdrStaticInfo,other.hdrStaticInfo)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) {
    return false;
  }
  ColorInfo other=(ColorInfo)obj;
  return colorSpace == other.colorSpace && colorRange == other.colorRange && colorTransfer == other.colorTransfer && Arrays.equals(hdrStaticInfo,other.hdrStaticInfo);
}
Program: 110239
Project: 110239
Buggy source:
private boolean haveSufficientBuffer(boolean rebuffering,long rendererPositionUs,long bufferedPositionUs){
  if (bufferedPositionUs == C.TIME_END_OF_SOURCE) {
    return true;
  }
  return loadControl.shouldStartPlayback(bufferedPositionUs - rendererPositionUs,1f,rebuffering);
}

Fixed version (ground truth):
private boolean haveSufficientBuffer(boolean rebuffering,long rendererPositionUs,long bufferedPositionUs){
  return bufferedPositionUs == C.TIME_END_OF_SOURCE || loadControl.shouldStartPlayback(bufferedPositionUs - rendererPositionUs,1f,rebuffering);
}
Program: 110240
Project: 110240
Buggy source:
@Override public int readData(FormatHolder formatHolder,DecoderInputBuffer buffer,boolean requireFormat){
  if (isPendingInitialDiscontinuity()) {
    return C.RESULT_NOTHING_READ;
  }
  if (sentEos) {
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    return C.RESULT_BUFFER_READ;
  }
  int result=childStream.readData(formatHolder,buffer,requireFormat);
  if (result == C.RESULT_FORMAT_READ) {
    Format format=formatHolder.format;
    int encoderDelay=startUs != 0 ? 0 : format.encoderDelay;
    int encoderPadding=endUs != C.TIME_END_OF_SOURCE ? 0 : format.encoderPadding;
    formatHolder.format=format.copyWithGaplessInfo(encoderDelay,encoderPadding);
    return C.RESULT_FORMAT_READ;
  }
  if (endUs != C.TIME_END_OF_SOURCE && ((result == C.RESULT_BUFFER_READ && buffer.timeUs >= endUs) || (result == C.RESULT_NOTHING_READ && mediaPeriod.getBufferedPositionUs() == C.TIME_END_OF_SOURCE))) {
    buffer.clear();
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    sentEos=true;
    return C.RESULT_BUFFER_READ;
  }
  if (result == C.RESULT_BUFFER_READ && !buffer.isEndOfStream()) {
    buffer.timeUs-=startUs;
  }
  return result;
}

Fixed version (ground truth):
@Override public int readData(FormatHolder formatHolder,DecoderInputBuffer buffer,boolean requireFormat){
  if (isPendingInitialDiscontinuity()) {
    return C.RESULT_NOTHING_READ;
  }
  if (sentEos) {
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    return C.RESULT_BUFFER_READ;
  }
  int result=childStream.readData(formatHolder,buffer,requireFormat);
  if (result == C.RESULT_FORMAT_READ) {
    Format format=formatHolder.format;
    int encoderDelay=startUs != 0 ? 0 : format.encoderDelay;
    int encoderPadding=endUs != C.TIME_END_OF_SOURCE ? 0 : format.encoderPadding;
    formatHolder.format=format.copyWithGaplessInfo(encoderDelay,encoderPadding);
    return C.RESULT_FORMAT_READ;
  }
  if (endUs != C.TIME_END_OF_SOURCE && ((result == C.RESULT_BUFFER_READ && buffer.timeUs >= endUs) || (result == C.RESULT_NOTHING_READ && getBufferedPositionUs() == C.TIME_END_OF_SOURCE))) {
    buffer.clear();
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    sentEos=true;
    return C.RESULT_BUFFER_READ;
  }
  if (result == C.RESULT_BUFFER_READ && !buffer.isEndOfStream()) {
    buffer.timeUs-=startUs;
  }
  return result;
}
Program: 110241
Project: 110241
Buggy source:
@Override public int readData(FormatHolder formatHolder,DecoderInputBuffer buffer,boolean requireFormat){
  if (pendingDiscontinuity) {
    return C.RESULT_NOTHING_READ;
  }
  if (sentEos) {
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    return C.RESULT_BUFFER_READ;
  }
  int result=stream.readData(formatHolder,buffer,requireFormat);
  if (result == C.RESULT_FORMAT_READ) {
    Format format=formatHolder.format;
    int encoderDelay=startUs != 0 ? 0 : format.encoderDelay;
    int encoderPadding=endUs != C.TIME_END_OF_SOURCE ? 0 : format.encoderPadding;
    formatHolder.format=format.copyWithGaplessInfo(encoderDelay,encoderPadding);
    return C.RESULT_FORMAT_READ;
  }
  if (endUs != C.TIME_END_OF_SOURCE && ((result == C.RESULT_BUFFER_READ && buffer.timeUs >= endUs) || (result == C.RESULT_NOTHING_READ && mediaPeriod.getBufferedPositionUs() == C.TIME_END_OF_SOURCE))) {
    buffer.clear();
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    sentEos=true;
    return C.RESULT_BUFFER_READ;
  }
  if (result == C.RESULT_BUFFER_READ && !buffer.isEndOfStream()) {
    buffer.timeUs-=startUs;
  }
  return result;
}

Fixed version (ground truth):
@Override public int readData(FormatHolder formatHolder,DecoderInputBuffer buffer,boolean requireFormat){
  if (pendingDiscontinuity) {
    return C.RESULT_NOTHING_READ;
  }
  if (sentEos) {
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    return C.RESULT_BUFFER_READ;
  }
  int result=stream.readData(formatHolder,buffer,requireFormat);
  if (result == C.RESULT_FORMAT_READ) {
    Format format=formatHolder.format;
    int encoderDelay=startUs != 0 ? 0 : format.encoderDelay;
    int encoderPadding=endUs != C.TIME_END_OF_SOURCE ? 0 : format.encoderPadding;
    formatHolder.format=format.copyWithGaplessInfo(encoderDelay,encoderPadding);
    return C.RESULT_FORMAT_READ;
  }
  if (endUs != C.TIME_END_OF_SOURCE && ((result == C.RESULT_BUFFER_READ && buffer.timeUs >= endUs) || (result == C.RESULT_NOTHING_READ && getBufferedPositionUs() == C.TIME_END_OF_SOURCE))) {
    buffer.clear();
    buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
    sentEos=true;
    return C.RESULT_BUFFER_READ;
  }
  if (result == C.RESULT_BUFFER_READ && !buffer.isEndOfStream()) {
    buffer.timeUs-=startUs;
  }
  return result;
}
Program: 110242
Project: 110242
Buggy source:
/** 
 * Resets the channel mapping. After calling this method, call   {@link #configure(int,int,int)}to start using the new channel map.
 * @see AudioSink#configure(String,int,int,int,int,int[],int,int)
 */
public void setChannelMap(int[] outputChannels){
  pendingOutputChannels=outputChannels;
}

Fixed version (ground truth):
/** 
 * Resets the channel mapping. After calling this method, call   {@link #configure(int,int,int)}to start using the new channel map.
 */
public void setChannelMap(int[] outputChannels){
  pendingOutputChannels=outputChannels;
}
Program: 110244
Project: 110244
Buggy source:
/** 
 * Resets the channel mapping. After calling this method, call   {@link #configure(int,int,int)}to start using the new channel map.
 * @see AudioSink#configure(String,int,int,int,int,int[],int,int)
 */
public void setChannelMap(int[] outputChannels){
  pendingOutputChannels=outputChannels;
}

Fixed version (ground truth):
/** 
 * Resets the channel mapping. After calling this method, call   {@link #configure(int,int,int)}to start using the new channel map.
 */
public void setChannelMap(int[] outputChannels){
  pendingOutputChannels=outputChannels;
}
Program: 110246
Project: 110246
Buggy source:
@Override public final boolean continueLoading(long positionUs){
  boolean madeProgress=false;
  boolean madeProgressThisIteration;
  do {
    madeProgressThisIteration=false;
    long nextLoadPositionUs=getNextLoadPositionUs();
    if (nextLoadPositionUs == C.TIME_END_OF_SOURCE) {
      break;
    }
    for (    SequenceableLoader loader : loaders) {
      if (loader.getNextLoadPositionUs() == nextLoadPositionUs) {
        madeProgressThisIteration|=loader.continueLoading(positionUs);
      }
    }
    madeProgress|=madeProgressThisIteration;
  }
 while (madeProgressThisIteration);
  return madeProgress;
}

Fixed version (ground truth):
@Override public final boolean continueLoading(long positionUs){
  boolean madeProgress=false;
  boolean madeProgressThisIteration;
  do {
    madeProgressThisIteration=false;
    long nextLoadPositionUs=getNextLoadPositionUs();
    if (nextLoadPositionUs == C.TIME_END_OF_SOURCE) {
      break;
    }
    for (    SequenceableLoader loader : loaders) {
      long loaderNextLoadPositionUs=loader.getNextLoadPositionUs();
      boolean isLoaderBehind=loaderNextLoadPositionUs != C.TIME_END_OF_SOURCE && loaderNextLoadPositionUs <= positionUs;
      if (loaderNextLoadPositionUs == nextLoadPositionUs || isLoaderBehind) {
        madeProgressThisIteration|=loader.continueLoading(positionUs);
      }
    }
    madeProgress|=madeProgressThisIteration;
  }
 while (madeProgressThisIteration);
  return madeProgress;
}
Program: 110247
Project: 110247
Buggy source:
@Override public final boolean continueLoading(long positionUs){
  boolean madeProgress=false;
  boolean madeProgressThisIteration;
  do {
    madeProgressThisIteration=false;
    long nextLoadPositionUs=getNextLoadPositionUs();
    if (nextLoadPositionUs == C.TIME_END_OF_SOURCE) {
      break;
    }
    for (    SequenceableLoader loader : loaders) {
      if (loader.getNextLoadPositionUs() == nextLoadPositionUs) {
        madeProgressThisIteration|=loader.continueLoading(positionUs);
      }
    }
    madeProgress|=madeProgressThisIteration;
  }
 while (madeProgressThisIteration);
  return madeProgress;
}

Fixed version (ground truth):
@Override public final boolean continueLoading(long positionUs){
  boolean madeProgress=false;
  boolean madeProgressThisIteration;
  do {
    madeProgressThisIteration=false;
    long nextLoadPositionUs=getNextLoadPositionUs();
    if (nextLoadPositionUs == C.TIME_END_OF_SOURCE) {
      break;
    }
    for (    SequenceableLoader loader : loaders) {
      long loaderNextLoadPositionUs=loader.getNextLoadPositionUs();
      boolean isLoaderBehind=loaderNextLoadPositionUs != C.TIME_END_OF_SOURCE && loaderNextLoadPositionUs <= positionUs;
      if (loaderNextLoadPositionUs == nextLoadPositionUs || isLoaderBehind) {
        madeProgressThisIteration|=loader.continueLoading(positionUs);
      }
    }
    madeProgress|=madeProgressThisIteration;
  }
 while (madeProgressThisIteration);
  return madeProgress;
}
Program: 110248
Project: 110248
Buggy source:
private void setSync(double defaultDisplayRefreshRate){
  if (useDefaultDisplayVsync) {
    vsyncSampler=VSyncSampler.getInstance();
    vsyncDurationNs=(long)(C.NANOS_PER_SECOND / defaultDisplayRefreshRate);
    vsyncOffsetNs=(vsyncDurationNs * VSYNC_OFFSET_PERCENTAGE) / 100;
  }
}

Fixed version (ground truth):
private void setSync(double defaultDisplayRefreshRate){
  if (useDefaultDisplayVsync) {
    vsyncDurationNs=(long)(C.NANOS_PER_SECOND / defaultDisplayRefreshRate);
    vsyncOffsetNs=(vsyncDurationNs * VSYNC_OFFSET_PERCENTAGE) / 100;
  }
}
Program: 110249
Project: 110249
Buggy source:
private VideoFrameReleaseTimeHelper(double defaultDisplayRefreshRate){
  useDefaultDisplayVsync=defaultDisplayRefreshRate != DISPLAY_REFRESH_RATE_UNKNOWN;
}

Fixed version (ground truth):
private VideoFrameReleaseTimeHelper(double defaultDisplayRefreshRate){
  useDefaultDisplayVsync=defaultDisplayRefreshRate != DISPLAY_REFRESH_RATE_UNKNOWN;
  if (useDefaultDisplayVsync) {
    vsyncSampler=VSyncSampler.getInstance();
  }
}
Program: 110251
Project: 110251
Buggy source:
/** 
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
 * @param callback Performs key and provisioning requests.
 * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argumentto  {@link ExoMediaDrm#getKeyRequest(byte[],byte[],String,int,HashMap)}. May be null.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @param multiSession A boolean that specify whether multiple key session support is enabled.Default is false.
 */
public DefaultDrmSessionManager(UUID uuid,ExoMediaDrm<T> mediaDrm,MediaDrmCallback callback,HashMap<String,String> optionalKeyRequestParameters,Handler eventHandler,EventListener eventListener,boolean multiSession){
  Assertions.checkNotNull(uuid);
  Assertions.checkNotNull(mediaDrm);
  Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid),"String_Node_Str");
  this.uuid=uuid;
  this.mediaDrm=mediaDrm;
  this.callback=callback;
  this.optionalKeyRequestParameters=optionalKeyRequestParameters;
  this.eventHandler=eventHandler;
  this.eventListener=eventListener;
  this.multiSession=multiSession;
  mode=MODE_PLAYBACK;
  sessions=new ArrayList<>();
  provisioningInProgress=new AtomicBoolean(false);
  if (multiSession) {
    mediaDrm.setPropertyString("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
 * @param callback Performs key and provisioning requests.
 * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argumentto  {@link ExoMediaDrm#getKeyRequest(byte[],byte[],String,int,HashMap)}. May be null.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @param multiSession A boolean that specify whether multiple key session support is enabled.Default is false.
 */
public DefaultDrmSessionManager(UUID uuid,ExoMediaDrm<T> mediaDrm,MediaDrmCallback callback,HashMap<String,String> optionalKeyRequestParameters,Handler eventHandler,EventListener eventListener,boolean multiSession){
  Assertions.checkNotNull(uuid);
  Assertions.checkNotNull(mediaDrm);
  Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid),"String_Node_Str");
  this.uuid=uuid;
  this.mediaDrm=mediaDrm;
  this.callback=callback;
  this.optionalKeyRequestParameters=optionalKeyRequestParameters;
  this.eventHandler=eventHandler;
  this.eventListener=eventListener;
  this.multiSession=multiSession;
  mode=MODE_PLAYBACK;
  sessions=new ArrayList<>();
  provisioningInProgress=new AtomicBoolean(false);
  if (multiSession) {
    mediaDrm.setPropertyString("String_Node_Str","String_Node_Str");
  }
  mediaDrm.setOnEventListener(new MediaDrmEventListener());
}
Program: 110252
Project: 110252
Buggy source:
@Override public void releaseSession(DrmSession<T> session){
  DefaultDrmSession<T> drmSession=(DefaultDrmSession<T>)session;
  if (drmSession.release()) {
    sessions.remove(drmSession);
  }
  if (sessions.isEmpty()) {
    mediaDrm.setOnEventListener(null);
    mediaDrmHandler.removeCallbacksAndMessages(null);
    mediaDrmHandler=null;
    playbackLooper=null;
  }
}

Fixed version (ground truth):
@Override public void releaseSession(DrmSession<T> session){
  DefaultDrmSession<T> drmSession=(DefaultDrmSession<T>)session;
  if (drmSession.release()) {
    sessions.remove(drmSession);
  }
}
Program: 110253
Project: 110253
Buggy source:
@Override public DrmSession<T> acquireSession(Looper playbackLooper,DrmInitData drmInitData){
  Assertions.checkState(this.playbackLooper == null || this.playbackLooper == playbackLooper);
  if (sessions.isEmpty()) {
    this.playbackLooper=playbackLooper;
    mediaDrmHandler=new MediaDrmHandler(playbackLooper);
    mediaDrm.setOnEventListener(new MediaDrmEventListener());
  }
  DefaultDrmSession<T> session=null;
  byte[] initData=null;
  String mimeType=null;
  if (offlineLicenseKeySetId == null) {
    SchemeData data=getSchemeData(drmInitData,uuid);
    if (data == null) {
      if (eventHandler != null && eventListener != null) {
        eventHandler.post(new Runnable(){
          @Override public void run(){
            eventListener.onDrmSessionManagerError(new IllegalStateException("String_Node_Str" + uuid));
          }
        }
);
      }
    }
 else {
      initData=getSchemeInitData(data,uuid);
      mimeType=getSchemeMimeType(data,uuid);
    }
  }
  for (  DefaultDrmSession<T> s : sessions) {
    if (!multiSession || s.canReuse(initData)) {
      session=s;
      break;
    }
  }
  if (session == null) {
    session=new DefaultDrmSession<T>(uuid,mediaDrm,initData,mimeType,mode,offlineLicenseKeySetId,optionalKeyRequestParameters,callback,playbackLooper,eventHandler,eventListener,provisioningInProgress,this);
    sessions.add(session);
  }
  session.acquire();
  return session;
}

Fixed version (ground truth):
@Override public DrmSession<T> acquireSession(Looper playbackLooper,DrmInitData drmInitData){
  Assertions.checkState(this.playbackLooper == null || this.playbackLooper == playbackLooper);
  if (sessions.isEmpty()) {
    this.playbackLooper=playbackLooper;
    if (mediaDrmHandler == null) {
      mediaDrmHandler=new MediaDrmHandler(playbackLooper);
    }
  }
  DefaultDrmSession<T> session=null;
  byte[] initData=null;
  String mimeType=null;
  if (offlineLicenseKeySetId == null) {
    SchemeData data=getSchemeData(drmInitData,uuid);
    if (data == null) {
      if (eventHandler != null && eventListener != null) {
        eventHandler.post(new Runnable(){
          @Override public void run(){
            eventListener.onDrmSessionManagerError(new IllegalStateException("String_Node_Str" + uuid));
          }
        }
);
      }
    }
 else {
      initData=getSchemeInitData(data,uuid);
      mimeType=getSchemeMimeType(data,uuid);
    }
  }
  for (  DefaultDrmSession<T> s : sessions) {
    if (!multiSession || s.canReuse(initData)) {
      session=s;
      break;
    }
  }
  if (session == null) {
    session=new DefaultDrmSession<T>(uuid,mediaDrm,initData,mimeType,mode,offlineLicenseKeySetId,optionalKeyRequestParameters,callback,playbackLooper,eventHandler,eventListener,provisioningInProgress,this);
    sessions.add(session);
  }
  session.acquire();
  return session;
}
Program: 110255
Project: 110255
Buggy source:
@SuppressWarnings("String_Node_Str") public void onMediaDrmEvent(int what){
  if (!isOpen()) {
    return;
  }
switch (what) {
case ExoMediaDrm.EVENT_KEY_REQUIRED:
    doLicense();
  break;
case ExoMediaDrm.EVENT_KEY_EXPIRED:
onKeysExpired();
break;
case ExoMediaDrm.EVENT_PROVISION_REQUIRED:
state=STATE_OPENED;
postProvisionRequest();
break;
default :
break;
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void onMediaDrmEvent(int what){
  if (!isOpen()) {
    return;
  }
switch (what) {
case ExoMediaDrm.EVENT_KEY_REQUIRED:
    doLicense();
  break;
case ExoMediaDrm.EVENT_KEY_EXPIRED:
onKeysExpired();
break;
case ExoMediaDrm.EVENT_PROVISION_REQUIRED:
state=STATE_OPENED;
provisioningManager.provisionRequired(this);
break;
default :
break;
}
}
Program: 110256
Project: 110256
Buggy source:
public void onProvisionCompleted(){
  if (state != STATE_OPENING && !isOpen()) {
    return;
  }
  if (openInternal(false)) {
    doLicense();
  }
}

Fixed version (ground truth):
public void onProvisionCompleted(){
  if (openInternal(false)) {
    doLicense();
  }
}
Program: 110257
Project: 110257
Buggy source:
private void onProvisionResponse(Object response){
  provisioningInProgress.set(false);
  if (response instanceof Exception) {
    onError((Exception)response);
    return;
  }
  try {
    mediaDrm.provideProvisionResponse((byte[])response);
  }
 catch (  DeniedByServerException e) {
    onError(e);
    return;
  }
  if (sessionEventListener != null) {
    sessionEventListener.onProvisionCompleted();
  }
}

Fixed version (ground truth):
private void onProvisionResponse(Object response){
  if (state != STATE_OPENING && !isOpen()) {
    return;
  }
  if (response instanceof Exception) {
    provisioningManager.onProvisionError((Exception)response);
    return;
  }
  try {
    mediaDrm.provideProvisionResponse((byte[])response);
  }
 catch (  DeniedByServerException e) {
    provisioningManager.onProvisionError(e);
    return;
  }
  provisioningManager.onProvisionCompleted();
}
Program: 110258
Project: 110258
Buggy source:
/** 
 * Try to open a session, do provisioning if necessary.
 * @param allowProvisioning if provisioning is allowed, set this to false when calling fromprocessing provision response.
 * @return true on success, false otherwise.
 */
private boolean openInternal(boolean allowProvisioning){
  if (isOpen()) {
    return true;
  }
  try {
    sessionId=mediaDrm.openSession();
    mediaCrypto=mediaDrm.createMediaCrypto(sessionId);
    state=STATE_OPENED;
    return true;
  }
 catch (  NotProvisionedException e) {
    if (allowProvisioning) {
      postProvisionRequest();
    }
 else {
      onError(e);
    }
  }
catch (  Exception e) {
    onError(e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Try to open a session, do provisioning if necessary.
 * @param allowProvisioning if provisioning is allowed, set this to false when calling fromprocessing provision response.
 * @return true on success, false otherwise.
 */
private boolean openInternal(boolean allowProvisioning){
  if (isOpen()) {
    return true;
  }
  try {
    sessionId=mediaDrm.openSession();
    mediaCrypto=mediaDrm.createMediaCrypto(sessionId);
    state=STATE_OPENED;
    return true;
  }
 catch (  NotProvisionedException e) {
    if (allowProvisioning) {
      provisioningManager.provisionRequired(this);
    }
 else {
      onError(e);
    }
  }
catch (  Exception e) {
    onError(e);
  }
  return false;
}
Program: 110259
Project: 110259
Buggy source:
private void onKeysError(Exception e){
  if (e instanceof NotProvisionedException) {
    postProvisionRequest();
  }
 else {
    onError(e);
  }
}

Fixed version (ground truth):
private void onKeysError(Exception e){
  if (e instanceof NotProvisionedException) {
    provisioningManager.provisionRequired(this);
  }
 else {
    onError(e);
  }
}
Program: 110261
Project: 110261
Buggy source:
@Override public void onProvisionCompleted(){
  for (  DefaultDrmSession<T> session : sessions) {
    session.onProvisionCompleted();
  }
}

Fixed version (ground truth):
@Override public void onProvisionCompleted(){
  for (  DefaultDrmSession<T> session : provisioningSessions) {
    session.onProvisionCompleted();
  }
  provisioningSessions.clear();
}
Program: 110262
Project: 110262
Buggy source:
@Override public void releaseSession(DrmSession<T> session){
  DefaultDrmSession<T> drmSession=(DefaultDrmSession<T>)session;
  if (drmSession.release()) {
    sessions.remove(drmSession);
  }
}

Fixed version (ground truth):
@Override public void releaseSession(DrmSession<T> session){
  DefaultDrmSession<T> drmSession=(DefaultDrmSession<T>)session;
  if (drmSession.release()) {
    sessions.remove(drmSession);
    if (provisioningSessions.size() > 1 && provisioningSessions.get(0) == drmSession) {
      provisioningSessions.get(1).provision();
    }
    provisioningSessions.remove(drmSession);
  }
}
Program: 110263
Project: 110263
Buggy source:
@Override public DrmSession<T> acquireSession(Looper playbackLooper,DrmInitData drmInitData){
  Assertions.checkState(this.playbackLooper == null || this.playbackLooper == playbackLooper);
  if (sessions.isEmpty()) {
    this.playbackLooper=playbackLooper;
    if (mediaDrmHandler == null) {
      mediaDrmHandler=new MediaDrmHandler(playbackLooper);
    }
  }
  DefaultDrmSession<T> session=null;
  byte[] initData=null;
  String mimeType=null;
  if (offlineLicenseKeySetId == null) {
    SchemeData data=getSchemeData(drmInitData,uuid);
    if (data == null) {
      if (eventHandler != null && eventListener != null) {
        eventHandler.post(new Runnable(){
          @Override public void run(){
            eventListener.onDrmSessionManagerError(new IllegalStateException("String_Node_Str" + uuid));
          }
        }
);
      }
    }
 else {
      initData=getSchemeInitData(data,uuid);
      mimeType=getSchemeMimeType(data,uuid);
    }
  }
  for (  DefaultDrmSession<T> s : sessions) {
    if (!multiSession || s.canReuse(initData)) {
      session=s;
      break;
    }
  }
  if (session == null) {
    session=new DefaultDrmSession<T>(uuid,mediaDrm,initData,mimeType,mode,offlineLicenseKeySetId,optionalKeyRequestParameters,callback,playbackLooper,eventHandler,eventListener,provisioningInProgress,this);
    sessions.add(session);
  }
  session.acquire();
  return session;
}

Fixed version (ground truth):
@Override public DrmSession<T> acquireSession(Looper playbackLooper,DrmInitData drmInitData){
  Assertions.checkState(this.playbackLooper == null || this.playbackLooper == playbackLooper);
  if (sessions.isEmpty()) {
    this.playbackLooper=playbackLooper;
    if (mediaDrmHandler == null) {
      mediaDrmHandler=new MediaDrmHandler(playbackLooper);
    }
  }
  DefaultDrmSession<T> session=null;
  byte[] initData=null;
  String mimeType=null;
  if (offlineLicenseKeySetId == null) {
    SchemeData data=getSchemeData(drmInitData,uuid);
    if (data == null) {
      if (eventHandler != null && eventListener != null) {
        eventHandler.post(new Runnable(){
          @Override public void run(){
            eventListener.onDrmSessionManagerError(new IllegalStateException("String_Node_Str" + uuid));
          }
        }
);
      }
    }
 else {
      initData=getSchemeInitData(data,uuid);
      mimeType=getSchemeMimeType(data,uuid);
    }
  }
  if (!multiSession) {
    for (    DefaultDrmSession<T> existingSession : sessions) {
      if (existingSession.hasInitData(initData)) {
        session=existingSession;
        break;
      }
    }
  }
  if (session == null) {
    session=new DefaultDrmSession<>(uuid,mediaDrm,this,initData,mimeType,mode,offlineLicenseKeySetId,optionalKeyRequestParameters,callback,playbackLooper,eventHandler,eventListener);
    sessions.add(session);
  }
  session.acquire();
  return session;
}
Program: 110264
Project: 110264
Buggy source:
@Override public int compareTo(@NonNull SubtitleInputBuffer other){
  long delta=timeUs - other.timeUs;
  if (delta == 0) {
    return 0;
  }
  return delta > 0 ? 1 : -1;
}

Fixed version (ground truth):
@Override public int compareTo(@NonNull SubtitleInputBuffer other){
  if (isEndOfStream() != other.isEndOfStream()) {
    return isEndOfStream() ? 1 : -1;
  }
  long delta=timeUs - other.timeUs;
  if (delta == 0) {
    return 0;
  }
  return delta > 0 ? 1 : -1;
}
Program: 110265
Project: 110265
Buggy source:
private long getNextEventTime(){
  return ((nextSubtitleEventIndex == C.INDEX_UNSET) || (nextSubtitleEventIndex >= subtitle.getEventTimeCount())) ? Long.MAX_VALUE : (subtitle.getEventTime(nextSubtitleEventIndex));
}

Fixed version (ground truth):
private long getNextEventTime(){
  return nextSubtitleEventIndex == C.INDEX_UNSET || nextSubtitleEventIndex >= subtitle.getEventTimeCount() ? Long.MAX_VALUE : subtitle.getEventTime(nextSubtitleEventIndex);
}
Program: 110266
Project: 110266
Buggy source:
@Override public void queueInputBuffer(SubtitleInputBuffer inputBuffer) throws SubtitleDecoderException {
  Assertions.checkArgument(inputBuffer != null);
  Assertions.checkArgument(inputBuffer == dequeuedInputBuffer);
  if (inputBuffer.isDecodeOnly()) {
    releaseInputBuffer(inputBuffer);
  }
 else {
    queuedInputBuffers.add(inputBuffer);
  }
  dequeuedInputBuffer=null;
}

Fixed version (ground truth):
@Override public void queueInputBuffer(SubtitleInputBuffer inputBuffer) throws SubtitleDecoderException {
  Assertions.checkArgument(inputBuffer == dequeuedInputBuffer);
  if (inputBuffer.isDecodeOnly()) {
    releaseInputBuffer(inputBuffer);
  }
 else {
    queuedInputBuffers.add(inputBuffer);
  }
  dequeuedInputBuffer=null;
}
Program: 110267
Project: 110267
Buggy source:
@Override public void flush(){
  playbackPositionUs=0;
  while (!queuedInputBuffers.isEmpty()) {
    releaseInputBuffer(queuedInputBuffers.pollFirst());
  }
  if (dequeuedInputBuffer != null) {
    releaseInputBuffer(dequeuedInputBuffer);
    dequeuedInputBuffer=null;
  }
}

Fixed version (ground truth):
@Override public void flush(){
  playbackPositionUs=0;
  while (!queuedInputBuffers.isEmpty()) {
    releaseInputBuffer(queuedInputBuffers.poll());
  }
  if (dequeuedInputBuffer != null) {
    releaseInputBuffer(dequeuedInputBuffer);
    dequeuedInputBuffer=null;
  }
}
Program: 110268
Project: 110268
Buggy source:
public CeaDecoder(){
  availableInputBuffers=new LinkedList<>();
  for (int i=0; i < NUM_INPUT_BUFFERS; i++) {
    availableInputBuffers.add(new SubtitleInputBuffer());
  }
  availableOutputBuffers=new LinkedList<>();
  for (int i=0; i < NUM_OUTPUT_BUFFERS; i++) {
    availableOutputBuffers.add(new CeaOutputBuffer(this));
  }
  queuedInputBuffers=new TreeSet<>();
}

Fixed version (ground truth):
public CeaDecoder(){
  availableInputBuffers=new LinkedList<>();
  for (int i=0; i < NUM_INPUT_BUFFERS; i++) {
    availableInputBuffers.add(new SubtitleInputBuffer());
  }
  availableOutputBuffers=new LinkedList<>();
  for (int i=0; i < NUM_OUTPUT_BUFFERS; i++) {
    availableOutputBuffers.add(new CeaOutputBuffer(this));
  }
  queuedInputBuffers=new PriorityQueue<>();
}
Program: 110269
Project: 110269
Buggy source:
@Override public SubtitleOutputBuffer dequeueOutputBuffer() throws SubtitleDecoderException {
  if (availableOutputBuffers.isEmpty()) {
    return null;
  }
  while (!queuedInputBuffers.isEmpty() && queuedInputBuffers.first().timeUs <= playbackPositionUs) {
    SubtitleInputBuffer inputBuffer=queuedInputBuffers.pollFirst();
    if (inputBuffer.isEndOfStream()) {
      SubtitleOutputBuffer outputBuffer=availableOutputBuffers.pollFirst();
      outputBuffer.addFlag(C.BUFFER_FLAG_END_OF_STREAM);
      releaseInputBuffer(inputBuffer);
      return outputBuffer;
    }
    decode(inputBuffer);
    if (isNewSubtitleDataAvailable()) {
      Subtitle subtitle=createSubtitle();
      if (!inputBuffer.isDecodeOnly()) {
        SubtitleOutputBuffer outputBuffer=availableOutputBuffers.pollFirst();
        outputBuffer.setContent(inputBuffer.timeUs,subtitle,Format.OFFSET_SAMPLE_RELATIVE);
        releaseInputBuffer(inputBuffer);
        return outputBuffer;
      }
    }
    releaseInputBuffer(inputBuffer);
  }
  return null;
}

Fixed version (ground truth):
@Override public SubtitleOutputBuffer dequeueOutputBuffer() throws SubtitleDecoderException {
  if (availableOutputBuffers.isEmpty()) {
    return null;
  }
  while (!queuedInputBuffers.isEmpty() && queuedInputBuffers.peek().timeUs <= playbackPositionUs) {
    SubtitleInputBuffer inputBuffer=queuedInputBuffers.poll();
    if (inputBuffer.isEndOfStream()) {
      SubtitleOutputBuffer outputBuffer=availableOutputBuffers.pollFirst();
      outputBuffer.addFlag(C.BUFFER_FLAG_END_OF_STREAM);
      releaseInputBuffer(inputBuffer);
      return outputBuffer;
    }
    decode(inputBuffer);
    if (isNewSubtitleDataAvailable()) {
      Subtitle subtitle=createSubtitle();
      if (!inputBuffer.isDecodeOnly()) {
        SubtitleOutputBuffer outputBuffer=availableOutputBuffers.pollFirst();
        outputBuffer.setContent(inputBuffer.timeUs,subtitle,Format.OFFSET_SAMPLE_RELATIVE);
        releaseInputBuffer(inputBuffer);
        return outputBuffer;
      }
    }
    releaseInputBuffer(inputBuffer);
  }
  return null;
}
Program: 110270
Project: 110270
Buggy source:
@Override public int compareTo(@NonNull SubtitleInputBuffer other){
  long delta=timeUs - other.timeUs;
  if (delta == 0) {
    return 0;
  }
  return delta > 0 ? 1 : -1;
}

Fixed version (ground truth):
@Override public int compareTo(@NonNull SubtitleInputBuffer other){
  if (isEndOfStream() != other.isEndOfStream()) {
    return isEndOfStream() ? 1 : -1;
  }
  long delta=timeUs - other.timeUs;
  if (delta == 0) {
    return 0;
  }
  return delta > 0 ? 1 : -1;
}
Program: 110271
Project: 110271
Buggy source:
private long getNextEventTime(){
  return ((nextSubtitleEventIndex == C.INDEX_UNSET) || (nextSubtitleEventIndex >= subtitle.getEventTimeCount())) ? Long.MAX_VALUE : (subtitle.getEventTime(nextSubtitleEventIndex));
}

Fixed version (ground truth):
private long getNextEventTime(){
  return nextSubtitleEventIndex == C.INDEX_UNSET || nextSubtitleEventIndex >= subtitle.getEventTimeCount() ? Long.MAX_VALUE : subtitle.getEventTime(nextSubtitleEventIndex);
}
Program: 110272
Project: 110272
Buggy source:
@Override public void queueInputBuffer(SubtitleInputBuffer inputBuffer) throws SubtitleDecoderException {
  Assertions.checkArgument(inputBuffer != null);
  Assertions.checkArgument(inputBuffer == dequeuedInputBuffer);
  if (inputBuffer.isDecodeOnly()) {
    releaseInputBuffer(inputBuffer);
  }
 else {
    queuedInputBuffers.add(inputBuffer);
  }
  dequeuedInputBuffer=null;
}

Fixed version (ground truth):
@Override public void queueInputBuffer(SubtitleInputBuffer inputBuffer) throws SubtitleDecoderException {
  Assertions.checkArgument(inputBuffer == dequeuedInputBuffer);
  if (inputBuffer.isDecodeOnly()) {
    releaseInputBuffer(inputBuffer);
  }
 else {
    queuedInputBuffers.add(inputBuffer);
  }
  dequeuedInputBuffer=null;
}
Program: 110273
Project: 110273
Buggy source:
@Override public void flush(){
  playbackPositionUs=0;
  while (!queuedInputBuffers.isEmpty()) {
    releaseInputBuffer(queuedInputBuffers.pollFirst());
  }
  if (dequeuedInputBuffer != null) {
    releaseInputBuffer(dequeuedInputBuffer);
    dequeuedInputBuffer=null;
  }
}

Fixed version (ground truth):
@Override public void flush(){
  playbackPositionUs=0;
  while (!queuedInputBuffers.isEmpty()) {
    releaseInputBuffer(queuedInputBuffers.poll());
  }
  if (dequeuedInputBuffer != null) {
    releaseInputBuffer(dequeuedInputBuffer);
    dequeuedInputBuffer=null;
  }
}
Program: 110274
Project: 110274
Buggy source:
public CeaDecoder(){
  availableInputBuffers=new LinkedList<>();
  for (int i=0; i < NUM_INPUT_BUFFERS; i++) {
    availableInputBuffers.add(new SubtitleInputBuffer());
  }
  availableOutputBuffers=new LinkedList<>();
  for (int i=0; i < NUM_OUTPUT_BUFFERS; i++) {
    availableOutputBuffers.add(new CeaOutputBuffer(this));
  }
  queuedInputBuffers=new TreeSet<>();
}

Fixed version (ground truth):
public CeaDecoder(){
  availableInputBuffers=new LinkedList<>();
  for (int i=0; i < NUM_INPUT_BUFFERS; i++) {
    availableInputBuffers.add(new SubtitleInputBuffer());
  }
  availableOutputBuffers=new LinkedList<>();
  for (int i=0; i < NUM_OUTPUT_BUFFERS; i++) {
    availableOutputBuffers.add(new CeaOutputBuffer(this));
  }
  queuedInputBuffers=new PriorityQueue<>();
}