Package org.jitsi.impl.neomedia.device
Class AudioMediaDeviceSession
- java.lang.Object
-
- org.jitsi.utils.event.PropertyChangeNotifier
-
- org.jitsi.impl.neomedia.device.MediaDeviceSession
-
- org.jitsi.impl.neomedia.device.AudioMediaDeviceSession
-
public class AudioMediaDeviceSession extends MediaDeviceSession
Extends MediaDeviceSession to add audio-specific functionality.- Author:
- Emil Ivov, Damian Minkov, Lyubomir Marinov, Boris Grozev
-
-
Field Summary
-
Fields inherited from class org.jitsi.impl.neomedia.device.MediaDeviceSession
OUTPUT_DATA_SOURCE, outputSizeChanged, SSRC_LIST, useTranslator
-
-
Constructor Summary
Constructors Constructor Description AudioMediaDeviceSession(AbstractMediaDevice device)Initializes a new MediaDeviceSession instance which is to represent the use of a specific MediaDevice by a MediaStream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopyPlayback(MediaDeviceSession deviceSession)Copies the playback part of a specific MediaDeviceSession into this instance.protected javax.media.ProcessorcreateProcessor()Performs additional configuration on the Processor, after it is configured, but before it is realized.protected javax.media.RenderercreateRenderer(javax.media.Player player, javax.media.control.TrackControl trackControl)Initializes a Renderer instance which is to be utilized by a specific Player in order to play back the media represented by a specific TrackControl.voidenableOutputSSRCAudioLevels(boolean enabled, byte extensionID)Enables or disables measuring audio levels for the output DataSource of this AudioMediaDeviceSession.intgetLastMeasuredAudioLevel(long ssrc)Returns the last audio level that was measured by this device session for the specified ssrc.intgetLastMeasuredLocalUserAudioLevel()Returns the last audio level that was measured by the underlying mixer for local user.protected voidplayerConfigureComplete(javax.media.Processor player)Called byMediaDeviceSession.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 voidprocessorControllerUpdate(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 voidregisterLocalUserAudioLevelEffect(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.voidsetLocalUserAudioLevelListener(SimpleAudioLevelListener listener)Sets the SimpleAudioLevelListener that this session should be notifying about changes in local audio level related information.voidsetOutputVolumeControl(VolumeControl outputVolumeControl)Sets the VolumeControl which is to control the volume (level) of the audio (to be) played back by this instance.voidsetStreamAudioLevelListener(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.static voidsetVolumeControl(javax.media.Renderer renderer, VolumeControl volumeControl)Implements a utility which facilitates setting a specific VolumeControl on a specific Renderer for the purposes of control over the volume (level) of the audio (to be) played back by the specified Renderer.-
Methods inherited from class org.jitsi.impl.neomedia.device.MediaDeviceSession
addDTMF, addPlaybackDataSource, addReceiveStream, addSSRC, checkDevice, close, createCaptureDevice, createPlayer, createProcessorContentDescriptor, disposePlayer, getCaptureDevice, getConnectedCaptureDevice, getDecoderControls, getDevice, getEncoderControls, getFormat, getOutputDataSource, getPlayer, getPlayers, getProcessorFormat, getReceiveStreams, getRemoteSSRCList, getStartedDirection, getSupportedFormats, getTranscodingDataSource, isMute, playbackDataSourceAdded, playbackDataSourceChanged, playbackDataSourceRemoved, playbackDataSourceUpdated, playerControllerUpdate, playerRealizeComplete, receiveStreamAdded, receiveStreamRemoved, removePlaybackDataSource, removeReceiveStream, removeSSRC, setCaptureDeviceFormat, setContentDescriptor, setDisposePlayerOnClose, setFormat, setMute, setProcessorFormat, setProcessorFormat, setUseTranslator, start, startedDirectionChanged, startProcessorInAccordWithDirection, stop
-
-
-
-
Constructor Detail
-
AudioMediaDeviceSession
public 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
-
copyPlayback
public void copyPlayback(MediaDeviceSession deviceSession)
Copies the playback part of a specific MediaDeviceSession into this instance.- Overrides:
copyPlaybackin classMediaDeviceSession- Parameters:
deviceSession- the MediaDeviceSession to copy the playback part of into this instance
-
createRenderer
protected javax.media.Renderer createRenderer(javax.media.Player player, javax.media.control.TrackControl trackControl)Initializes a Renderer instance which is to be utilized by a specific Player in order to play back the media represented by a specific TrackControl. Allows extenders to override and, optionally, perform additional configuration of the returned Renderer. Overrides the super implementation in order to configure the VolumeControl of the returned Renderer for the purposes of having call/telephony conference-specific volume (levels).- Overrides:
createRendererin classMediaDeviceSession- Parameters:
player- the Player which is to utilize the initialized/returned RenderertrackControl- the TrackControl which represents the media to be played back (and, technically, on which the initialized/returned Renderer is to be set)- Returns:
- the Renderer which is to be set on the specified
trackControl. If null,
TrackControl.setRenderer(Renderer)is not invoked on the specified trackControl.
-
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.
-
playerConfigureComplete
protected void playerConfigureComplete(javax.media.Processor player)
Called byMediaDeviceSession.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:
playerConfigureCompletein classMediaDeviceSession- 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:
processorControllerUpdatein classMediaDeviceSession- 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
-
setOutputVolumeControl
public void setOutputVolumeControl(VolumeControl outputVolumeControl)
Sets the VolumeControl which is to control the volume (level) of the audio (to be) played back by this instance.- Parameters:
outputVolumeControl- the VolumeControl which is to be control the volume (level) of the audio (to be) played back by this instance
-
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.
-
setVolumeControl
public static void setVolumeControl(javax.media.Renderer renderer, VolumeControl volumeControl)Implements a utility which facilitates setting a specific VolumeControl on a specific Renderer for the purposes of control over the volume (level) of the audio (to be) played back by the specified Renderer.- Parameters:
renderer- the Renderer on which the specified volumeControl is to be setvolumeControl- the VolumeControl to be set on the specified renderer
-
createProcessor
protected javax.media.Processor createProcessor()
Performs additional configuration on the Processor, after it is configured, but before it is realized. Adds the AudioLevelEffect2 instance to the codec chain, if necessary, in order to enabled audio level measurements. Initializes a new FMJ Processor which is to transcodeMediaDeviceSession.captureDeviceinto the format of this instance.- Overrides:
createProcessorin classMediaDeviceSession- Returns:
- a new FMJ Processor which is to transcode captureDevice into the format of this instance
-
enableOutputSSRCAudioLevels
public void enableOutputSSRCAudioLevels(boolean enabled, byte extensionID)Enables or disables measuring audio levels for the output DataSource of this AudioMediaDeviceSession. Note that if audio levels are to be enabled, this method needs to be called (with enabled set to true) before the output DataSource, or the Processor are accessed (viaMediaDeviceSession.getOutputDataSource()andMediaDeviceSession.getProcessor()). This limitation allows to not insert an Effect in the codec chain when measuring audio levels is not required (since we can only do this before the Processor is realized).- Parameters:
enabled- whether to enable or disable output audio levels.
-
-