Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.device
Class AudioMediaDeviceSession

java.lang.Object
  extended by net.java.sip.communicator.util.PropertyChangeNotifier
      extended by net.java.sip.communicator.impl.neomedia.device.MediaDeviceSession
          extended by net.java.sip.communicator.impl.neomedia.device.AudioMediaDeviceSession

public class AudioMediaDeviceSession
extends MediaDeviceSession

Extends MediaDeviceSession to add audio-specific functionality.

Author:
Emil Ivov, Damian Minkov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.device.MediaDeviceSession
OUTPUT_DATA_SOURCE, outputsizeChanged, SSRC_LIST
 
Constructor Summary
protected AudioMediaDeviceSession(AbstractMediaDevice device)
          Initializes a new MediaDeviceSession instance which is to represent the use of a specific MediaDevice by a MediaStream.
 
Method Summary
 void copyPlayback(MediaDeviceSession deviceSession)
          Copies the playback part of a specific MediaDeviceSession into this instance.
 int getLastMeasuredAudioLevel(long ssrc)
          Returns the last audio level that was measured by this device session for the specified ssrc.
 int getLastMeasuredLocalUserAudioLevel()
          Returns the last audio level that was measured by the underlying mixer for local user.
protected  void playerConfigureComplete(javax.media.Processor player)
          Called by MediaDeviceSession.playerControllerUpdate( ControllerEvent event) when the player associated with this session's ReceiveStream moves enters the Configured state, so we use the occasion to add our audio level effect.
protected  void processorControllerUpdate(javax.media.ControllerEvent event)
          Gets notified about ControllerEvents generated by the processor reading our capture data source, calls the corresponding method from the parent class so that it would initialize the processor and then adds the level effect for the local user audio levels.
protected  void registerLocalUserAudioLevelEffect(javax.media.Processor processor)
          Creates an audio level effect and add its to the codec chain of the TrackControl assuming that it only contains a single track.
 void setLocalUserAudioLevelListener(SimpleAudioLevelListener listener)
          Sets the SimpleAudioLevelListener that this session should be notifying about changes in local audio level related information.
 void setStreamAudioLevelListener(SimpleAudioLevelListener listener)
          Sets listener as the SimpleAudioLevelListener that we are going to notify every time a change occurs in the audio level of the media that this device session is receiving from the remote party.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.device.MediaDeviceSession
addDTMF, addPlaybackDataSource, addReceiveStream, addSSRC, checkDevice, close, createCaptureDevice, createPlayer, createProcessor, createProcessorContentDescriptor, disposePlayer, getCaptureDevice, getConnectedCaptureDevice, getDevice, getFormat, getOutputDataSource, getPlayers, getProcessorFormat, getReceiveStreams, getRemoteSSRCList, getStartedDirection, getSupportedFormats, isMute, playbackDataSourceAdded, playbackDataSourceRemoved, playerControllerUpdate, playerRealizeComplete, receiveStreamAdded, receiveStreamRemoved, removePlaybackDataSource, removeReceiveStream, removeSSRC, setContentDescriptor, setDisposePlayerOnClose, setFormat, setMute, setProcessorFormat, setProcessorFormat, start, startedDirectionChanged, startProcessorInAccordWithDirection, stop
 
Methods inherited from class net.java.sip.communicator.util.PropertyChangeNotifier
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioMediaDeviceSession

protected AudioMediaDeviceSession(AbstractMediaDevice device)
Initializes a new MediaDeviceSession instance which is to represent the use of a specific MediaDevice by a MediaStream.

Parameters:
device - the MediaDevice the use of which by a MediaStream is to be represented by the new instance
Method Detail

playerConfigureComplete

protected void playerConfigureComplete(javax.media.Processor player)
Called by MediaDeviceSession.playerControllerUpdate( ControllerEvent event) when the player associated with this session's ReceiveStream moves enters the Configured state, so we use the occasion to add our audio level effect.

Overrides:
playerConfigureComplete in class MediaDeviceSession
Parameters:
player - the Player which is the source of a ConfigureCompleteEvent
See Also:
MediaDeviceSession.playerConfigureComplete(Processor)

processorControllerUpdate

protected void processorControllerUpdate(javax.media.ControllerEvent event)
Gets notified about ControllerEvents generated by the processor reading our capture data source, calls the corresponding method from the parent class so that it would initialize the processor and then adds the level effect for the local user audio levels.

Overrides:
processorControllerUpdate in class MediaDeviceSession
Parameters:
event - the ControllerEvent specifying the Controller which is the source of the event and the very type of the event

registerLocalUserAudioLevelEffect

protected void registerLocalUserAudioLevelEffect(javax.media.Processor processor)
Creates an audio level effect and add its to the codec chain of the TrackControl assuming that it only contains a single track.

Parameters:
processor - the processor on which track control we need to register a level effect with.

setLocalUserAudioLevelListener

public void setLocalUserAudioLevelListener(SimpleAudioLevelListener listener)
Sets the SimpleAudioLevelListener that this session should be notifying about changes in local audio level related information. This class only supports a single listener for audio changes per source (i.e. stream or data source). Audio changes are generally quite time intensive (~ 50 per second) so we are doing this in order to reduce the number of objects associated with the process (such as event instances listener list iterators and sync copies).

Parameters:
listener - the SimpleAudioLevelListener to add

setStreamAudioLevelListener

public void setStreamAudioLevelListener(SimpleAudioLevelListener listener)
Sets listener as the SimpleAudioLevelListener that we are going to notify every time a change occurs in the audio level of the media that this device session is receiving from the remote party. This class only supports a single listener for audio changes per source (i.e. stream or data source). Audio changes are generally quite time intensive (~ 50 per second) so we are doing this in order to reduce the number of objects associated with the process (such as event instances listener list iterators and sync copies).

Parameters:
listener - the SimpleAudioLevelListener that we want notified for audio level changes in the remote participant's media.

getLastMeasuredAudioLevel

public int getLastMeasuredAudioLevel(long ssrc)
Returns the last audio level that was measured by this device session for the specified ssrc.

Parameters:
ssrc - the SSRC ID whose last measured audio level we'd like to retrieve.
Returns:
the audio level that was last measured for the specified ssrc or -1 if no level has been cached for that ID.

getLastMeasuredLocalUserAudioLevel

public int getLastMeasuredLocalUserAudioLevel()
Returns the last audio level that was measured by the underlying mixer for local user.

Returns:
the audio level that was last measured for the local user.

copyPlayback

public void copyPlayback(MediaDeviceSession deviceSession)
Copies the playback part of a specific MediaDeviceSession into this instance.

Overrides:
copyPlayback in class MediaDeviceSession
Parameters:
deviceSession - the MediaDeviceSession to copy the playback part of into this instance

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.