nus-yam/ex-repair huggingface dataset:
Program: 110425
Project: 110425
Buggy source:
/** 
 * Invoked when the current load operation completes.
 * @param sourceId The id of the reporting {@link SampleSource}.
 * @param bytesLoaded The number of bytes that were loaded.
 * @param type The type of the loaded data.
 * @param trigger The reason for the data being loaded.
 * @param format The particular format to which this data corresponds, or null if the loaded datadoes not correspond to a format.
 * @param mediaStartTimeMs The media time of the start of the loaded data, or -1 if this load wasfor initialization data.
 * @param mediaEndTimeMs The media time of the end of the loaded data, or -1 if this load was forinitialization data.
 * @param elapsedRealtimeMs {@code elapsedRealtime} timestamp of when the load finished.
 * @param loadDurationMs Amount of time taken to load the data.
 */
void onLoadCompleted(int sourceId,long bytesLoaded,int type,int trigger,Format format,int mediaStartTimeMs,int mediaEndTimeMs,long elapsedRealtimeMs,long loadDurationMs);

Fixed version (ground truth):
/** 
 * Invoked when the current load operation completes.
 * @param sourceId The id of the reporting {@link SampleSource}.
 * @param bytesLoaded The number of bytes that were loaded.
 * @param type The type of the loaded data.
 * @param trigger The reason for the data being loaded.
 * @param format The particular format to which this data corresponds, or null if the loaded datadoes not correspond to a format.
 * @param mediaStartTimeMs The media time of the start of the loaded data, or -1 if this load wasfor initialization data.
 * @param mediaEndTimeMs The media time of the end of the loaded data, or -1 if this load was forinitialization data.
 * @param elapsedRealtimeMs {@code elapsedRealtime} timestamp of when the load finished.
 * @param loadDurationMs Amount of time taken to load the data.
 */
void onLoadCompleted(int sourceId,long bytesLoaded,int type,int trigger,Format format,long mediaStartTimeMs,long mediaEndTimeMs,long elapsedRealtimeMs,long loadDurationMs);
Program: 110426
Project: 110426
Buggy source:
/** 
 * Invoked when an upstream load is started.
 * @param sourceId The id of the reporting {@link SampleSource}.
 * @param length The length of the data being loaded in bytes, or {@link C#LENGTH_UNBOUNDED} ifthe length of the data is not known in advance.
 * @param type The type of the data being loaded.
 * @param trigger The reason for the data being loaded.
 * @param format The particular format to which this data corresponds, or null if the data beingloaded does not correspond to a format.
 * @param mediaStartTimeMs The media time of the start of the data being loaded, or -1 if thisload is for initialization data.
 * @param mediaEndTimeMs The media time of the end of the data being loaded, or -1 if thisload is for initialization data.
 */
void onLoadStarted(int sourceId,long length,int type,int trigger,Format format,int mediaStartTimeMs,int mediaEndTimeMs);

Fixed version (ground truth):
/** 
 * Invoked when an upstream load is started.
 * @param sourceId The id of the reporting {@link SampleSource}.
 * @param length The length of the data being loaded in bytes, or {@link C#LENGTH_UNBOUNDED} ifthe length of the data is not known in advance.
 * @param type The type of the data being loaded.
 * @param trigger The reason for the data being loaded.
 * @param format The particular format to which this data corresponds, or null if the data beingloaded does not correspond to a format.
 * @param mediaStartTimeMs The media time of the start of the data being loaded, or -1 if thisload is for initialization data.
 * @param mediaEndTimeMs The media time of the end of the data being loaded, or -1 if thisload is for initialization data.
 */
void onLoadStarted(int sourceId,long length,int type,int trigger,Format format,long mediaStartTimeMs,long mediaEndTimeMs);
Program: 110427
Project: 110427
Buggy source:
/** 
 * Invoked when data is removed from the back of the buffer, typically so that it can be re-buffered using a different representation.
 * @param sourceId The id of the reporting {@link SampleSource}.
 * @param mediaStartTimeMs The media time of the start of the discarded data.
 * @param mediaEndTimeMs The media time of the end of the discarded data.
 */
void onUpstreamDiscarded(int sourceId,int mediaStartTimeMs,int mediaEndTimeMs);

Fixed version (ground truth):
/** 
 * Invoked when data is removed from the back of the buffer, typically so that it can be re-buffered using a different representation.
 * @param sourceId The id of the reporting {@link SampleSource}.
 * @param mediaStartTimeMs The media time of the start of the discarded data.
 * @param mediaEndTimeMs The media time of the end of the discarded data.
 */
void onUpstreamDiscarded(int sourceId,long mediaStartTimeMs,long mediaEndTimeMs);
Program: 110428
Project: 110428
Buggy source:
/** 
 * Invoked when the downstream format changes (i.e. when the format being supplied to the caller of   {@link SampleSourceReader#readData} changes).
 * @param sourceId The id of the reporting {@link SampleSource}.
 * @param format The format.
 * @param trigger The trigger specified in the corresponding upstream load, as specified by the{@link ChunkSource}.
 * @param mediaTimeMs The media time at which the change occurred.
 */
void onDownstreamFormatChanged(int sourceId,Format format,int trigger,int mediaTimeMs);

Fixed version (ground truth):
/** 
 * Invoked when the downstream format changes (i.e. when the format being supplied to the caller of   {@link SampleSourceReader#readData} changes).
 * @param sourceId The id of the reporting {@link SampleSource}.
 * @param format The format.
 * @param trigger The trigger specified in the corresponding upstream load, as specified by the{@link ChunkSource}.
 * @param mediaTimeMs The media time at which the change occurred.
 */
void onDownstreamFormatChanged(int sourceId,Format format,int trigger,long mediaTimeMs);
Program: 110429
Project: 110429
Buggy source:
protected final int usToMs(long timeUs){
  return (int)(timeUs / 1000);
}

Fixed version (ground truth):
protected final long usToMs(long timeUs){
  return timeUs / 1000;
}
Program: 110430
Project: 110430
Buggy source:
int usToMs(long timeUs){
  return (int)(timeUs / 1000);
}

Fixed version (ground truth):
long usToMs(long timeUs){
  return timeUs / 1000;
}
Program: 110431
Project: 110431
Buggy source:
@Override public void onLoadCompleted(int sourceId,long bytesLoaded,int type,int trigger,Format format,int mediaStartTimeMs,int mediaEndTimeMs,long elapsedRealtimeMs,long loadDurationMs){
}

Fixed version (ground truth):
@Override public void onLoadCompleted(int sourceId,long bytesLoaded,int type,int trigger,Format format,long mediaStartTimeMs,long mediaEndTimeMs,long elapsedRealtimeMs,long loadDurationMs){
}
Program: 110432
Project: 110432
Buggy source:
@Override public void onUpstreamDiscarded(int sourceId,int mediaStartTimeMs,int mediaEndTimeMs){
}

