nus-yam/ex-repair huggingface dataset:
Program: 103809
Project: 103809
Buggy source:
/** 
 * Removes the corresponding <tt>ConferenceMemberPanel</tt> from this container when a <tt>ConferenceMember</tt> has been removed from the corresponding conference.
 * @param conferenceEvent the <tt>CallPeerConferenceEvent</tt> that has beentriggered
 */
public void conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent){
  ConferenceMember member=conferenceEvent.getConferenceMember();
  this.removeConferenceMemberPanel(member);
}

Fixed version (ground truth):
/** 
 * Removes the corresponding <tt>ConferenceMemberPanel</tt> from this container when a <tt>ConferenceMember</tt> has been removed from the corresponding conference.
 * @param conferenceEvent the <tt>CallPeerConferenceEvent</tt> that has beentriggered
 */
public void conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent){
  ConferenceMember member=conferenceEvent.getConferenceMember();
  if (callPeer.getConferenceMemberCount() == 0 && isFocusUI())   setFocusUI(false);
  this.removeConferenceMemberPanel(member);
}
Program: 103810
Project: 103810
Buggy source:
/** 
 * Delivers <tt>SoundLevelChangeEvent</tt>s on stream sound level change.
 * @param evt the notification event containing the list of changes.
 */
public void soundLevelChanged(SoundLevelChangeEvent evt){
  Object evtSource=evt.getSource();
  if ((evtSource instanceof CallPeer) && ((CallPeer)evtSource).isConferenceFocus())   updateSoundBar(evt.getLevel());
}

Fixed version (ground truth):
/** 
 * Delivers <tt>SoundLevelChangeEvent</tt>s on stream sound level change.
 * @param evt the notification event containing the list of changes.
 */
public void soundLevelChanged(SoundLevelChangeEvent evt){
  Object evtSource=evt.getSource();
  if (evtSource.equals(callPeer)) {
    updateSoundBar(evt.getLevel());
  }
}
Program: 103811
Project: 103811
Buggy source:
/** 
 * Enables or disables the conference focus UI depending on the change. When a peer changes its status from focus to not focus or the reverse. we must change its listeners. If the peer is focus we use conference member lister, cause we will receive its status and the statuses of its conference members. And if it is not a focus we must listen with stream sound level listener
 * @param conferenceEvent the conference event
 */
public void conferenceFocusChanged(CallPeerConferenceEvent conferenceEvent){
  if (conferenceEvent.getSourceCallPeer().equals(callPeer))   setFocusUI(callPeer.isConferenceFocus());
}

Fixed version (ground truth):
/** 
 * Enables or disables the conference focus UI depending on the change. When a peer changes its status from focus to not focus or the reverse. we must change its listeners. If the peer is focus we use conference member lister, cause we will receive its status and the statuses of its conference members. And if it is not a focus we must listen with stream sound level listener
 * @param conferenceEvent the conference event
 */
public void conferenceFocusChanged(CallPeerConferenceEvent conferenceEvent){
  if (conferenceEvent.getSourceCallPeer().equals(callPeer) && !callPeer.isConferenceFocus() && isFocusUI())   setFocusUI(false);
}
Program: 103812
Project: 103812
Buggy source:
/** 
 * Adds a <tt>ConferenceMemberPanel</tt> to this container when a <tt>ConferenceMember</tt> has been added to the corresponding conference.
 * @param conferenceEvent the <tt>CallPeerConferenceEvent</tt> that has beentriggered
 */
public void conferenceMemberAdded(CallPeerConferenceEvent conferenceEvent){
  ConferenceMember member=conferenceEvent.getConferenceMember();
  String memberAddress=member.getAddress();
  String localUserAddress=callPeer.getProtocolProvider().getAccountID().getAccountAddress();
  if (!addressesAreEqual(memberAddress,localUserAddress))   addConferenceMemberPanel(member);
}

Fixed version (ground truth):
/** 
 * Adds a <tt>ConferenceMemberPanel</tt> to this container when a <tt>ConferenceMember</tt> has been added to the corresponding conference.
 * @param conferenceEvent the <tt>CallPeerConferenceEvent</tt> that has beentriggered
 */
public void conferenceMemberAdded(CallPeerConferenceEvent conferenceEvent){
  ConferenceMember member=conferenceEvent.getConferenceMember();
  String memberAddress=member.getAddress();
  String localUserAddress=callPeer.getProtocolProvider().getAccountID().getAccountAddress();
  if (!isFocusUI())   setFocusUI(true);
  if (!addressesAreEqual(memberAddress,localUserAddress))   addConferenceMemberPanel(member);
}
Program: 103813
Project: 103813
Buggy source:
/** 
 * Creates a new bi-dimensional array containing all entries (if any) from the <tt>levels</tt> matrix and an extra entry for the specified <tt>csrc</tt> and <tt>level</tt>.
 * @param levels the bi-dimensional levels array that we'd like to add amapping to.
 * @param csrc the CSRC identifier that we'd like to add to the<tt>levels</tt> bi-dimensional array.
 * @param level the level corresponding to the <tt>csrc</tt> identifier.
 * @return a new matrix containing all entries from levels and a new onemapping <tt>csrc</tt> to <tt>level</tt>
 */
private long[][] appendCSRCToMatrix(long[][] levels,long csrc,int level){
  int newLength=1;
  if (levels != null && levels.length > 0) {
    newLength=levels.length + 1;
  }
  long[][] newLevels=new long[newLength][2];
  levels[0][0]=csrc;
  levels[0][1]=level;
  if (newLength == 1)   return newLevels;
  for (int i=0; i < levels.length; i++) {
    newLevels[i + 1][0]=levels[i][0];
    newLevels[i + 1][1]=levels[i][1];
  }
  return newLevels;
}

Fixed version (ground truth):
/** 
 * Creates a new bi-dimensional array containing all entries (if any) from the <tt>levels</tt> matrix and an extra entry for the specified <tt>csrc</tt> and <tt>level</tt>.
 * @param levels the bi-dimensional levels array that we'd like to add amapping to.
 * @param csrc the CSRC identifier that we'd like to add to the<tt>levels</tt> bi-dimensional array.
 * @param level the level corresponding to the <tt>csrc</tt> identifier.
 * @return a new matrix containing all entries from levels and a new onemapping <tt>csrc</tt> to <tt>level</tt>
 */
