Package org.jitsi.impl.neomedia.device
Class DeviceConfiguration
- java.lang.Object
-
- org.jitsi.utils.event.PropertyChangeNotifier
-
- org.jitsi.impl.neomedia.device.DeviceConfiguration
-
- All Implemented Interfaces:
PropertyChangeListener,EventListener
public class DeviceConfiguration extends org.jitsi.utils.event.PropertyChangeNotifier implements PropertyChangeListener
This class aims to provide a simple configuration interface for JMF. It retrieves stored configuration when started or listens to ConfigurationEvent for property changes and configures the JMF accordingly.- Author:
- Martin Andre, Emil Ivov, Lyubomir Marinov, Vincent Lucas
-
-
Field Summary
Fields Modifier and Type Field Description static StringAUDIO_CAPTURE_DEVICEThe name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio capture.static StringAUDIO_NOTIFY_DEVICEThe name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio notify.static StringAUDIO_PLAYBACK_DEVICEThe name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio playback.static booleanDEFAULT_AUDIO_DENOISEThe default value to be used for the PROP_AUDIO_DENOISE property when it does not have a value.static booleanDEFAULT_AUDIO_ECHOCANCELThe default value to be used for the PROP_AUDIO_ECHOCANCEL property when it does not have a value.static longDEFAULT_AUDIO_ECHOCANCEL_FILTER_LENGTH_IN_MILLISThe default value to be used for thePROP_AUDIO_ECHOCANCEL_FILTER_LENGTH_IN_MILLISproperty when it does not have a value.static intDEFAULT_VIDEO_BITRATEThe default value for video codec bitrate.static intDEFAULT_VIDEO_FRAMERATEThe default frame rate, -1 unlimited.static intDEFAULT_VIDEO_HEIGHTThe default video height.static intDEFAULT_VIDEO_RTP_PACING_THRESHOLDThe default value for video maximum bandwidth.static intDEFAULT_VIDEO_WIDTHThe default video width.static StringPROP_AUDIO_SYSTEMstatic StringPROP_AUDIO_SYSTEM_DEVICESstatic StringPROP_VIDEO_RTP_PACING_THRESHOLDThe property we use to store the settings for maximum allowed video bandwidth (used to normalize RTP traffic, and not in codec configuration)static Dimension[]SUPPORTED_RESOLUTIONSThe currently supported resolutions we will show as option and user can select.static StringVIDEO_CAPTURE_DEVICEThe name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for video capture.
-
Constructor Summary
Constructors Constructor Description DeviceConfiguration()Initializes a new DeviceConfiguration instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CaptureDeviceInfo2getAudioCaptureDevice()Returns a device that we could use for audio capture.javax.media.CaptureDeviceInfogetAudioNotifyDevice()AudioSystemgetAudioSystem()List<CaptureDeviceInfo2>getAvailableAudioCaptureDevices()Gets the list of audio capture devices which are available through this DeviceConfiguration.AudioSystem[]getAvailableAudioSystems()Returns a list of available AudioSystems.List<javax.media.CaptureDeviceInfo>getAvailableVideoCaptureDevices(MediaUseCase useCase)Gets the list of video capture devices which are available through this DeviceConfiguration, amongst which isgetVideoCaptureDevice(MediaUseCase)and represent acceptable values forsetVideoCaptureDevice(CaptureDeviceInfo, boolean)longgetEchoCancelFilterLengthInMillis()Get the echo cancellation filter length (in milliseconds).intgetFrameRate()Gets the frame rate set on this DeviceConfiguration.intgetVideoBitrate()Gets the video bitrate.javax.media.CaptureDeviceInfogetVideoCaptureDevice(MediaUseCase useCase)Returns a device that we could use for video capture.intgetVideoRTPPacingThreshold()Gets the maximum allowed video bandwidth.DimensiongetVideoSize()Gets the video size set on this DeviceConfiguration.voidpropertyChange(PropertyChangeEvent ev)Notifies this PropertyChangeListener about PropertyChangeEvents fired by, for example, the ConfigurationService and the DeviceSystems which support reinitialization/reloading.voidsetAudioSystem(AudioSystem audioSystem, boolean save)voidsetFrameRate(int frameRate)Sets and stores the frame rate.voidsetVideoBitrate(int videoBitrate)Sets and stores the video bitrate.voidsetVideoCaptureDevice(javax.media.CaptureDeviceInfo device, boolean save)Sets the device which is to be used by this DeviceConfiguration for video capture.voidsetVideoRTPPacingThreshold(int videoMaxBandwidth)Sets and stores the maximum allowed video bandwidth.voidsetVideoSize(Dimension videoSize)Sets and stores the video size.
-
-
-
Field Detail
-
AUDIO_CAPTURE_DEVICE
public static final String AUDIO_CAPTURE_DEVICE
The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio capture.- See Also:
- Constant Field Values
-
AUDIO_NOTIFY_DEVICE
public static final String AUDIO_NOTIFY_DEVICE
The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio notify.- See Also:
- Constant Field Values
-
AUDIO_PLAYBACK_DEVICE
public static final String AUDIO_PLAYBACK_DEVICE
The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio playback.- See Also:
- Constant Field Values
-
DEFAULT_AUDIO_DENOISE
public static final boolean DEFAULT_AUDIO_DENOISE
The default value to be used for the PROP_AUDIO_DENOISE property when it does not have a value.- See Also:
- Constant Field Values
-
DEFAULT_AUDIO_ECHOCANCEL
public static final boolean DEFAULT_AUDIO_ECHOCANCEL
The default value to be used for the PROP_AUDIO_ECHOCANCEL property when it does not have a value.- See Also:
- Constant Field Values
-
DEFAULT_AUDIO_ECHOCANCEL_FILTER_LENGTH_IN_MILLIS
public static final long DEFAULT_AUDIO_ECHOCANCEL_FILTER_LENGTH_IN_MILLIS
The default value to be used for thePROP_AUDIO_ECHOCANCEL_FILTER_LENGTH_IN_MILLISproperty when it does not have a value. The recommended filter length is approximately the third of the room reverberation time. For example, in a small room, reverberation time is in the order of 300 ms, so a filter length of 100 ms is a good choice (800 samples at 8000 Hz sampling rate).- See Also:
- Constant Field Values
-
DEFAULT_VIDEO_BITRATE
public static final int DEFAULT_VIDEO_BITRATE
The default value for video codec bitrate.- See Also:
- Constant Field Values
-
DEFAULT_VIDEO_FRAMERATE
public static final int DEFAULT_VIDEO_FRAMERATE
The default frame rate, -1 unlimited.- See Also:
- Constant Field Values
-
DEFAULT_VIDEO_HEIGHT
public static final int DEFAULT_VIDEO_HEIGHT
The default video height.- See Also:
- Constant Field Values
-
DEFAULT_VIDEO_RTP_PACING_THRESHOLD
public static final int DEFAULT_VIDEO_RTP_PACING_THRESHOLD
The default value for video maximum bandwidth.- See Also:
- Constant Field Values
-
DEFAULT_VIDEO_WIDTH
public static final int DEFAULT_VIDEO_WIDTH
The default video width.- See Also:
- Constant Field Values
-
PROP_AUDIO_SYSTEM
public static final String PROP_AUDIO_SYSTEM
- See Also:
- Constant Field Values
-
PROP_AUDIO_SYSTEM_DEVICES
public static final String PROP_AUDIO_SYSTEM_DEVICES
- See Also:
- Constant Field Values
-
PROP_VIDEO_RTP_PACING_THRESHOLD
public static final String PROP_VIDEO_RTP_PACING_THRESHOLD
The property we use to store the settings for maximum allowed video bandwidth (used to normalize RTP traffic, and not in codec configuration)- See Also:
- Constant Field Values
-
SUPPORTED_RESOLUTIONS
public static final Dimension[] SUPPORTED_RESOLUTIONS
The currently supported resolutions we will show as option and user can select.
-
VIDEO_CAPTURE_DEVICE
public static final String VIDEO_CAPTURE_DEVICE
The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for video capture.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAudioCaptureDevice
public CaptureDeviceInfo2 getAudioCaptureDevice()
Returns a device that we could use for audio capture.- Returns:
- the CaptureDeviceInfo of a device that we could use for audio capture.
-
getAudioNotifyDevice
public javax.media.CaptureDeviceInfo getAudioNotifyDevice()
- Returns:
- the audioNotifyDevice
-
getAudioSystem
public AudioSystem getAudioSystem()
-
getAvailableAudioCaptureDevices
public List<CaptureDeviceInfo2> getAvailableAudioCaptureDevices()
Gets the list of audio capture devices which are available through this DeviceConfiguration.- Returns:
- an array of CaptureDeviceInfo describing the audio capture devices available through this DeviceConfiguration
-
getAvailableAudioSystems
public AudioSystem[] getAvailableAudioSystems()
Returns a list of available AudioSystems. By default, an AudioSystem is considered available if it reports at least one device.- Returns:
- an array of available AudioSystems
-
getAvailableVideoCaptureDevices
public List<javax.media.CaptureDeviceInfo> getAvailableVideoCaptureDevices(MediaUseCase useCase)
Gets the list of video capture devices which are available through this DeviceConfiguration, amongst which isgetVideoCaptureDevice(MediaUseCase)and represent acceptable values forsetVideoCaptureDevice(CaptureDeviceInfo, boolean)- Parameters:
useCase- extract video capture devices that correspond to this MediaUseCase- Returns:
- an array of CaptureDeviceInfo describing the video capture devices available through this DeviceConfiguration
-
getEchoCancelFilterLengthInMillis
public long getEchoCancelFilterLengthInMillis()
Get the echo cancellation filter length (in milliseconds).- Returns:
- echo cancel filter length in milliseconds
-
getFrameRate
public int getFrameRate()
Gets the frame rate set on this DeviceConfiguration.- Returns:
- the frame rate set on this DeviceConfiguration. The
default value is
DEFAULT_VIDEO_FRAMERATE
-
getVideoBitrate
public int getVideoBitrate()
Gets the video bitrate.- Returns:
- the video codec bitrate. The default value is
DEFAULT_VIDEO_BITRATE.
-
getVideoCaptureDevice
public javax.media.CaptureDeviceInfo getVideoCaptureDevice(MediaUseCase useCase)
Returns a device that we could use for video capture.- Parameters:
useCase- MediaUseCase that will determined device we will use- Returns:
- the CaptureDeviceInfo of a device that we could use for video capture.
-
getVideoRTPPacingThreshold
public int getVideoRTPPacingThreshold()
Gets the maximum allowed video bandwidth.- Returns:
- the maximum allowed video bandwidth. The default value is
DEFAULT_VIDEO_RTP_PACING_THRESHOLD.
-
getVideoSize
public Dimension getVideoSize()
Gets the video size set on this DeviceConfiguration.- Returns:
- the video size set on this DeviceConfiguration
-
propertyChange
public void propertyChange(PropertyChangeEvent ev)
Notifies this PropertyChangeListener about PropertyChangeEvents fired by, for example, the ConfigurationService and the DeviceSystems which support reinitialization/reloading.- Specified by:
propertyChangein interfacePropertyChangeListener- Parameters:
ev- the PropertyChangeEvent to notify this PropertyChangeListener about and which describes the source and other specifics of the notification
-
setAudioSystem
public void setAudioSystem(AudioSystem audioSystem, boolean save)
-
setFrameRate
public void setFrameRate(int frameRate)
Sets and stores the frame rate.- Parameters:
frameRate- the frame rate to be set on this DeviceConfiguration
-
setVideoBitrate
public void setVideoBitrate(int videoBitrate)
Sets and stores the video bitrate.- Parameters:
videoBitrate- the video codec bitrate
-
setVideoCaptureDevice
public void setVideoCaptureDevice(javax.media.CaptureDeviceInfo device, boolean save)Sets the device which is to be used by this DeviceConfiguration for video capture.- Parameters:
device- a CaptureDeviceInfo describing device to be used by this DeviceConfiguration for video capture.save- whether we will save this option or not.
-
setVideoRTPPacingThreshold
public void setVideoRTPPacingThreshold(int videoMaxBandwidth)
Sets and stores the maximum allowed video bandwidth.- Parameters:
videoMaxBandwidth- the maximum allowed video bandwidth
-
setVideoSize
public void setVideoSize(Dimension videoSize)
Sets and stores the video size.- Parameters:
videoSize- the video size to be set on this DeviceConfiguration
-
-