Fixed version (ground truth):
@Override public void onUpstreamDiscarded(int sourceId,long mediaStartTimeMs,long mediaEndTimeMs){
}
Program: 110433
Project: 110433
Buggy source:
@Override public void onLoadStarted(int sourceId,long length,int type,int trigger,Format format,int mediaStartTimeMs,int mediaEndTimeMs){
}

Fixed version (ground truth):
@Override public void onLoadStarted(int sourceId,long length,int type,int trigger,Format format,long mediaStartTimeMs,long mediaEndTimeMs){
}
Program: 110434
Project: 110434
Buggy source:
@Override public void onDownstreamFormatChanged(int sourceId,Format format,int trigger,int mediaTimeMs){
  Log.i(tag,"String_Node_Str" + sourceId + "String_Node_Str"+ format.id);
}

Fixed version (ground truth):
@Override public void onDownstreamFormatChanged(int sourceId,Format format,int trigger,long mediaTimeMs){
  Log.i(tag,"String_Node_Str" + sourceId + "String_Node_Str"+ format.id);
}
Program: 110435
Project: 110435
Buggy source:
private static MediaFormat getAdjustedMediaFormat(MediaFormat format,long sampleOffsetUs){
  if (sampleOffsetUs != 0 && format.subsampleOffsetUs != MediaFormat.OFFSET_SAMPLE_RELATIVE) {
    return format.copyWithSubsampleOffsetUs(format.subsampleOffsetUs + sampleOffsetUs);
  }
  return format;
}

Fixed version (ground truth):
private static MediaFormat getAdjustedMediaFormat(MediaFormat format,long sampleOffsetUs){
  if (sampleOffsetUs != 0 && format != null && format.subsampleOffsetUs != MediaFormat.OFFSET_SAMPLE_RELATIVE) {
    return format.copyWithSubsampleOffsetUs(format.subsampleOffsetUs + sampleOffsetUs);
  }
  return format;
}
Program: 110437
Project: 110437
Buggy source:
private PeriodHolder findPeriodHolder(long positionUs){
  if (positionUs < periodHolders.valueAt(0).getAvailableStartTimeUs()) {
    return periodHolders.valueAt(0);
  }
  for (int i=0; i < periodHolders.size(); i++) {
    PeriodHolder periodHolder=periodHolders.valueAt(i);
    if (positionUs >= periodHolder.getAvailableStartTimeUs() && (periodHolder.isIndexUnbounded() || positionUs < periodHolder.getAvailableEndTimeUs())) {
      return periodHolder;
    }
  }
  return periodHolders.valueAt(periodHolders.size() - 1);
}

Fixed version (ground truth):
private PeriodHolder findPeriodHolder(long positionUs){
  if (positionUs < periodHolders.valueAt(0).getAvailableStartTimeUs()) {
    return periodHolders.valueAt(0);
  }
  for (int i=0; i < periodHolders.size() - 1; i++) {
    PeriodHolder periodHolder=periodHolders.valueAt(i);
    if (positionUs < periodHolder.getAvailableEndTimeUs()) {
      return periodHolder;
    }
  }
  return periodHolders.valueAt(periodHolders.size() - 1);
}
Program: 110440
Project: 110440
Buggy source:
@Override public void enable(int track,long positionUs){
  Assertions.checkState(state == STATE_PREPARED);
  Assertions.checkState(track == 0);
  state=STATE_ENABLED;
  chunkSource.enable();
  loadControl.register(this,bufferSizeContribution);
  downstreamFormat=null;
  downstreamMediaFormat=null;
  downstreamPositionUs=positionUs;
  lastSeekPositionUs=positionUs;
  restartFrom(positionUs);
}

Fixed version (ground truth):
@Override public void enable(int track,long positionUs){
  Assertions.checkState(state == STATE_PREPARED);
  Assertions.checkState(track == 0);
  state=STATE_ENABLED;
  chunkSource.enable();
  loadControl.register(this,bufferSizeContribution);
  downstreamFormat=null;
  downstreamMediaFormat=null;
  downstreamPositionUs=positionUs;
  lastSeekPositionUs=positionUs;
  pendingDiscontinuity=false;
  restartFrom(positionUs);
}
Program: 110441
Project: 110441
Buggy source:
@Override public void seekToUs(long positionUs){
  Assertions.checkState(state == STATE_ENABLED);
  lastSeekPositionUs=positionUs;
  if ((isPendingReset() ? pendingResetPositionUs : downstreamPositionUs) == positionUs) {
    return;
  }
  downstreamPositionUs=positionUs;
  boolean seekInsideBuffer=!isPendingReset() && sampleQueue.skipToKeyframeBefore(positionUs);
  if (seekInsideBuffer) {
    boolean haveSamples=!sampleQueue.isEmpty();
    while (haveSamples && mediaChunks.size() > 1 && mediaChunks.get(1).getFirstSampleIndex() <= sampleQueue.getReadIndex()) {
      mediaChunks.removeFirst();
    }
  }
 else {
    restartFrom(positionUs);
  }
  pendingDiscontinuity=true;
}

Fixed version (ground truth):
@Override public void seekToUs(long positionUs){
  Assertions.checkState(state == STATE_ENABLED);
  long currentPositionUs=isPendingReset() ? pendingResetPositionUs : downstreamPositionUs;
  downstreamPositionUs=positionUs;
  lastSeekPositionUs=positionUs;
  if (currentPositionUs == positionUs) {
    return;
  }
  boolean seekInsideBuffer=!isPendingReset() && sampleQueue.skipToKeyframeBefore(positionUs);
  if (seekInsideBuffer) {
    boolean haveSamples=!sampleQueue.isEmpty();
    while (haveSamples && mediaChunks.size() > 1 && mediaChunks.get(1).getFirstSampleIndex() <= sampleQueue.getReadIndex()) {
      mediaChunks.removeFirst();
    }
  }
 else {
    restartFrom(positionUs);
  }
  pendingDiscontinuity=true;
}
Program: 110442
Project: 110442
Buggy source:
@Override public void disable(int track){
  Assertions.checkState(state == STATE_ENABLED);
  Assertions.checkState(track == 0);
  pendingDiscontinuity=false;
  state=STATE_PREPARED;
  try {
    chunkSource.disable(mediaChunks);
  }
  finally {
    loadControl.unregister(this);
    if (loader.isLoading()) {
      loader.cancelLoading();
    }
 else {
      sampleQueue.clear();
      mediaChunks.clear();
      clearCurrentLoadable();
      loadControl.trimAllocator();
    }
  }
}