private long[][] appendCSRCToMatrix(long[][] levels,long csrc,int level){
  int newLength=1;
  if (levels != null && levels.length > 0) {
    newLength=levels.length + 1;
  }
  long[][] newLevels=new long[newLength][2];
  newLevels[0][0]=csrc;
  newLevels[0][1]=level;
  if (newLength == 1)   return newLevels;
  for (int i=0; i < levels.length; i++) {
    newLevels[i + 1][0]=levels[i][0];
    newLevels[i + 1][1]=levels[i][1];
  }
  return newLevels;
}
Program: 103814
Project: 103814
Buggy source:
/** 
 * Notifies this <tt>AudioMixer</tt> that an output <tt>AudioMixingPushBufferDataSource</tt> reading from it has been disconnected. The last of the many <tt>AudioMixingPushBufferDataSource</tt>s reading from this <tt>AudioMixer</tt> which gets disconnected causes it to disconnect from the input <tt>DataSource</tt>s it manages.
 */
void disconnect(){
synchronized (inputDataSources) {
    if (connected <= 0)     return;
    connected--;
    if (connected == 0) {
      outputStream=null;
      for (      InputDataSourceDesc inputDataSourceDesc : inputDataSources)       inputDataSourceDesc.getEffectiveInputDataSource().disconnect();
    }
  }
}

Fixed version (ground truth):
/** 
 * Notifies this <tt>AudioMixer</tt> that an output <tt>AudioMixingPushBufferDataSource</tt> reading from it has been disconnected. The last of the many <tt>AudioMixingPushBufferDataSource</tt>s reading from this <tt>AudioMixer</tt> which gets disconnected causes it to disconnect from the input <tt>DataSource</tt>s it manages.
 */
void disconnect(){
synchronized (inputDataSources) {
    if (connected <= 0)     return;
    connected--;
    if (connected == 0) {
      for (      InputDataSourceDesc inputDataSourceDesc : inputDataSources)       inputDataSourceDesc.disconnect();
      outputStream=null;
    }
  }
}
Program: 103815
Project: 103815
Buggy source:
/** 
 * Implements   {@link PushBufferStream#getFormat()}. Returns the <tt>AudioFormat</tt> in which this instance was configured to output its data.
 * @return the <tt>AudioFormat</tt> in which this instance wasconfigured to output its data
 */
public AudioFormat getFormat(){
  return outputFormat;
}

Fixed version (ground truth):
/** 
 * Gets the <tt>Format</tt> in which a specific <tt>SourceStream</tt> provides data.
 * @param stream the <tt>SourceStream</tt> for which the <tt>Format</tt> in which it provides data is to be determined
 * @return the <tt>Format</tt> in which the specified<tt>SourceStream</tt> provides data if it was determined; otherwise, <tt>null</tt>
 */
private static Format getFormat(SourceStream stream){
  if (stream instanceof PushBufferStream)   return ((PushBufferStream)stream).getFormat();
  if (stream instanceof PullBufferStream)   return ((PullBufferStream)stream).getFormat();
  return null;
}
Program: 103816
Project: 103816
Buggy source:
/** 
 * Implements   {@link Controls#getControl(String)}. Invokes  {@link #getControls()} and then looks for a control of the specifiedtype in the returned array of controls.
 * @param controlType a <tt>String</tt> value naming the type of thecontrol of this instance to be retrieved
 * @return an <tt>Object</tt> which represents the control of thisinstance with the specified type
 */
public Object getControl(String controlType){
  return AudioMixer.getControl(this,controlType);
}

Fixed version (ground truth):
/** 
 * Gets the control of a specific <tt>Controls</tt> implementation of a specific type if such a control is made available through  {@link Controls#getControls()}; otherwise, returns <tt>null</tt>.
 * @param controlsImpl the implementation of <tt>Controls</tt> which is tobe queried for its list of controls so that the control of the specified type can be looked for
 * @param controlType a <tt>String</tt> value which names the type of thecontrol to be retrieved
 * @return an <tt>Object</tt> which represents the control of<tt>controlsImpl</tt> of the specified <tt>controlType</tt> if such a control is made available through <tt>Controls#getControls()</tt>; otherwise, <tt>null</tt>
 */
public static Object getControl(Controls controlsImpl,String controlType){
  Object[] controls=controlsImpl.getControls();
  if ((controls != null) && (controls.length > 0)) {
    Class<?> controlClass;
    try {
      controlClass=Class.forName(controlType);
    }
 catch (    ClassNotFoundException cnfe) {
      controlClass=null;
      logger.warn("String_Node_Str" + controlType,cnfe);
    }
    if (controlClass != null)     for (    Object control : controls)     if (controlClass.isInstance(control))     return control;
  }
  return null;
}
Program: 103817
Project: 103817
Buggy source:
/** 
 * Implements   {@link PushBufferStream#read(Buffer)}. Reads audio samples from the input <tt>SourceStreams</tt> of this instance in various formats, converts the read audio samples to one and the same format and pushes them to the output <tt>AudioMixingPushBufferStream</tt>s for the very audio mixing.
 * @param buffer the <tt>Buffer</tt> in which the audio samples readfrom the input <tt>SourceStream</tt>s are to be returned to the caller
 * @throws IOException if any of the input <tt>SourceStream</tt>s throwsuch an exception while reading from them or anything else goes wrong
 */
public void read(Buffer buffer) throws IOException {
  InputStreamDesc[] inputStreams;
synchronized (inputStreamsSyncRoot) {
    if (this.inputStreams != null)     inputStreams=this.inputStreams.clone();
 else     inputStreams=null;
  }
  int inputStreamCount=(inputStreams == null) ? 0 : inputStreams.length;
  if (inputStreamCount <= 0)   return;
  AudioFormat outputFormat=getFormat();
  InputSampleDesc inputSampleDesc=new InputSampleDesc(new int[inputStreamCount][],inputStreams);
  int maxInputSampleCount;
  try {
    maxInputSampleCount=readInputPushBufferStreams(outputFormat,inputSampleDesc);
  }
 catch (  UnsupportedFormatException ufex) {
    IOException ioex=new IOException();
    ioex.initCause(ufex);
    throw ioex;
  }
  maxInputSampleCount=Math.max(maxInputSampleCount,readInputPullBufferStreams(outputFormat,maxInputSampleCount,inputSampleDesc));
  buffer.setData(inputSampleDesc);
  buffer.setLength(maxInputSampleCount);
  long timeStamp=inputSampleDesc.getTimeStamp();
  if (timeStamp != Buffer.TIME_UNKNOWN)   buffer.setTimeStamp(timeStamp);
}

