Program: 103884
Project: 103884
Buggy source:
/** 
 * Notifies this <tt>MediaStream</tt> that the <tt>MediaDevice</tt> (and respectively the <tt>MediaDeviceSession</tt> with it) which this instance uses for capture and playback of media has been changed. Makes sure that the <tt>VideoListener</tt>s of this instance get <tt>VideoEvent</tt>s for the new/current <tt>VideoMediaDeviceSession</tt> and not for the old one.
 * @param oldValue the <tt>MediaDeviceSession</tt> with the<tt>MediaDevice</tt> this instance used work with
 * @param newValue the <tt>MediaDeviceSession</tt> with the<tt>MediaDevice</tt> this instance is to work with
 * @see MediaStreamImpl#deviceSessionChanged(MediaDeviceSession,MediaDeviceSession)
 */
@Override protected void deviceSessionChanged(MediaDeviceSession oldValue,MediaDeviceSession newValue){
  super.deviceSessionChanged(oldValue,newValue);
  if (oldValue instanceof VideoMediaDeviceSession)   ((VideoMediaDeviceSession)oldValue).removeVideoListener(deviceSessionVideoListener);
  if (newValue instanceof VideoMediaDeviceSession)   ((VideoMediaDeviceSession)newValue).addVideoListener(deviceSessionVideoListener);
}

Fixed version (ground truth):
/** 
 * Notifies this <tt>MediaStream</tt> that the <tt>MediaDevice</tt> (and respectively the <tt>MediaDeviceSession</tt> with it) which this instance uses for capture and playback of media has been changed. Makes sure that the <tt>VideoListener</tt>s of this instance get <tt>VideoEvent</tt>s for the new/current <tt>VideoMediaDeviceSession</tt> and not for the old one.
 * @param oldValue the <tt>MediaDeviceSession</tt> with the<tt>MediaDevice</tt> this instance used work with
 * @param newValue the <tt>MediaDeviceSession</tt> with the<tt>MediaDevice</tt> this instance is to work with
 * @see MediaStreamImpl#deviceSessionChanged(MediaDeviceSession,MediaDeviceSession)
 */
@Override protected void deviceSessionChanged(MediaDeviceSession oldValue,MediaDeviceSession newValue){
  super.deviceSessionChanged(oldValue,newValue);
  if ((oldValue instanceof VideoMediaDeviceSession) && (deviceSessionVideoListener != null))   ((VideoMediaDeviceSession)oldValue).removeVideoListener(deviceSessionVideoListener);
  if (newValue instanceof VideoMediaDeviceSession) {
    if (deviceSessionVideoListener == null)     deviceSessionVideoListener=new VideoListener(){
      /** 
 * Notifies that a visual <tt>Component</tt> representing video has been added to the provider this listener has been added to.
 * @param e a <tt>VideoEvent</tt> describing the addedvisual <tt>Component</tt> representing video and the provider it was added into
 * @see VideoListener#videoAdded(VideoEvent)
 */
      public void videoAdded(      VideoEvent e){
        fireVideoEvent(e.getType(),e.getVisualComponent(),e.getOrigin());
      }
      /** 
 * Notifies that a visual <tt>Component</tt> representing video has been removed from the provider this listener has been added to.
 * @param e a <tt>VideoEvent</tt> describing the removedvisual <tt>Component</tt> representing video and the provider it was removed from
 * @see VideoListener#videoRemoved(VideoEvent)
 */
      public void videoRemoved(      VideoEvent e){
        fireVideoEvent(e.getType(),e.getVisualComponent(),e.getOrigin());
      }
    }
;
    ((VideoMediaDeviceSession)newValue).addVideoListener(deviceSessionVideoListener);
  }
}