Fixed version (ground truth):
@Override public void disable(int track){
  Assertions.checkState(state == STATE_ENABLED);
  Assertions.checkState(track == 0);
  state=STATE_PREPARED;
  try {
    chunkSource.disable(mediaChunks);
  }
  finally {
    loadControl.unregister(this);
    if (loader.isLoading()) {
      loader.cancelLoading();
    }
 else {
      sampleQueue.clear();
      mediaChunks.clear();
      clearCurrentLoadable();
      loadControl.trimAllocator();
    }
  }
}
Program: 110443
Project: 110443
Buggy source:
@Override public void enable(int track,long positionUs){
  Assertions.checkState(prepared);
  Assertions.checkState(!trackEnabledStates[track]);
  enabledTrackCount++;
  trackEnabledStates[track]=true;
  pendingMediaFormat[track]=true;
  if (enabledTrackCount == 1) {
    seekToUs(positionUs);
  }
}

Fixed version (ground truth):
@Override public void enable(int track,long positionUs){
  Assertions.checkState(prepared);
  Assertions.checkState(!trackEnabledStates[track]);
  enabledTrackCount++;
  trackEnabledStates[track]=true;
  pendingMediaFormat[track]=true;
  if (enabledTrackCount == 1) {
    seekToUs(positionUs);
  }
  pendingDiscontinuities[track]=false;
}
Program: 110444
Project: 110444
Buggy source:
@Override public void seekToUs(long positionUs){
  Assertions.checkState(prepared);
  Assertions.checkState(enabledTrackCount > 0);
  if (!seekMap.isSeekable()) {
    positionUs=0;
  }
  lastSeekPositionUs=positionUs;
  if ((isPendingReset() ? pendingResetPositionUs : downstreamPositionUs) == positionUs) {
    return;
  }
  downstreamPositionUs=positionUs;
  boolean seekInsideBuffer=!isPendingReset();
  for (int i=0; seekInsideBuffer && i < sampleQueues.size(); i++) {
    seekInsideBuffer&=sampleQueues.valueAt(i).skipToKeyframeBefore(positionUs);
  }
  if (!seekInsideBuffer) {
    restartFrom(positionUs);
  }
  for (int i=0; i < pendingDiscontinuities.length; i++) {
    pendingDiscontinuities[i]=true;
  }
}

Fixed version (ground truth):
@Override public void seekToUs(long positionUs){
  Assertions.checkState(prepared);
  Assertions.checkState(enabledTrackCount > 0);
  if (!seekMap.isSeekable()) {
    positionUs=0;
  }
  long currentPositionUs=isPendingReset() ? pendingResetPositionUs : downstreamPositionUs;
  downstreamPositionUs=positionUs;
  lastSeekPositionUs=positionUs;
  if (currentPositionUs == positionUs) {
    return;
  }
  boolean seekInsideBuffer=!isPendingReset();
  for (int i=0; seekInsideBuffer && i < sampleQueues.size(); i++) {
    seekInsideBuffer&=sampleQueues.valueAt(i).skipToKeyframeBefore(positionUs);
  }
  if (!seekInsideBuffer) {
    restartFrom(positionUs);
  }
  for (int i=0; i < pendingDiscontinuities.length; i++) {
    pendingDiscontinuities[i]=true;
  }
}
Program: 110445
Project: 110445
Buggy source:
@Override public void disable(int track){
  Assertions.checkState(prepared);
  Assertions.checkState(trackEnabledStates[track]);
  enabledTrackCount--;
  trackEnabledStates[track]=false;
  pendingDiscontinuities[track]=false;
  if (enabledTrackCount == 0) {
    if (loader.isLoading()) {
      loader.cancelLoading();
    }
 else {
      clearState();
      allocator.trim(0);
    }
  }
}

Fixed version (ground truth):
@Override public void disable(int track){
  Assertions.checkState(prepared);
  Assertions.checkState(trackEnabledStates[track]);
  enabledTrackCount--;
  trackEnabledStates[track]=false;
  if (enabledTrackCount == 0) {
    downstreamPositionUs=Long.MIN_VALUE;
    if (loader.isLoading()) {
      loader.cancelLoading();
    }
 else {
      clearState();
      allocator.trim(0);
    }
  }
}
Program: 110446
Project: 110446
Buggy source:
@Override public void enable(int track,long positionUs){
  Assertions.checkState(prepared);
  Assertions.checkState(!trackEnabledStates[track]);
  enabledTrackCount++;
  trackEnabledStates[track]=true;
  downstreamMediaFormats[track]=null;
  downstreamFormat=null;
  if (!loadControlRegistered) {
    loadControl.register(this,bufferSizeContribution);
    loadControlRegistered=true;
  }
  if (enabledTrackCount == 1) {
    seekToUs(positionUs);
  }
}

Fixed version (ground truth):
@Override public void enable(int track,long positionUs){
  Assertions.checkState(prepared);
  Assertions.checkState(!trackEnabledStates[track]);
  enabledTrackCount++;
  trackEnabledStates[track]=true;
  downstreamMediaFormats[track]=null;
  downstreamFormat=null;
  if (!loadControlRegistered) {
    loadControl.register(this,bufferSizeContribution);
    loadControlRegistered=true;
  }
  if (enabledTrackCount == 1) {
    seekToUs(positionUs);
  }
  pendingDiscontinuities[track]=false;
}
Program: 110447
Project: 110447
Buggy source:
@Override public void seekToUs(long positionUs){
  Assertions.checkState(prepared);
  Assertions.checkState(enabledTrackCount > 0);
  lastSeekPositionUs=positionUs;
  if ((isPendingReset() ? pendingResetPositionUs : downstreamPositionUs) == positionUs) {
    return;
  }
  downstreamPositionUs=positionUs;
  for (int i=0; i < pendingDiscontinuities.length; i++) {
    pendingDiscontinuities[i]=true;
  }
  restartFrom(positionUs);
}

Fixed version (ground truth):
@Override public void seekToUs(long positionUs){
  Assertions.checkState(prepared);
  Assertions.checkState(enabledTrackCount > 0);
  long currentPositionUs=isPendingReset() ? pendingResetPositionUs : downstreamPositionUs;
  downstreamPositionUs=positionUs;
  lastSeekPositionUs=positionUs;
  if (currentPositionUs == positionUs) {
    return;
  }
  downstreamPositionUs=positionUs;
  for (int i=0; i < pendingDiscontinuities.length; i++) {
    pendingDiscontinuities[i]=true;
  }
  restartFrom(positionUs);
}
Program: 110448
Project: 110448
Buggy source:
@Override public void disable(int track){
  Assertions.checkState(prepared);
  Assertions.checkState(trackEnabledStates[track]);
  enabledTrackCount--;
  trackEnabledStates[track]=false;
  pendingDiscontinuities[track]=false;
  if (enabledTrackCount == 0) {
    if (loadControlRegistered) {
      loadControl.unregister(this);
      loadControlRegistered=false;
    }
    if (loader.isLoading()) {
      loader.cancelLoading();
    }
 else {
      clearState();
      loadControl.trimAllocator();
    }
  }
}