Fixed version (ground truth):
/** 
 * Reads media from a specific <tt>PushBufferStream</tt> which belongs to a specific <tt>DataSource</tt> into a specific output <tt>Buffer</tt>. Allows extenders to tap into the reading and monitor and customize it.
 * @param stream the <tt>PushBufferStream</tt> to read media from and knownto belong to the specified <tt>DataSOurce</tt>
 * @param buffer the output <tt>Buffer</tt> in which the media read from thespecified <tt>stream</tt> is to be written so that it gets returned to the caller
 * @param dataSource the <tt>DataSource</tt> from which <tt>stream</tt>originated
 * @throws IOException if anything wrong happens while reading from thespecified <tt>stream</tt>
 */
protected void read(PushBufferStream stream,Buffer buffer,DataSource dataSource) throws IOException {
  stream.read(buffer);
}
Program: 103819
Project: 103819
Buggy source:
/** 
 * Stops the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt>.
 * @throws IOException
 */
void stop() throws IOException {
synchronized (inputDataSources) {
    if (started <= 0)     return;
    started--;
    if (started == 0)     for (    InputDataSourceDesc inputDataSourceDesc : inputDataSources)     inputDataSourceDesc.getEffectiveInputDataSource().stop();
  }
}

Fixed version (ground truth):
/** 
 * Stops the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt>.
 * @param outputStream the <tt>AudioMixerPushBufferStream</tt> whichrequests this <tt>AudioMixer</tt> to stop. If <tt>outputStream</tt> is the current one and only <tt>AudioMixerPushBufferStream</tt> of this <tt>AudioMixer</tt>, this <tt>AudioMixer</tt> stops. Otherwise, the request is ignored.
 * @throws IOException if any of the input <tt>DataSource</tt>s of this<tt>AudioMixer</tt> throws such an exception while attempting to stop it
 */
void stop(AudioMixerPushBufferStream outputStream) throws IOException {
synchronized (inputDataSources) {
    if (this.outputStream != outputStream)     return;
    if (started <= 0)     return;
    started--;
    if (started == 0)     for (    InputDataSourceDesc inputDataSourceDesc : inputDataSources)     inputDataSourceDesc.stop();
  }
}
Program: 103821
Project: 103821
Buggy source:
/** 
 * Starts the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt>.
 * @throws IOException
 */
void start() throws IOException {
synchronized (inputDataSources) {
    if (started == 0)     for (    InputDataSourceDesc inputDataSourceDesc : inputDataSources)     inputDataSourceDesc.getEffectiveInputDataSource().start();
    started++;
  }
}

Fixed version (ground truth):
/** 
 * Starts the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt>.
 * @param outputStream the <tt>AudioMixerPushBufferStream</tt> whichrequests this <tt>AudioMixer</tt> to start. If <tt>outputStream</tt> is the current one and only <tt>AudioMixerPushBufferStream</tt> of this <tt>AudioMixer</tt>, this <tt>AudioMixer</tt> starts if it hasn't started yet. Otherwise, the request is ignored.
 * @throws IOException if any of the input <tt>DataSource</tt>s of this<tt>AudioMixer</tt> throws such an exception while attempting to start it
 */
void start(AudioMixerPushBufferStream outputStream) throws IOException {
synchronized (inputDataSources) {
    if (this.outputStream != outputStream)     return;
    if (started == 0)     for (    InputDataSourceDesc inputDataSourceDesc : inputDataSources)     inputDataSourceDesc.start();
    started++;
  }
}
Program: 103822
Project: 103822
Buggy source:
/** 
 * Gets the <tt>AudioMixerPushBufferStream</tt>, first creating it if it does not exist already, which reads data from the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt> and pushes it to output <tt>AudioMixingPushBufferStream</tt>s for audio mixing.
 * @return the <tt>AudioMixerPushBufferStream</tt> which reads data fromthe input <tt>DataSource</tt>s of this <tt>AudioMixer</tt> and pushes it to output <tt>AudioMixingPushBufferStream</tt>s for audio mixing
 */
AudioMixerPushBufferStream getOutputStream(){
synchronized (inputDataSources) {
    AudioFormat outputFormat=getOutputFormatFromInputDataSources();
    setOutputFormatToInputDataSources(outputFormat);
    Collection<InputStreamDesc> inputStreams;
    try {
      inputStreams=getInputStreamsFromInputDataSources(outputFormat,(outputStream == null) ? null : outputStream.getInputStreams());
    }
 catch (    IOException ex) {
      throw new UndeclaredThrowableException(ex);
    }
    if (inputStreams.size() <= 0)     outputStream=null;
 else {
      if (outputStream == null)       outputStream=new AudioMixerPushBufferStream(outputFormat);
      outputStream.setInputStreams(inputStreams);
    }
    return outputStream;
  }
}

Fixed version (ground truth):
/** 
 * Gets the <tt>AudioMixerPushBufferStream</tt>, first creating it if it does not exist already, which reads data from the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt> and pushes it to output <tt>AudioMixingPushBufferStream</tt>s for audio mixing.
 * @return the <tt>AudioMixerPushBufferStream</tt> which reads data fromthe input <tt>DataSource</tt>s of this <tt>AudioMixer</tt> and pushes it to output <tt>AudioMixingPushBufferStream</tt>s for audio mixing
 */
AudioMixerPushBufferStream getOutputStream(){
synchronized (inputDataSources) {
    AudioFormat outputFormat=(outputStream == null) ? getOutputFormatFromInputDataSources() : outputStream.getFormat();
    setOutputFormatToInputDataSources(outputFormat);
    Collection<InputStreamDesc> inputStreams;
    try {
      inputStreams=getInputStreamsFromInputDataSources(outputFormat,(outputStream == null) ? null : outputStream.getInputStreams());
    }
 catch (    IOException ioex) {
      throw new UndeclaredThrowableException(ioex);
    }
    if (outputStream == null)     outputStream=new AudioMixerPushBufferStream(this,outputFormat);
    outputStream.setInputStreams(inputStreams);
    return outputStream;
  }
}
Program: 103823
Project: 103823
Buggy source:
public void disconnect(){
  try {
    stop();
  }
 catch (  IOException ex) {
    throw new UndeclaredThrowableException(ex);
  }
  if (connected) {
    outputStream=null;
    connected=false;
    audioMixer.disconnect();
  }
}

Fixed version (ground truth):
/** 
 * Implements   {@link DataSource#disconnect()}. Marks this <tt>DataSource</tt> as disconnected and notifies the <tt>AudioMixer</tt> that one of its output <tt>PushBufferDataSources</tt> has been disconnected.
 */
public synchronized void disconnect(){
  try {
    stop();
  }
 catch (  IOException ioex) {
    throw new UndeclaredThrowableException(ioex);
  }
  if (connected) {
    outputStream=null;
    connected=false;
    audioMixer.disconnect();
  }
}
Program: 103824
Project: 103824
Buggy source:
/** 
 * Implements DataSource#getControl(String).
 * @param controlType a <tt>String</tt> value which names the type of thecontrol of this instance to be retrieved
 * @return an <tt>Object</tt> which represents the control of this instancewith the specified type if such a control is available; otherwise, <tt>null</tt>
 */
public Object getControl(String controlType){
  return AudioMixer.getControl(this,controlType);
}

Fixed version (ground truth):
/** 
 * Implements   {@link DataSource#getControl(String)}.
 * @param controlType a <tt>String</tt> value which names the type of thecontrol of this instance to be retrieved
 * @return an <tt>Object</tt> which represents the control of this instancewith the specified type if such a control is available; otherwise, <tt>null</tt>
 */
public Object getControl(String controlType){
  return AudioMixer.getControl(this,controlType);
}
Program: 103825
Project: 103825
Buggy source:
/** 
 * Implements DataSource#getControls(). Gets an array of <tt>Object</tt>s which represent the controls available for this <tt>DataSource</tt>.
 * @return an array of <tt>Object</tt>s which represent the controlsavailable for this <tt>DataSource</tt>
 */
public Object[] getControls(){
  return getFormatControls();
}

Fixed version (ground truth):
/** 
 * Implements   {@link DataSource#getControls()}. Gets an array of <tt>Object</tt>s which represent the controls available for this <tt>DataSource</tt>.
 * @return an array of <tt>Object</tt>s which represent the controlsavailable for this <tt>DataSource</tt>
 */
public Object[] getControls(){
  BufferControl bufferControl=getBufferControl();
  FormatControl[] formatControls=getFormatControls();
  if (bufferControl == null)   return formatControls;
 else   if ((formatControls == null) || (formatControls.length < 1))   return new Object[]{bufferControl};
 else {
    Object[] controls=new Object[1 + formatControls.length];
    controls[0]=bufferControl;
    System.arraycopy(formatControls,0,controls,1,formatControls.length);
    return controls;
  }
}
Program: 103826
Project: 103826
Buggy source:
public FormatControl[] getFormatControls(){
  return audioMixer.getFormatControls();
}

Fixed version (ground truth):
/** 
 * Implements   {@link CaptureDevice#getFormatControls()}. Delegates to the associated <tt>AudioMixer</tt> because it knows which <tt>CaptureDevice</tt> is being wrapped.
 * @return an array of <tt>FormatControl</tt>s of the <tt>CaptureDevice</tt>of the associated <tt>AudioMixer</tt>
 */
public FormatControl[] getFormatControls(){
  return audioMixer.getFormatControls();
}
Program: 103827
Project: 103827
Buggy source:
/** 
 * Adds a new input <tt>DataSource</tt> to be mixed by the associated <tt>AudioMixer</tt> of this instance and to not have its audio contributions included in the mixing output represented by this <tt>DataSource</tt>.
 * @param inputDataSource a <tt>DataSource</tt> to be added for mixingto the <tt>AudioMixer</tt> associate with this instance and to not have its audio contributions included in the mixing output represented by this <tt>DataSource</tt>
 */
public void addInputDataSource(DataSource inputDataSource){
  audioMixer.addInputDataSource(inputDataSource,this);
}

Fixed version (ground truth):
/** 
 * Adds a new input <tt>DataSource</tt> to be mixed by the associated <tt>AudioMixer</tt> of this instance and to not have its audio contributions included in the mixing output represented by this <tt>DataSource</tt>.
 * @param inputDataSource a <tt>DataSource</tt> to be added for mixing tothe <tt>AudioMixer</tt> associate with this instance and to not have its audio contributions included in the mixing output represented by this <tt>DataSource</tt>
 */
public void addInputDataSource(DataSource inputDataSource){
  audioMixer.addInputDataSource(inputDataSource,this);
}
Program: 103828
Project: 103828
Buggy source:
public void start() throws IOException {
  if (!started) {
    if (outputStream != null)     outputStream.start();
    audioMixer.start();
    started=true;
  }
}

Fixed version (ground truth):
/** 
 * Implements   {@link DataSource#start()}. Starts the output <tt>PushBufferStream</tt> of this <tt>DataSource</tt> (if it exists) and notifies the <tt>AudioMixer</tt> that one of its output <tt>PushBufferDataSources</tt> has been started.
 * @throws IOException if anything wrong happens while starting the output<tt>PushBufferStream</tt> of this <tt>DataSource</tt>
 */
public synchronized void start() throws IOException {
  if (!started) {
    started=true;
    if (outputStream != null)     outputStream.start();
  }
}
Program: 103829
Project: 103829
Buggy source:
public CaptureDeviceInfo getCaptureDeviceInfo(){
  return audioMixer.getCaptureDeviceInfo();
}

Fixed version (ground truth):
/** 
 * Implements   {@link CaptureDevice#getCaptureDeviceInfo()}. Delegates to the associated <tt>AudioMixer</tt> because it knows which <tt>CaptureDevice</tt> is being wrapped.
 * @return the <tt>CaptureDeviceInfo</tt> of the <tt>CaptureDevice</tt> ofthe <tt>AudioMixer</tt>
 */
public CaptureDeviceInfo getCaptureDeviceInfo(){
  return audioMixer.getCaptureDeviceInfo();
}
Program: 103830
Project: 103830
Buggy source:
public Time getDuration(){
  return audioMixer.getDuration();
}

Fixed version (ground truth):
/** 
 * Implements   {@link DataSource#getDuration()}. Delegates to the associated <tt>AudioMixer</tt> because it manages the inputs and knows their characteristics.
 * @return a <tt>Time</tt> value which represents the duration of the mediabeing made available through this <tt>DataSource</tt>
 */
public Time getDuration(){
  return audioMixer.getDuration();
}
Program: 103831
Project: 103831
Buggy source:
public void stop() throws IOException {
  if (started) {
    audioMixer.stop();
    if (outputStream != null)     outputStream.stop();
    started=false;
  }
}