Fixed version (ground truth):
@Override public void disable(int track){
  Assertions.checkState(prepared);
  Assertions.checkState(trackEnabledStates[track]);
  enabledTrackCount--;
  trackEnabledStates[track]=false;
  if (enabledTrackCount == 0) {
    downstreamPositionUs=Long.MIN_VALUE;
    if (loadControlRegistered) {
      loadControl.unregister(this);
      loadControlRegistered=false;
    }
    if (loader.isLoading()) {
      loader.cancelLoading();
    }
 else {
      clearState();
      loadControl.trimAllocator();
    }
  }
}
Program: 110449
Project: 110449
Buggy source:
@Override public void onLoadError(Loadable loadable,IOException e){
  if (chunkSource.onChunkLoadError(currentLoadable,e)) {
    clearCurrentLoadable();
  }
 else {
    currentLoadableException=e;
    currentLoadableExceptionCount++;
    currentLoadableExceptionTimestamp=SystemClock.elapsedRealtime();
  }
  notifyLoadError(e);
  maybeStartLoading();
}

Fixed version (ground truth):
@Override public void onLoadError(Loadable loadable,IOException e){
  if (chunkSource.onChunkLoadError(currentLoadable,e)) {
    if (previousTsLoadable == null && !isPendingReset()) {
      pendingResetPositionUs=currentTsLoadable.startTimeUs;
    }
    clearCurrentLoadable();
  }
 else {
    currentLoadableException=e;
    currentLoadableExceptionCount++;
    currentLoadableExceptionTimestamp=SystemClock.elapsedRealtime();
  }
  notifyLoadError(e);
  maybeStartLoading();
}
Program: 110450
Project: 110450
Buggy source:
/** 
 * Checks two adaptation set types for consistency, returning the consistent type, or throwing an  {@link IllegalStateException} if the types are inconsistent.<p> Two types are consistent if they are equal, or if one is  {@link AdaptationSet#TYPE_UNKNOWN}. Where one of the types is   {@link AdaptationSet#TYPE_UNKNOWN}, the other is returned.
 * @param firstType The first type.
 * @param secondType The second type.
 * @return The consistent type.
 */
private int checkAdaptationSetTypeConsistency(int firstType,int secondType){
  if (firstType == AdaptationSet.TYPE_UNKNOWN) {
    return secondType;
  }
 else   if (secondType == AdaptationSet.TYPE_UNKNOWN) {
    return firstType;
  }
 else {
    Assertions.checkState(firstType == secondType);
    return firstType;
  }
}

Fixed version (ground truth):
/** 
 * Checks two adaptation set types for consistency, returning the consistent type, or throwing an  {@link IllegalStateException} if the types are inconsistent.<p> Two types are consistent if they are equal, or if one is  {@link AdaptationSet#TYPE_UNKNOWN}. Where one of the types is   {@link AdaptationSet#TYPE_UNKNOWN}, the other is returned.
 * @param firstType The first type.
 * @param secondType The second type.
 * @return The consistent type.
 */
private static int checkAdaptationSetTypeConsistency(int firstType,int secondType){
  if (firstType == AdaptationSet.TYPE_UNKNOWN) {
    return secondType;
  }
 else   if (secondType == AdaptationSet.TYPE_UNKNOWN) {
    return firstType;
  }
 else {
    Assertions.checkState(firstType == secondType);
    return firstType;
  }
}
Program: 110452
Project: 110452
Buggy source:
/** 
 * Parses an AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
 * @param audioSpecificConfig The AudioSpecificConfig to parse.
 * @return A pair consisting of the sample rate in Hz and the channel count.
 */
public static Pair<Integer,Integer> parseAudioSpecificConfig(byte[] audioSpecificConfig){
  int audioObjectType=(audioSpecificConfig[0] >> 3) & 0x1F;
  if (audioObjectType < 31) {
    int byteOffset=audioObjectType == 5 || audioObjectType == 29 ? 1 : 0;
    int frequencyIndex=(audioSpecificConfig[byteOffset] & 0x7) << 1 | ((audioSpecificConfig[byteOffset + 1] >> 7) & 0x1);
    Assertions.checkState(frequencyIndex < 13);
    int sampleRate=AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex];
    int channelCount=(audioSpecificConfig[byteOffset + 1] >> 3) & 0xF;
    return Pair.create(sampleRate,channelCount);
  }
 else {
    int frequencyIndex=(audioSpecificConfig[1] & 0x1E) >> 1;
    Assertions.checkState(frequencyIndex < 13);
    int sampleRate=AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex];
    int channelCount=(audioSpecificConfig[1] & 0x01) << 2 | ((audioSpecificConfig[2] >> 6) & 0x03);
    return Pair.create(sampleRate,channelCount);
  }
}

Fixed version (ground truth):
/** 
 * Parses an AudioSpecificConfig, as defined in ISO 14496-3 1.6.2.1
 * @param audioSpecificConfig The AudioSpecificConfig to parse.
 * @return A pair consisting of the sample rate in Hz and the channel count.
 */
public static Pair<Integer,Integer> parseAudioSpecificConfig(byte[] audioSpecificConfig){
  int audioObjectType=(audioSpecificConfig[0] >> 3) & 0x1F;
  if (audioObjectType < 31) {
    int byteOffset=audioObjectType == 5 || audioObjectType == 29 ? 1 : 0;
    int frequencyIndex=(audioSpecificConfig[byteOffset] & 0x7) << 1 | ((audioSpecificConfig[byteOffset + 1] >> 7) & 0x1);
    Assertions.checkState(frequencyIndex < 13);
    int sampleRate=AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex];
    int channelCount=AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE[(audioSpecificConfig[byteOffset + 1] >> 3) & 0xF];
    return Pair.create(sampleRate,channelCount);
  }
 else {
    int frequencyIndex=(audioSpecificConfig[1] & 0x1E) >> 1;
    Assertions.checkState(frequencyIndex < 13);
    int sampleRate=AUDIO_SPECIFIC_CONFIG_SAMPLING_RATE_TABLE[frequencyIndex];
    int channelCount=AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE[(audioSpecificConfig[1] & 0x01) << 3 | ((audioSpecificConfig[2] >> 5) & 0x07)];
    return Pair.create(sampleRate,channelCount);
  }
}
Program: 110454
Project: 110454
Buggy source:
@Override public void continueBuffering(long playbackPositionUs){
  if (manifestFetcher == null || !currentManifest.isLive || fatalError != null) {
    return;
  }
  SmoothStreamingManifest newManifest=manifestFetcher.getManifest();
  if (currentManifest != newManifest && newManifest != null) {
    StreamElement currentElement=getElement(currentManifest);
    StreamElement newElement=getElement(newManifest);
    if (newElement.chunkCount == 0) {
      currentManifestChunkOffset+=currentElement.chunkCount;
    }
 else     if (currentElement.chunkCount > 0) {
      currentManifestChunkOffset+=currentElement.getChunkIndex(newElement.getStartTimeUs(0));
    }
    currentManifest=newManifest;
    finishedCurrentManifest=false;
  }
  if (finishedCurrentManifest && (SystemClock.elapsedRealtime() > manifestFetcher.getManifestLoadTimestamp() + MINIMUM_MANIFEST_REFRESH_PERIOD_MS)) {
    manifestFetcher.requestRefresh();
  }
}

Fixed version (ground truth):
@Override public void continueBuffering(long playbackPositionUs){
  if (manifestFetcher == null || !currentManifest.isLive || fatalError != null) {
    return;
  }
  SmoothStreamingManifest newManifest=manifestFetcher.getManifest();
  if (currentManifest != newManifest && newManifest != null) {
    StreamElement currentElement=getElement(currentManifest);
    int currentElementChunkCount=currentElement.chunkCount;
    StreamElement newElement=getElement(newManifest);
    if (currentElementChunkCount == 0 || newElement.chunkCount == 0) {
      currentManifestChunkOffset+=currentElementChunkCount;
    }
 else {
      long currentElementEndTimeUs=currentElement.getStartTimeUs(currentElementChunkCount - 1) + currentElement.getChunkDurationUs(currentElementChunkCount - 1);
      long newElementStartTimeUs=newElement.getStartTimeUs(0);
      if (currentElementEndTimeUs <= newElementStartTimeUs) {
        currentManifestChunkOffset+=currentElementChunkCount;
      }
 else {
        currentManifestChunkOffset+=currentElement.getChunkIndex(newElementStartTimeUs);
      }
    }
    currentManifest=newManifest;
    finishedCurrentManifest=false;
  }
  if (finishedCurrentManifest && (SystemClock.elapsedRealtime() > manifestFetcher.getManifestLoadTimestamp() + MINIMUM_MANIFEST_REFRESH_PERIOD_MS)) {
    manifestFetcher.requestRefresh();
  }
}
Program: 110457
Project: 110457
Buggy source:
@Override public void read(ExtractorInput input) throws IOException, InterruptedException {
  if (!input.readFully(tsPacketBuffer.data,0,TS_PACKET_SIZE)) {
    return;
  }
  tsPacketBuffer.setPosition(0);
  int syncByte=tsPacketBuffer.readUnsignedByte();
  if (syncByte != TS_SYNC_BYTE) {
    return;
  }
  tsPacketBuffer.readBytes(tsScratch,3);
  tsScratch.skipBits(1);
  boolean payloadUnitStartIndicator=tsScratch.readBit();
  tsScratch.skipBits(1);
  int pid=tsScratch.readBits(13);
  tsScratch.skipBits(2);
  boolean adaptationFieldExists=tsScratch.readBit();
  boolean payloadExists=tsScratch.readBit();
  if (adaptationFieldExists) {
    int adaptationFieldLength=tsPacketBuffer.readUnsignedByte();
    tsPacketBuffer.skip(adaptationFieldLength);
  }
  if (payloadExists) {
    TsPayloadReader payloadReader=tsPayloadReaders.get(pid);
    if (payloadReader != null) {
      payloadReader.consume(tsPacketBuffer,payloadUnitStartIndicator,output);
    }
  }
}

Fixed version (ground truth):
@Override public void read(ExtractorInput input) throws IOException, InterruptedException {
  if (!input.readFully(tsPacketBuffer.data,0,TS_PACKET_SIZE)) {
    return;
  }
  tsPacketBuffer.setPosition(0);
  tsPacketBuffer.setLimit(TS_PACKET_SIZE);
  int syncByte=tsPacketBuffer.readUnsignedByte();
  if (syncByte != TS_SYNC_BYTE) {
    return;
  }
  tsPacketBuffer.readBytes(tsScratch,3);
  tsScratch.skipBits(1);
  boolean payloadUnitStartIndicator=tsScratch.readBit();
  tsScratch.skipBits(1);
  int pid=tsScratch.readBits(13);
  tsScratch.skipBits(2);
  boolean adaptationFieldExists=tsScratch.readBit();
  boolean payloadExists=tsScratch.readBit();
  if (adaptationFieldExists) {
    int adaptationFieldLength=tsPacketBuffer.readUnsignedByte();
    tsPacketBuffer.skip(adaptationFieldLength);
  }
  if (payloadExists) {
    TsPayloadReader payloadReader=tsPayloadReaders.get(pid);
    if (payloadReader != null) {
      payloadReader.consume(tsPacketBuffer,payloadUnitStartIndicator,output);
    }
  }
}
Program: 110458
Project: 110458
Buggy source:
@Override public boolean skipFully(int length) throws IOException, InterruptedException {
  int remaining=length;
  while (remaining > 0) {
    if (Thread.interrupted()) {
      throw new InterruptedException();
    }
    int bytesRead=dataSource.read(SCRATCH_SPACE,0,remaining);
    if (bytesRead == -1) {
      isEnded=true;
      return true;
    }
    remaining-=bytesRead;
  }
  position+=length;
  return false;
}

Fixed version (ground truth):
@Override public boolean skipFully(int length) throws IOException, InterruptedException {
  int remaining=length;
  while (remaining > 0) {
    if (Thread.interrupted()) {
      throw new InterruptedException();
    }
    int bytesRead=dataSource.read(SCRATCH_SPACE,0,Math.min(SCRATCH_SPACE.length,remaining));
    if (bytesRead == -1) {
      isEnded=true;
      return false;
    }
    remaining-=bytesRead;
  }
  position+=length;
  return true;
}
Program: 110459
Project: 110459
Buggy source:
private static int indexOfEOS(byte[] data,int fromIndex,int encodingByte){
  int terminationPos=indexOf(data,fromIndex,(byte)0);
  if (encodingByte == ID3_TEXT_ENCODING_ISO_8859_1 || encodingByte == ID3_TEXT_ENCODING_UTF_8) {
    return terminationPos;
  }
  while (terminationPos < data.length - 1) {
    if (data[terminationPos + 1] == (byte)0) {
      return terminationPos + 1;
    }
    terminationPos=indexOf(data,terminationPos + 1,(byte)0);
  }
  return data.length;
}

Fixed version (ground truth):
private static int indexOfEOS(byte[] data,int fromIndex,int encodingByte){
  int terminationPos=indexOf(data,fromIndex,(byte)0);
  if (encodingByte == ID3_TEXT_ENCODING_ISO_8859_1 || encodingByte == ID3_TEXT_ENCODING_UTF_8) {
    return terminationPos;
  }
  while (terminationPos < data.length - 1) {
    if (data[terminationPos + 1] == (byte)0) {
      return terminationPos;
    }
    terminationPos=indexOf(data,terminationPos + 1,(byte)0);
  }
  return data.length;
}
Program: 110462
Project: 110462
Buggy source:
private void feedNalUnitTargetEnd(long pesTimeUs,int discardPadding){
  sps.endNalUnit(discardPadding);
  pps.endNalUnit(discardPadding);
  if (sei.endNalUnit(discardPadding)) {
    seiReader.read(sei.nalData,0,pesTimeUs);
  }
}