Fixed version (ground truth):
/** 
 * Implements   {@link DataSource#stop()}. Notifies the <tt>AudioMixer</tt> that one of its output <tt>PushBufferDataSources</tt> has been stopped and stops the output <tt>PushBufferStream</tt> of this <tt>DataSource</tt> (if it exists).
 * @throws IOException if anything wrong happens while stopping the output<tt>PushBufferStream</tt> of this <tt>DataSource</tt>
 */
public synchronized void stop() throws IOException {
  if (started) {
    started=false;
    if (outputStream != null)     outputStream.stop();
  }
}
Program: 103832
Project: 103832
Buggy source:
public String getContentType(){
  return audioMixer.getContentType();
}

Fixed version (ground truth):
/** 
 * Implements   {@link DataSource#getContentType()}. Delegates to the associated <tt>AudioMixer</tt> because it manages the inputs and knows their characteristics.
 * @return a <tt>String</tt> value which represents the type of the contentbeing made available by this <tt>DataSource</tt> i.e. the associated <tt>AudioMixer</tt>
 */
public String getContentType(){
  return audioMixer.getContentType();
}
Program: 103833
Project: 103833
Buggy source:
public PushBufferStream[] getStreams(){
  if (outputStream == null) {
    AudioMixer.AudioMixerPushBufferStream audioMixerOutputStream=audioMixer.getOutputStream();
    if (audioMixerOutputStream != null) {
      outputStream=new AudioMixingPushBufferStream(audioMixerOutputStream,this);
      if (started)       outputStream.start();
    }
  }
  return (outputStream == null) ? new PushBufferStream[0] : new PushBufferStream[]{outputStream};
}

Fixed version (ground truth):
/** 
 * Implements   {@link PushBufferDataSource#getStreams()}. Gets a <tt>PushBufferStream</tt> which reads data from the associated <tt>AudioMixer</tt> and mixes its inputs.
 * @return an array with a single <tt>PushBufferStream</tt> which reads datafrom the associated <tt>AudioMixer</tt> and mixes its inputs if this <tt>DataSource</tt> is connected; otherwise, an empty array
 */
public synchronized PushBufferStream[] getStreams(){
  if (connected && (outputStream == null)) {
    AudioMixerPushBufferStream audioMixerOutputStream=audioMixer.getOutputStream();
    if (audioMixerOutputStream != null) {
      outputStream=new AudioMixingPushBufferStream(audioMixerOutputStream,this);
      if (started)       try {
        outputStream.start();
      }
 catch (      IOException ioex) {
        logger.error("String_Node_Str" + outputStream.getClass().getSimpleName() + "String_Node_Str"+ outputStream.hashCode(),ioex);
      }
    }
  }
  return (outputStream == null) ? new PushBufferStream[0] : new PushBufferStream[]{outputStream};
}
Program: 103834
Project: 103834
Buggy source:
public void connect() throws IOException {
  if (!connected) {
    audioMixer.connect();
    connected=true;
  }
}

Fixed version (ground truth):
/** 
 * Implements   {@link DataSource#connect()}. Lets the <tt>AudioMixer</tt> know that one of its output <tt>PushBufferDataSources</tt> has been connected and marks this <tt>DataSource</tt> as connected.
 * @throws IOException if the <tt>AudioMixer</tt> fails to connect
 */
public synchronized void connect() throws IOException {
  if (!connected) {
    audioMixer.connect();
    connected=true;
  }
}
Program: 103836
Project: 103836
Buggy source:
/** 
 * Creates a new <tt>RawPacket</tt> from a specific <tt>DatagramPacket</tt> in order to have this instance receive its packet data through its  {@link #read(byte[],int,int)} method. Allows extenders to intercept thepacket data and possibly filter and/or modify it.
 * @param datagramPacket the <tt>DatagramPacket</tt> containing the packetdata
 * @return a new <tt>RawPacket</tt> containing the packet data of thespecified <tt>DatagramPacket</tt> or possibly its modification; <tt>null</tt> to ignore the packet data of the specified <tt>DatagramPacket</tt> and not make it available to this instance through its  {@link #read(byte[],int,int)} method 
 */
protected RawPacket createRawPacket(DatagramPacket datagramPacket){
  return new RawPacket(datagramPacket.getData(),datagramPacket.getOffset(),datagramPacket.getLength());
}

Fixed version (ground truth):
/** 
 * Creates a new <tt>RawPacket</tt> from a specific <tt>DatagramPacket</tt> in order to have this instance receive its packet data through its  {@link #read(byte[],int,int)} method. Allows extenders to intercept thepacket data and possibly filter and/or modify it.
 * @param datagramPacket the <tt>DatagramPacket</tt> containing the packetdata
 * @return a new <tt>RawPacket</tt> containing the packet data of thespecified <tt>DatagramPacket</tt> or possibly its modification; <tt>null</tt> to ignore the packet data of the specified <tt>DatagramPacket</tt> and not make it available to this instance through its  {@link #read(byte[],int,int)} method
 */