Fixed version (ground truth):
private void feedNalUnitTargetEnd(long pesTimeUs,int discardPadding){
  sps.endNalUnit(discardPadding);
  pps.endNalUnit(discardPadding);
  if (sei.endNalUnit(discardPadding)) {
    int unescapedLength=unescapeStream(sei.nalData,sei.nalLength);
    seiReader.read(sei.nalData,0,unescapedLength,pesTimeUs);
  }
}
Program: 110464
Project: 110464
Buggy source:
public H264Reader(BufferPool bufferPool,SeiReader seiReader){
  super(bufferPool);
  this.seiReader=seiReader;
  prefixFlags=new boolean[3];
  sps=new NalUnitTargetBuffer(NAL_UNIT_TYPE_SPS,128);
  pps=new NalUnitTargetBuffer(NAL_UNIT_TYPE_PPS,128);
  sei=new NalUnitTargetBuffer(NAL_UNIT_TYPE_SEI,128);
}

Fixed version (ground truth):
public H264Reader(BufferPool bufferPool,SeiReader seiReader){
  super(bufferPool);
  this.seiReader=seiReader;
  prefixFlags=new boolean[3];
  sps=new NalUnitTargetBuffer(NAL_UNIT_TYPE_SPS,128);
  pps=new NalUnitTargetBuffer(NAL_UNIT_TYPE_PPS,128);
  sei=new NalUnitTargetBuffer(NAL_UNIT_TYPE_SEI,128);
  scratchEscapePositions=new int[10];
}
Program: 110465
Project: 110465
Buggy source:
/** 
 * Replaces occurrences of [0, 0, 3] with [0, 0]. <p> See ISO/IEC 14496-10:2005(E) page 36 for more information.
 */
private byte[] unescapeStream(byte[] data,int offset,int limit){
  int position=offset;
  List<Integer> escapePositions=new ArrayList<Integer>();
  while (position < limit) {
    position=findNextUnescapeIndex(data,position,limit);
    if (position < limit) {
      escapePositions.add(position);
      position+=3;
    }
  }
  int escapeCount=escapePositions.size();
  int escapedPosition=offset;
  int unescapedPosition=0;
  byte[] unescapedData=new byte[limit - offset - escapeCount];
  for (int i=0; i < escapeCount; i++) {
    int nextEscapePosition=escapePositions.get(i);
    int copyLength=nextEscapePosition - escapedPosition;
    System.arraycopy(data,escapedPosition,unescapedData,unescapedPosition,copyLength);
    escapedPosition+=copyLength + 3;
    unescapedPosition+=copyLength + 2;
  }
  int remainingLength=unescapedData.length - unescapedPosition;
  System.arraycopy(data,escapedPosition,unescapedData,unescapedPosition,remainingLength);
  return unescapedData;
}

Fixed version (ground truth):
/** 
 * Unescapes   {@code data} up to the specified limit, replacing occurrences of [0, 0, 3] with[0, 0]. The unescaped data is returned in-place, with the return value indicating its length. <p> See ISO/IEC 14496-10:2005(E) page 36 for more information.
 * @param data The data to unescape.
 * @param limit The limit (exclusive) of the data to unescape.
 * @return The length of the unescaped data.
 */
private int unescapeStream(byte[] data,int limit){
  int position=0;
  scratchEscapeCount=0;
  while (position < limit) {
    position=findNextUnescapeIndex(data,position,limit);
    if (position < limit) {
      if (scratchEscapePositions.length <= scratchEscapeCount) {
        scratchEscapePositions=Arrays.copyOf(scratchEscapePositions,scratchEscapePositions.length * 2);
      }
      scratchEscapePositions[scratchEscapeCount++]=position;
      position+=3;
    }
  }
  int unescapedLength=limit - scratchEscapeCount;
  int escapedPosition=0;
  int unescapedPosition=0;
  for (int i=0; i < scratchEscapeCount; i++) {
    int nextEscapePosition=scratchEscapePositions[i];
    int copyLength=nextEscapePosition - escapedPosition;
    System.arraycopy(data,escapedPosition,data,unescapedPosition,copyLength);
    escapedPosition+=copyLength + 3;
    unescapedPosition+=copyLength + 2;
  }
  int remainingLength=unescapedLength - unescapedPosition;
  System.arraycopy(data,escapedPosition,data,unescapedPosition,remainingLength);
  return unescapedLength;
}
Program: 110466
Project: 110466
Buggy source:
public void read(byte[] data,int position,long pesTimeUs){
  seiBuffer.reset(data,data.length);
  seiBuffer.setPosition(position + 4);
  int ccDataSize=Eia608Parser.parseHeader(seiBuffer);
  if (ccDataSize > 0) {
    startSample(pesTimeUs);
    appendData(seiBuffer,ccDataSize);
    commitSample(true);
  }
}

Fixed version (ground truth):
public void read(byte[] data,int position,int limit,long pesTimeUs){
  seiBuffer.reset(data,limit);
  seiBuffer.setPosition(position + 4);
  int b;
  while (seiBuffer.bytesLeft() > 1) {
    int payloadType=0;
    do {
      b=seiBuffer.readUnsignedByte();
      payloadType+=b;
    }
 while (b == 0xFF);
    int payloadSize=0;
    do {
      b=seiBuffer.readUnsignedByte();
      payloadSize+=b;
    }
 while (b == 0xFF);
    if (Eia608Parser.inspectSeiMessage(payloadType,payloadSize,seiBuffer)) {
      startSample(pesTimeUs);
      appendData(seiBuffer,payloadSize);
      commitSample(true);
    }
 else {
      seiBuffer.skip(payloadSize);
    }
  }
}
Program: 110468
Project: 110468
Buggy source:
@Override public int read(byte[] buffer,int offset,int length) throws IOException {
  System.arraycopy(data,readPosition,buffer,offset,length);
  readPosition+=length;
  return length;
}

Fixed version (ground truth):
@Override public int read(byte[] buffer,int offset,int length) throws IOException {
  if (remainingBytes == 0) {
    return -1;
  }
  length=Math.min(length,remainingBytes);
  System.arraycopy(data,readPosition,buffer,offset,length);
  readPosition+=length;
  remainingBytes-=length;
  return length;
}
Program: 110469
Project: 110469
Buggy source:
/** 
 * @param data The data to be read.
 */
public ByteArrayDataSource(byte[] data){
  this.data=Assertions.checkNotNull(data);
}

Fixed version (ground truth):
/** 
 * @param data The data to be read.
 */
public ByteArrayDataSource(byte[] data){
  Assertions.checkNotNull(data);
  Assertions.checkArgument(data.length > 0);
  this.data=data;
}
Program: 110470
Project: 110470
Buggy source:
@Override public long open(DataSpec dataSpec) throws IOException {
  if (dataSpec.length == C.LENGTH_UNBOUNDED) {
    Assertions.checkArgument(dataSpec.position < data.length);
  }
 else {
    Assertions.checkArgument(dataSpec.position + dataSpec.length <= data.length);
  }
  readPosition=(int)dataSpec.position;
  return (dataSpec.length == C.LENGTH_UNBOUNDED) ? (data.length - dataSpec.position) : dataSpec.length;
}

Fixed version (ground truth):
@Override public long open(DataSpec dataSpec) throws IOException {
  readPosition=(int)dataSpec.position;
  remainingBytes=(int)((dataSpec.length == C.LENGTH_UNBOUNDED) ? (data.length - dataSpec.position) : dataSpec.length);
  if (remainingBytes <= 0 || readPosition + remainingBytes > data.length) {
    throw new IOException("String_Node_Str" + readPosition + "String_Node_Str"+ dataSpec.length+ "String_Node_Str"+ data.length);
  }
  return remainingBytes;
}
Program: 110471
Project: 110471
Buggy source:
/** 
 * Reads a single unsigned byte.
 * @return The value of the parsed byte.
 */
public int readUnsignedByte(){
  byte b;
  if (bitOffset != 0) {
    b=(byte)((data[byteOffset] << bitOffset) | (data[byteOffset + 1] >> (8 - bitOffset)));
  }
 else {
    b=data[byteOffset];
  }
  byteOffset++;
  return b & 0xFF;
}

Fixed version (ground truth):
/** 
 * Reads a single unsigned byte.
 * @return The value of the parsed byte.
 */
public int readUnsignedByte(){
  byte b;
  if (bitOffset != 0) {
    b=(byte)((data[byteOffset] << bitOffset) | ((data[byteOffset + 1] & 0xFF) >> (8 - bitOffset)));
  }
 else {
    b=data[byteOffset];
  }
  byteOffset++;
  return b & 0xFF;
}
Program: 110472
Project: 110472
Buggy source:
/** 
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param evaluator Selects from the available formats.
 * @param representations The representations to be considered by the source.
 */
public DashChunkSource(DataSource dataSource,FormatEvaluator evaluator,Representation... representations){
  this.dataSource=dataSource;
  this.evaluator=evaluator;
  this.formats=new Format[representations.length];
  this.extractors=new HashMap<String,Extractor>();
  this.segmentIndexes=new HashMap<String,DashSegmentIndex>();
  this.representations=new HashMap<String,Representation>();
  this.trackInfo=new TrackInfo(representations[0].format.mimeType,representations[0].periodDurationMs * 1000);
  this.evaluation=new Evaluation();
  int maxWidth=0;
  int maxHeight=0;
  for (int i=0; i < representations.length; i++) {
    formats[i]=representations[i].format;
    maxWidth=Math.max(formats[i].width,maxWidth);
    maxHeight=Math.max(formats[i].height,maxHeight);
    Extractor extractor=mimeTypeIsWebm(formats[i].mimeType) ? new WebmExtractor() : new FragmentedMp4Extractor();
    extractors.put(formats[i].id,extractor);
    this.representations.put(formats[i].id,representations[i]);
    DashSegmentIndex segmentIndex=representations[i].getIndex();
    if (segmentIndex != null) {
      segmentIndexes.put(formats[i].id,segmentIndex);
    }
  }
  this.maxWidth=maxWidth;
  this.maxHeight=maxHeight;
  Arrays.sort(formats,new DecreasingBandwidthComparator());
}

Fixed version (ground truth):
/** 
 * @param dataSource A {@link DataSource} suitable for loading the media data.
 * @param evaluator Selects from the available formats.
 * @param representations The representations to be considered by the source.
 */
public DashChunkSource(DataSource dataSource,FormatEvaluator evaluator,Representation... representations){
  long periodDurationUs=(representations[0].periodDurationMs == -1) ? -1 : representations[0].periodDurationMs * 1000;
  this.dataSource=dataSource;
  this.evaluator=evaluator;
  this.formats=new Format[representations.length];
  this.extractors=new HashMap<String,Extractor>();
  this.segmentIndexes=new HashMap<String,DashSegmentIndex>();
  this.representations=new HashMap<String,Representation>();
  this.trackInfo=new TrackInfo(representations[0].format.mimeType,periodDurationUs);
  this.evaluation=new Evaluation();
  int maxWidth=0;
  int maxHeight=0;
  for (int i=0; i < representations.length; i++) {
    formats[i]=representations[i].format;
    maxWidth=Math.max(formats[i].width,maxWidth);
    maxHeight=Math.max(formats[i].height,maxHeight);
    Extractor extractor=mimeTypeIsWebm(formats[i].mimeType) ? new WebmExtractor() : new FragmentedMp4Extractor();
    extractors.put(formats[i].id,extractor);
    this.representations.put(formats[i].id,representations[i]);
    DashSegmentIndex segmentIndex=representations[i].getIndex();
    if (segmentIndex != null) {
      segmentIndexes.put(formats[i].id,segmentIndex);
    }
  }
  this.maxWidth=maxWidth;
  this.maxHeight=maxHeight;
  Arrays.sort(formats,new DecreasingBandwidthComparator());
}
Program: 110473
Project: 110473
Buggy source:
public final long getSegmentTimeUs(int sequenceNumber){
  long unscaledSegmentTime;
  if (segmentTimeline != null) {
    unscaledSegmentTime=segmentTimeline.get(sequenceNumber - startNumber).startTime - presentationTimeOffset;
  }
 else {
    unscaledSegmentTime=(sequenceNumber - startNumber) * duration;
  }
  return (unscaledSegmentTime * 1000000) / timescale;
}