protected RawPacket createRawPacket(DatagramPacket datagramPacket){
  return new RawPacket(datagramPacket.getData(),datagramPacket.getOffset(),datagramPacket.getLength());
}
Program: 103837
Project: 103837
Buggy source:
public Object getControl(String controlType){
  return null;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnectorInputStream#getControl(String)} that always returns<tt>null</tt>.
 * @param controlType ignored.
 * @return <tt>null</tt>, no matter what.
 */
public Object getControl(String controlType){
  return null;
}
Program: 103838
Project: 103838
Buggy source:
public Object[] getControls(){
  return EMPTY_CONTROLS;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnectorInputStream#getControls()} that always returns<tt>EMPTY_CONTROLS</tt>.
 * @return <tt>EMPTY_CONTROLS</tt>, no matter what.
 */
public Object[] getControls(){
  return EMPTY_CONTROLS;
}
Program: 103839
Project: 103839
Buggy source:
public int read(byte[] inBuffer,int offset,int length) throws IOException {
  if (ioError)   return -1;
  int pktLength=pkt.getLength();
  if (length < pktLength)   throw new IOException("String_Node_Str" + pktLength);
  System.arraycopy(pkt.getBuffer(),pkt.getOffset(),inBuffer,offset,pktLength);
  return pktLength;
}

Fixed version (ground truth):
/** 
 * Copies the content of the most recently received packet into <tt>inBuffer</tt>.
 * @param inBuffer the <tt>byte[]</tt> that we'd like to copy the contentof the packet to.
 * @param offset the position where we are supposed to start writing in<tt>inBuffer</tt>.
 * @param length the number of <tt>byte</tt>s available for writing in<tt>inBuffer</tt>.
 * @return the number of bytes read
 * @throws IOException if <tt>length</tt> is less than the size of thepacket.
 */
public int read(byte[] inBuffer,int offset,int length) throws IOException {
  if (ioError)   return -1;
  int pktLength=pkt.getLength();
  if (length < pktLength)   throw new IOException("String_Node_Str" + pktLength);
  System.arraycopy(pkt.getBuffer(),pkt.getOffset(),inBuffer,offset,pktLength);
  return pktLength;
}
Program: 103840
Project: 103840
Buggy source:
public boolean endOfStream(){
  return false;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnectorInputStream#endOfStream()} that always returns<tt>false</tt>.
 * @return <tt>false</tt>, no matter what.
 */
public boolean endOfStream(){
  return false;
}
Program: 103841
Project: 103841
Buggy source:
public void setTransferHandler(SourceTransferHandler transferHandler){
  if (!closed)   this.transferHandler=transferHandler;
}

Fixed version (ground truth):
/** 
 * Sets the <tt>transferHandler</tt> that this connector should be notifying when new data is available for reading.
 * @param transferHandler the <tt>transferHandler</tt> that this connectorshould be notifying when new data is available for reading.
 */
public void setTransferHandler(SourceTransferHandler transferHandler){
  if (!closed)   this.transferHandler=transferHandler;
}
Program: 103842
Project: 103842
Buggy source:
public int getMinimumTransferSize(){
  return 2 * 1024;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnectorInputStream#getMinimumTransferSize()} that always returns<tt>2 * 1024</tt>.
 * @return <tt>2 * 1024</tt>, no matter what.
 */
public int getMinimumTransferSize(){
  return 2 * 1024;
}
Program: 103843
Project: 103843
Buggy source:
public void run(){
  while (!closed) {
    DatagramPacket p=new DatagramPacket(buffer,0,65535);
    try {
      socket.receive(p);
    }
 catch (    IOException e) {
      ioError=true;
      break;
    }
    pkt=createRawPacket(p);
    if ((pkt != null) && (transferHandler != null) && !closed)     transferHandler.transferData(this);
  }
}

Fixed version (ground truth):
/** 
 * Listens for incoming datagrams, stores them for reading by the <tt>read</tt> method and notifies the local <tt>transferHandler</tt> that there's data to be read.
 */
public void run(){
  while (!closed) {
    DatagramPacket p=new DatagramPacket(buffer,0,65535);
    try {
      socket.receive(p);
    }
 catch (    IOException e) {
      ioError=true;
      break;
    }
    pkt=createRawPacket(p);
    if ((pkt != null) && (transferHandler != null) && !closed)     transferHandler.transferData(this);
  }
}
Program: 103844
Project: 103844
Buggy source:
public ContentDescriptor getContentDescriptor(){
  return null;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnectorInputStream#getContentDescriptor()} that always returns<tt>null</tt>.
 * @return <tt>null</tt>, no matter what.
 */
public ContentDescriptor getContentDescriptor(){
  return null;
}
Program: 103845
Project: 103845
Buggy source:
public long getContentLength(){
  return LENGTH_UNKNOWN;
}

Fixed version (ground truth):
/** 
 * Provides a dummy implementation to   {@link RTPConnectorInputStream#getContentLength()} that always returns<tt>LENGTH_UNKNOWN</tt>.
 * @return <tt>LENGTH_UNKNOWN</tt>, no matter what.
 */
public long getContentLength(){
  return LENGTH_UNKNOWN;
}
Program: 103847
Project: 103847
Buggy source:
/** 
 * Adds a new association in this <tt>MediaStream</tt> of the specified RTP payload type with the specified <tt>MediaFormat</tt> in order to allow it to report <tt>rtpPayloadType</tt> in RTP flows sending and receiving media in <tt>format</tt>. Usually, <tt>rtpPayloadType</tt> will be in the range of dynamic RTP payload types.
 * @param rtpPayloadType the RTP payload type to be associated in this<tt>MediaStream</tt> with the specified <tt>MediaFormat</tt>
 * @param format the <tt>MediaFormat</tt> to be associated in this<tt>MediaStream</tt> with <tt>rtpPayloadType</tt>
 * @see MediaStream#addDynamicRTPPayloadType(int,MediaFormat)
 */
public void addDynamicRTPPayloadType(byte rtpPayloadType,MediaFormat format){
  MediaFormatImpl<? extends Format> mediaFormatImpl=(MediaFormatImpl<? extends Format>)format;
synchronized (dynamicRTPPayloadTypes) {
    dynamicRTPPayloadTypes.put(Byte.valueOf(rtpPayloadType),format);
    if (rtpManager != null)     rtpManager.addFormat(mediaFormatImpl.getFormat(),rtpPayloadType);
  }
}

Fixed version (ground truth):
/** 
 * Adds a new association in this <tt>MediaStream</tt> of the specified RTP payload type with the specified <tt>MediaFormat</tt> in order to allow it to report <tt>rtpPayloadType</tt> in RTP flows sending and receiving media in <tt>format</tt>. Usually, <tt>rtpPayloadType</tt> will be in the range of dynamic RTP payload types.
 * @param rtpPayloadType the RTP payload type to be associated in this<tt>MediaStream</tt> with the specified <tt>MediaFormat</tt>
 * @param format the <tt>MediaFormat</tt> to be associated in this<tt>MediaStream</tt> with <tt>rtpPayloadType</tt>
 * @see MediaStream#addDynamicRTPPayloadType(byte,MediaFormat)
 */
public void addDynamicRTPPayloadType(byte rtpPayloadType,MediaFormat format){
  MediaFormatImpl<? extends Format> mediaFormatImpl=(MediaFormatImpl<? extends Format>)format;
synchronized (dynamicRTPPayloadTypes) {
    dynamicRTPPayloadTypes.put(Byte.valueOf(rtpPayloadType),format);
    if (rtpManager != null)     rtpManager.addFormat(mediaFormatImpl.getFormat(),rtpPayloadType);
  }
}
Program: 103848
Project: 103848
Buggy source:
/** 
 * Gets the existing associations in this <tt>MediaStream</tt> of RTP payload types to <tt>MediaFormat</tt>s. The returned <tt>Map</tt> only contains associations previously added in this instance with  {@link #addDynamicRTPPayloadType(int,MediaFormat)} and not globally orwell-known associations reported by {@link MediaFormat#getRTPPayloadType()}.
 * @return a <tt>Map</tt> of RTP payload type expressed as <tt>Byte</tt> to<tt>MediaFormat</tt> describing the existing (dynamic) associations in this instance of RTP payload types to <tt>MediaFormat</tt>s. The <tt>Map</tt> represents a snapshot of the existing associations at the time of the <tt>getDynamicRTPPayloadTypes()</tt> method call and modifications to it are not reflected on the internal storage
 * @see MediaStream#getDynamicRTPPayloadTypes()
 */
public Map<Byte,MediaFormat> getDynamicRTPPayloadTypes(){
synchronized (dynamicRTPPayloadTypes) {
    return new HashMap<Byte,MediaFormat>(dynamicRTPPayloadTypes);
  }
}

Fixed version (ground truth):
/** 
 * Gets the existing associations in this <tt>MediaStream</tt> of RTP payload types to <tt>MediaFormat</tt>s. The returned <tt>Map</tt> only contains associations previously added in this instance with  {@link #addDynamicRTPPayloadType(byte,MediaFormat)} and not globally orwell-known associations reported by {@link MediaFormat#getRTPPayloadType()}.
 * @return a <tt>Map</tt> of RTP payload type expressed as <tt>Byte</tt> to<tt>MediaFormat</tt> describing the existing (dynamic) associations in this instance of RTP payload types to <tt>MediaFormat</tt>s. The <tt>Map</tt> represents a snapshot of the existing associations at the time of the <tt>getDynamicRTPPayloadTypes()</tt> method call and modifications to it are not reflected on the internal storage
 * @see MediaStream#getDynamicRTPPayloadTypes()
 */
public Map<Byte,MediaFormat> getDynamicRTPPayloadTypes(){
synchronized (dynamicRTPPayloadTypes) {
    return new HashMap<Byte,MediaFormat>(dynamicRTPPayloadTypes);
  }
}
Program: 103849
Project: 103849
Buggy source:
public void run(){
  stopped=false;
  while (!stopped) {
    byte[] dataToProcess=null;
synchronized (this) {
      if (data == null)       try {
        wait();
      }
 catch (      InterruptedException ie) {
      }
      dataToProcess=data;
      data=null;
    }
    if (dataToProcess != null) {
      int newLevel=SoundLevelIndicatorEffect.calculateCurrentSignalPower(dataToProcess,0,dataToProcess.length,SoundLevelChangeEvent.MAX_LEVEL,SoundLevelChangeEvent.MIN_LEVEL,lastLevel);
      Map<Long,Integer> lev=new HashMap<Long,Integer>();
      MediaStream parentStream=deviceSession.getParentStream();
      lev.put(parentStream.getRemoteSourceID(),newLevel);
      SoundLevelChangeEvent soundLevelEvent=new SoundLevelChangeEvent(parentStream,lev);
      List<SoundLevelListener> listeners;
synchronized (stSoundLevelListeners) {
        listeners=new ArrayList<SoundLevelListener>(stSoundLevelListeners);
      }
      for (      SoundLevelListener listener : listeners)       listener.soundLevelChanged(soundLevelEvent);
      lastLevel=newLevel;
    }
  }
}

Fixed version (ground truth):
/** 
 * Runs the actual audio level calculations.
 */
public void run(){
  stopped=false;
  while (!stopped) {
    byte[] dataToProcess=null;
synchronized (this) {
      if (data == null)       try {
        wait();
      }
 catch (      InterruptedException ie) {
      }
      dataToProcess=data;
      data=null;
    }
    if (dataToProcess != null) {
      int newLevel=SoundLevelIndicatorEffect.calculateCurrentSignalPower(dataToProcess,0,dataToProcess.length,SoundLevelChangeEvent.MAX_LEVEL,SoundLevelChangeEvent.MIN_LEVEL,lastLevel);
      Map<Long,Integer> lev=new HashMap<Long,Integer>();
      MediaStream parentStream=deviceSession.getParentStream();
      lev.put(parentStream.getRemoteSourceID(),newLevel);
      SoundLevelChangeEvent soundLevelEvent=new SoundLevelChangeEvent(parentStream,lev);
      List<SoundLevelListener> listeners;
synchronized (stSoundLevelListeners) {
        listeners=new ArrayList<SoundLevelListener>(stSoundLevelListeners);
      }
      for (      SoundLevelListener listener : listeners)       listener.soundLevelChanged(soundLevelEvent);
      lastLevel=newLevel;
    }
  }
}
Program: 103850
Project: 103850
Buggy source:
/** 
 * Adds data to be processed.
 * @param buffer
 */
synchronized void addData(Buffer buffer){
  byte[] data=new byte[buffer.getLength()];
  System.arraycopy(buffer.getData(),buffer.getOffset(),data,0,data.length);
  this.data=data;
  notifyAll();
}

Fixed version (ground truth):
/** 
 * Adds data to be processed.
 * @param buffer the data that we'd like to queue for processing.
 */
synchronized void addData(Buffer buffer){
  byte[] data=new byte[buffer.getLength()];
  System.arraycopy(buffer.getData(),buffer.getOffset(),data,0,data.length);
  this.data=data;
  notifyAll();
}
Program: 103851
Project: 103851
Buggy source:
/** 
 * A default implementation for the  {@link MediaDevice#getSupportedExtensions()} method returning<tt>null</tt> and hence indicating support for no RTP extensions.
 * @return <tt>null</tt>, indicating that this device does not support anyRTP extensions.
 */
public List<RTPExtension> getSupportedExtensions(){
  if (getMediaType() != MediaType.AUDIO)   return null;
  if (rtpExtensions == null) {
    rtpExtensions=new ArrayList<RTPExtension>(1);
    URI csrcAudioLevelURN;
    try {
      csrcAudioLevelURN=new URI(RTPExtension.CSRC_AUDIO_LEVEL_URN);
    }
 catch (    URISyntaxException e) {
      logger.info("String_Node_Str",e);
      return null;
    }
    rtpExtensions.add(new RTPExtension(csrcAudioLevelURN,MediaDirection.RECVONLY));
  }
  return rtpExtensions;
}

Fixed version (ground truth):
/** 
 * Returns a <tt>List</tt> containing (at the time of writing) a single extension descriptor indicating <tt>RECVONLY</tt> support for mixer-to-client audio levels.
 * @return a <tt>List</tt> containing the <tt>CSRC_AUDIO_LEVEL_URN</tt>extension descriptor.
 */
public List<RTPExtension> getSupportedExtensions(){
  if (getMediaType() != MediaType.AUDIO)   return null;
  if (rtpExtensions == null) {
    rtpExtensions=new ArrayList<RTPExtension>(1);
    URI csrcAudioLevelURN;
    try {
      csrcAudioLevelURN=new URI(RTPExtension.CSRC_AUDIO_LEVEL_URN);
    }
 catch (    URISyntaxException e) {
      logger.info("String_Node_Str",e);
      return null;
    }
    rtpExtensions.add(new RTPExtension(csrcAudioLevelURN,MediaDirection.RECVONLY));
  }
  return rtpExtensions;
}
Program: 103852
Project: 103852
Buggy source:
/** 
 * Gets the duration of each one of the output streams produced by this <tt>AudioMixer</tt>.
 * @return the duration of each one of the output streams produced by this<tt>AudioMixer</tt>
 */
Time getDuration(){
  Time duration=null;
synchronized (inputDataSources) {
    for (    InputDataSourceDesc inputDataSourceDesc : inputDataSources) {
      Time inputDuration=inputDataSourceDesc.getEffectiveInputDataSource().getDuration();
      if (Duration.DURATION_UNBOUNDED.equals(inputDuration) || Duration.DURATION_UNKNOWN.equals(inputDuration))       return inputDuration;
      if ((duration == null) || (duration.getNanoseconds() < inputDuration.getNanoseconds()))       duration=inputDuration;
    }
  }
  return (duration == null) ? Duration.DURATION_UNKNOWN : duration;
}

Fixed version (ground truth):
/** 
 * Gets the duration of each one of the output streams produced by this <tt>AudioMixer</tt>.
 * @return the duration of each one of the output streams produced by this<tt>AudioMixer</tt>
 */
Time getDuration(){
  return ((DataSource)captureDevice).getDuration();
}
Program: 103853
Project: 103853
Buggy source:
/** 
 * Gets the <tt>AudioMixer</tt> which performs audio mixing in this <tt>MediaDevice</tt> (and rather the session it represents). If it still does not exist, it is created.
 * @return the <tt>AudioMixer</tt> which performs audio mixing in this<tt>MediaDevice</tt> (and rather the session it represents)
 */
private AudioMixer getAudioMixer(){
  if (audioMixer == null)   audioMixer=new AudioMixer(device.createCaptureDevice()){
    @Override protected void read(    PushBufferStream stream,    Buffer buffer,    DataSource dataSource) throws IOException {
      super.read(stream,buffer,dataSource);
      if (dataSource == captureDevice) {
      }
 else       if (dataSource instanceof ReceiveStreamPushBufferDataSource) {
        ReceiveStream receiveStream=((ReceiveStreamPushBufferDataSource)dataSource).getReceiveStream();
      }
    }
  }
;
  return audioMixer;
}

Fixed version (ground truth):
/** 
 * Gets the <tt>AudioMixer</tt> which performs audio mixing in this <tt>MediaDevice</tt> (and rather the session it represents). If it still does not exist, it is created.
 * @return the <tt>AudioMixer</tt> which performs audio mixing in this<tt>MediaDevice</tt> (and rather the session it represents)
 */
private synchronized AudioMixer getAudioMixer(){
  if (audioMixer == null)   audioMixer=new AudioMixer(device.createCaptureDevice()){
    @Override protected void read(    PushBufferStream stream,    Buffer buffer,    DataSource dataSource) throws IOException {
      super.read(stream,buffer,dataSource);
      if (dataSource == captureDevice) {
      }
 else       if (dataSource instanceof ReceiveStreamPushBufferDataSource) {
        ReceiveStream receiveStream=((ReceiveStreamPushBufferDataSource)dataSource).getReceiveStream();
      }
    }
  }
;
  return audioMixer;
}
Program: 103854
Project: 103854
Buggy source:
/** 
 * Removes a <tt>ReceiveStream</tt> from this <tt>MediaDeviceSession</tt> so that it no longer plays back on the associated <tt>MediaDevice</tt>.
 * @param receiveStream the <tt>ReceiveStream</tt> to be removed from this<tt>MediaDeviceSession</tt> and playback on the associated <tt>MediaDevice</tt>
 */
public void removeReceiveStream(ReceiveStream receiveStream){
  DataSource receiveStreamDataSource=receiveStreams.remove(receiveStream);
  if ((receiveStreamDataSource != null) && !receiveStreams.containsValue(receiveStreamDataSource)) synchronized (players) {
    Processor player=players.get(receiveStreamDataSource);
    if (player != null)     disposePlayer(player);
  }
}

Fixed version (ground truth):
/** 
 * Removes a <tt>ReceiveStream</tt> from this <tt>MediaDeviceSession</tt> so that it no longer plays back on the associated <tt>MediaDevice</tt>.
 * @param receiveStream the <tt>ReceiveStream</tt> to be removed from this<tt>MediaDeviceSession</tt> and playback on the associated <tt>MediaDevice</tt>
 */
public synchronized void removeReceiveStream(ReceiveStream receiveStream){
  DataSource receiveStreamDataSource=receiveStreams.remove(receiveStream);
  if ((receiveStreamDataSource != null) && !receiveStreams.containsValue(receiveStreamDataSource)) synchronized (players) {
    Processor player=players.get(receiveStreamDataSource);
    if (player != null)     disposePlayer(player);
  }
}
Program: 103856
Project: 103856
Buggy source:
/** 
 * Gets the <tt>DataSource</tt> that this instance uses to read captured media from. If it does not exist yet, it is created.
 * @return the <tt>DataSource</tt> that this instance uses to read capturedmedia from
 */
protected DataSource getCaptureDevice(){
  if (captureDevice == null)   captureDevice=createCaptureDevice();
  return captureDevice;
}

Fixed version (ground truth):
/** 
 * Gets the <tt>DataSource</tt> that this instance uses to read captured media from. If it does not exist yet, it is created.
 * @return the <tt>DataSource</tt> that this instance uses to read capturedmedia from
 */
protected synchronized DataSource getCaptureDevice(){
  if (captureDevice == null)   captureDevice=createCaptureDevice();
  return captureDevice;
}