Fixed version (ground truth):
public final long getSegmentTimeUs(int sequenceNumber){
  long unscaledSegmentTime;
  if (segmentTimeline != null) {
    unscaledSegmentTime=segmentTimeline.get(sequenceNumber - startNumber).startTime - presentationTimeOffset;
  }
 else {
    unscaledSegmentTime=(sequenceNumber - startNumber) * duration;
  }
  return Util.scaleLargeTimestamp(unscaledSegmentTime,1000000,timescale);
}
Program: 110474
Project: 110474
Buggy source:
public StreamElement(Uri baseUri,String chunkTemplate,int type,String subType,long timescale,String name,int qualityLevels,int maxWidth,int maxHeight,int displayWidth,int displayHeight,String language,TrackElement[] tracks,List<Long> chunkStartTimes,long lastChunkDuration){
  this.baseUri=baseUri;
  this.chunkTemplate=chunkTemplate;
  this.type=type;
  this.subType=subType;
  this.timescale=timescale;
  this.name=name;
  this.qualityLevels=qualityLevels;
  this.maxWidth=maxWidth;
  this.maxHeight=maxHeight;
  this.displayWidth=displayWidth;
  this.displayHeight=displayHeight;
  this.language=language;
  this.tracks=tracks;
  this.chunkCount=chunkStartTimes.size();
  this.chunkStartTimes=chunkStartTimes;
  chunkStartTimesUs=new long[chunkStartTimes.size()];
  if (timescale >= MICROS_PER_SECOND && (timescale % MICROS_PER_SECOND) == 0) {
    long divisionFactor=timescale / MICROS_PER_SECOND;
    for (int i=0; i < chunkStartTimesUs.length; i++) {
      chunkStartTimesUs[i]=chunkStartTimes.get(i) / divisionFactor;
    }
    lastChunkDurationUs=lastChunkDuration / divisionFactor;
  }
 else   if (timescale < MICROS_PER_SECOND && (MICROS_PER_SECOND % timescale) == 0) {
    long multiplicationFactor=MICROS_PER_SECOND / timescale;
    for (int i=0; i < chunkStartTimesUs.length; i++) {
      chunkStartTimesUs[i]=chunkStartTimes.get(i) * multiplicationFactor;
    }
    lastChunkDurationUs=lastChunkDuration * multiplicationFactor;
  }
 else {
    double multiplicationFactor=(double)MICROS_PER_SECOND / timescale;
    for (int i=0; i < chunkStartTimesUs.length; i++) {
      chunkStartTimesUs[i]=(long)(chunkStartTimes.get(i) * multiplicationFactor);
    }
    lastChunkDurationUs=(long)(lastChunkDuration * multiplicationFactor);
  }
}

Fixed version (ground truth):
public StreamElement(Uri baseUri,String chunkTemplate,int type,String subType,long timescale,String name,int qualityLevels,int maxWidth,int maxHeight,int displayWidth,int displayHeight,String language,TrackElement[] tracks,List<Long> chunkStartTimes,long lastChunkDuration){
  this.baseUri=baseUri;
  this.chunkTemplate=chunkTemplate;
  this.type=type;
  this.subType=subType;
  this.timescale=timescale;
  this.name=name;
  this.qualityLevels=qualityLevels;
  this.maxWidth=maxWidth;
  this.maxHeight=maxHeight;
  this.displayWidth=displayWidth;
  this.displayHeight=displayHeight;
  this.language=language;
  this.tracks=tracks;
  this.chunkCount=chunkStartTimes.size();
  this.chunkStartTimes=chunkStartTimes;
  lastChunkDurationUs=Util.scaleLargeTimestamp(lastChunkDuration,MICROS_PER_SECOND,timescale);
  chunkStartTimesUs=Util.scaleLargeTimestamps(chunkStartTimes,MICROS_PER_SECOND,timescale);
}
Program: 110475
Project: 110475
Buggy source:
public SmoothStreamingManifest(int majorVersion,int minorVersion,long timescale,long duration,long dvrWindowLength,int lookAheadCount,boolean isLive,ProtectionElement protectionElement,StreamElement[] streamElements){
  this.majorVersion=majorVersion;
  this.minorVersion=minorVersion;
  this.timescale=timescale;
  this.lookAheadCount=lookAheadCount;
  this.isLive=isLive;
  this.protectionElement=protectionElement;
  this.streamElements=streamElements;
  if (timescale >= MICROS_PER_SECOND && (timescale % MICROS_PER_SECOND) == 0) {
    long divisionFactor=timescale / MICROS_PER_SECOND;
    dvrWindowLengthUs=dvrWindowLength / divisionFactor;
    durationUs=duration / divisionFactor;
  }
 else   if (timescale < MICROS_PER_SECOND && (MICROS_PER_SECOND % timescale) == 0) {
    long multiplicationFactor=MICROS_PER_SECOND / timescale;
    dvrWindowLengthUs=dvrWindowLength * multiplicationFactor;
    durationUs=duration * multiplicationFactor;
  }
 else {
    double multiplicationFactor=(double)MICROS_PER_SECOND / timescale;
    dvrWindowLengthUs=(long)(dvrWindowLength * multiplicationFactor);
    durationUs=(long)(duration * multiplicationFactor);
  }
}

Fixed version (ground truth):
public SmoothStreamingManifest(int majorVersion,int minorVersion,long timescale,long duration,long dvrWindowLength,int lookAheadCount,boolean isLive,ProtectionElement protectionElement,StreamElement[] streamElements){
  this.majorVersion=majorVersion;
  this.minorVersion=minorVersion;
  this.timescale=timescale;
  this.lookAheadCount=lookAheadCount;
  this.isLive=isLive;
  this.protectionElement=protectionElement;
  this.streamElements=streamElements;
  dvrWindowLengthUs=Util.scaleLargeTimestamp(dvrWindowLength,MICROS_PER_SECOND,timescale);
  durationUs=Util.scaleLargeTimestamp(duration,MICROS_PER_SECOND,timescale);
}
Program: 110476
Project: 110476
Buggy source:
private static long parseDateTime(XmlPullParser xpp,String name,long defaultValue) throws ParseException {
  String value=xpp.getAttributeValue(null,name);
  if (value != null) {
    SimpleDateFormat parser=new SimpleDateFormat("String_Node_Str",Locale.US);
    return parser.parse(value).getTime();
  }
  return defaultValue;
}

Fixed version (ground truth):
static long parseDateTime(String value) throws ParseException {
  Matcher matcher=DATE_TIME_PATTERN.matcher(value);
  if (!matcher.matches()) {
    throw new ParseException("String_Node_Str" + value,0);
  }
  int timezoneShift;
  if (matcher.group(9) == null) {
    timezoneShift=0;
  }
 else   if (matcher.group(9).equalsIgnoreCase("String_Node_Str")) {
    timezoneShift=0;
  }
 else {
    timezoneShift=((Integer.valueOf(matcher.group(12)) * 60 + Integer.valueOf(matcher.group(13))));
    if (matcher.group(11).equals("String_Node_Str")) {
      timezoneShift*=-1;
    }
  }
  Calendar dateTime=new GregorianCalendar(TimeZone.getTimeZone("String_Node_Str"));
  dateTime.clear();
  dateTime.set(Integer.valueOf(matcher.group(1)),Integer.valueOf(matcher.group(2)) - 1,Integer.valueOf(matcher.group(3)),Integer.valueOf(matcher.group(4)),Integer.valueOf(matcher.group(5)),Integer.valueOf(matcher.group(6)));
  if (!TextUtils.isEmpty(matcher.group(8))) {
    final BigDecimal bd=new BigDecimal("String_Node_Str" + matcher.group(8));
    dateTime.set(Calendar.MILLISECOND,bd.movePointRight(3).intValue());
  }
  long time=dateTime.getTimeInMillis();
  if (timezoneShift != 0) {
    time-=timezoneShift * 60000;
  }
  return time;
}