public class AudioMediaStreamImpl extends MediaStreamImpl implements AudioMediaStream, java.beans.PropertyChangeListener
PROPERTY_NAME_RECEIVE_BUFFER_LENGTH, sendStreamsAreCreated
rtpTranslator
DISABLE_DTMF_HANDLING_PNAME
PNAME_LOCAL_SSRC, PNAME_REMOTE_SSRC
Constructor and Description |
---|
AudioMediaStreamImpl(StreamConnector connector,
MediaDevice device,
SrtpControl srtpControl)
Initializes a new AudioMediaStreamImpl instance which will use
the specified MediaDevice for both capture and playback of audio
exchanged via the specified StreamConnector.
|
Modifier and Type | Method and Description |
---|---|
void |
addDTMFListener(DTMFListener listener)
Adds a DTMFListener to this AudioMediaStream which is
to receive notifications when the remote party starts sending DTMF tones
to us.
|
void |
addRTPExtension(byte extensionID,
RTPExtension rtpExtension)
In addition to calling
MediaStreamImpl.addRTPExtension(byte, RTPExtension)
this method enables sending of CSRC audio levels. |
void |
audioLevelsReceived(long[] audioLevels)
Delivers the audioLevels map to whoever is interested.
|
void |
close()
Releases the resources allocated by this instance in the course of its
execution and prepares it to be garbage collected.
|
protected void |
configureRTPManagerBufferControl(StreamRTPManager rtpManager,
javax.media.control.BufferControl bufferControl)
Performs any optional configuration on the BufferControl of the
specified RTPManager which is to be used as the
RTPManager of this MediaStreamImpl.
|
protected DiscardTransformEngine |
createDiscardEngine()
Creates the
DiscardTransformEngine for this stream. |
protected DtmfTransformEngine |
createDtmfTransformEngine()
A stub that allows audio oriented streams to create and keep a reference
to a DtmfTransformEngine.
|
protected SsrcTransformEngine |
createSsrcTransformEngine() |
protected void |
deviceSessionChanged(MediaDeviceSession oldValue,
MediaDeviceSession newValue)
Notifies this MediaStream that the MediaDevice (and
respectively the MediaDeviceSession with it) which this instance
uses for capture and playback of media has been changed.
|
void |
fireDTMFEvent(DTMFRtpTone tone,
boolean end)
Delivers the DTMF tones.
|
AudioMediaDeviceSession |
getDeviceSession()
Returns the MediaDeviceSession associated with this stream
after first casting it to AudioMediaDeviceSession since this is,
after all, an AudioMediaStreamImpl.
|
int |
getLastMeasuredAudioLevel(long ssrc)
Returns the last audio level that was measured by the underlying device
session for the specified ssrc (where ssrc could also
correspond to our local sync source identifier).
|
MediaStreamTrackReceiver |
getMediaStreamTrackReceiver()
Gets the
MediaStreamTrackReceiver of this MediaStream . |
protected int |
getPriority()
The priority of the audio is 3, which is meant to be higher than
other threads and higher than the video one.
|
protected TransformEngine |
getRTCPTermination()
Gets the RTCP termination for this
MediaStreamImpl . |
void |
propertyChange(java.beans.PropertyChangeEvent ev)
Receives and reacts to property change events: if the selected device
(for capture, playback or notifications) has changed, then create or
recreate the streams in order to use it.
|
protected void |
registerCustomCodecFormats(StreamRTPManager rtpManager)
Registers
CUSTOM_CODEC_FORMATS with a specific
RTPManager. |
void |
removeDTMFListener(DTMFListener listener)
Removes listener from the list of DTMFListeners
registered with this AudioMediaStream to receive notifications
about incoming DTMF tones.
|
void |
setCsrcAudioLevelListener(CsrcAudioLevelListener listener)
Registers listener as the CsrcAudioLevelListener that
will receive notifications for changes in the levels of conference
participants that the remote party could be mixing.
|
void |
setLocalUserAudioLevelListener(SimpleAudioLevelListener listener)
Sets listener as the SimpleAudioLevelListener
registered to receive notifications from our device session for changes
in the levels of the audio that this stream is sending out.
|
void |
setOutputVolumeControl(VolumeControl outputVolumeControl)
Sets the VolumeControl which is to control the volume (level)
of the audio received in/by this AudioMediaStream and played
back.
|
void |
setStreamAudioLevelListener(SimpleAudioLevelListener listener)
Sets listener as the SimpleAudioLevelListener
registered to receive notifications from our device session for changes
in the levels of the party that's at the other end of this stream.
|
void |
startSendingDTMF(DTMFTone tone,
DTMFMethod dtmfMethod,
int minimalToneDuration,
int maximalToneDuration,
int volume)
Starts sending the specified DTMFTone until the
stopSendingDTMF() method is called (Excepts for INBAND DTMF,
which stops by itself this is why where there is no need to call the
stopSendingDTMF).
|
void |
stopSendingDTMF(DTMFMethod dtmfMethod)
Interrupts transmission of a DTMFTone started with the
startSendingDTMF() method.
|
addDynamicRTPPayloadType, addDynamicRTPPayloadTypeOverride, addRemoteSourceID, clearDynamicRTPPayloadTypes, clearRTPExtensions, configureDataInputStream, configureDataOutputStream, createAbsSendTimeEngine, createCachingTransformer, createRetransmissionRequester, createSendStreams, getActiveRTPExtensionID, getActiveRTPExtensions, getCachingTransformer, getCsrcEngine, getDevice, getDiagnosticContext, getDirection, getDynamicRTPPayloadType, getDynamicRTPPayloadTypes, getFecTransformEngine, getFormat, getFormat, getLocalContributingSourceIDs, getLocalControlAddress, getLocalDataAddress, getLocalSourceID, getMediaStreamStats, getMediaType, getPaddingTermination, getPrimaryREDBlock, getPrimaryREDBlock, getReceiveStream, getReceiveStreams, getRedTransformEngine, getRemoteBitrateEstimator, getRemoteContributingSourceIDs, getRemoteControlAddress, getRemoteDataAddress, getRemoteSourceID, getRemoteSourceIDs, getRetransmissionRequester, getRTPConnector, getRTPManager, getRtxTransformer, getSpatialID, getSrtpControl, getStatisticsEngine, getStreamRTPManager, getTarget, getTemporalID, getTransformEngineChain, getTransportCCEngine, getTransportProtocol, injectPacket, isEndOfFrame, isKeyFrame, isKeyFrame, isMute, isStarted, isStartOfFrame, queryRTPManager, recreateSendStreams, removeReceiveStreamForSsrc, rtpConnectorChanged, setConnector, setDevice, setDirection, setExternalTransformer, setFecTransformEngine, setFormat, setLocalSourceID, setMute, setSSRCFactory, setTarget, setTransportCCEngine, start, stop, supportsFrameBoundaries, toString, update, update, update, update
addPropertyChangeListener, assertDirection, firePropertyChange, getName, getProperty, getRTPTranslator, handleAttributes, injectPacket, removePropertyChangeListener, setName, setProperty, setRTPTranslator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addDynamicRTPPayloadType, addDynamicRTPPayloadTypeOverride, addPropertyChangeListener, clearDynamicRTPPayloadTypes, clearRTPExtensions, getActiveRTPExtensions, getDevice, getDirection, getDynamicRTPPayloadType, getDynamicRTPPayloadTypes, getFormat, getFormat, getLocalSourceID, getMediaStreamStats, getName, getPrimaryREDBlock, getPrimaryREDBlock, getProperty, getRemoteControlAddress, getRemoteDataAddress, getRemoteSourceID, getRemoteSourceIDs, getRetransmissionRequester, getRTPTranslator, getSrtpControl, getStreamRTPManager, getTarget, getTransformEngineChain, getTransportProtocol, injectPacket, isKeyFrame, isKeyFrame, isMute, isStarted, removePropertyChangeListener, removeReceiveStreamForSsrc, setConnector, setDevice, setDirection, setExternalTransformer, setFormat, setMute, setName, setProperty, setRTPTranslator, setSSRCFactory, setTarget, setTransportCCEngine, start, stop
public AudioMediaStreamImpl(StreamConnector connector, MediaDevice device, SrtpControl srtpControl)
connector
- the StreamConnector the new instance is to use
for sending and receiving audiodevice
- the MediaDevice the new instance is to use for
both capture and playback of audio exchanged via the specified
StreamConnectorsrtpControl
- a control which is already created, used to control
the srtp operations.public void addDTMFListener(DTMFListener listener)
addDTMFListener
in interface AudioMediaStream
listener
- the DTMFListener to register for notifications
about the remote party starting sending of DTM tones to this
AudioMediaStreamAudioMediaStream.addDTMFListener(DTMFListener)
public void addRTPExtension(byte extensionID, RTPExtension rtpExtension)
MediaStreamImpl.addRTPExtension(byte, RTPExtension)
this method enables sending of CSRC audio levels. The reason we are
doing this here rather than in the super class is that CSRC levels only
make sense for audio streams so we don't want them enabled in any other
type.addRTPExtension
in interface MediaStream
addRTPExtension
in class MediaStreamImpl
extensionID
- the ID assigned to rtpExtension for the
lifetime of this stream.rtpExtension
- the RTPExtension that is being added to this stream.public void audioLevelsReceived(long[] audioLevels)
audioLevels
- an array mapping CSRC IDs to audio levels in
consecutive elements.public void close()
close
in interface MediaStream
close
in class MediaStreamImpl
MediaStream.close()
protected void configureRTPManagerBufferControl(StreamRTPManager rtpManager, javax.media.control.BufferControl bufferControl)
configureRTPManagerBufferControl
in class MediaStreamImpl
rtpManager
- the RTPManager which is to be used by this
MediaStreamImplbufferControl
- the BufferControl of rtpManager on
which any optional configuration is to be performedprotected DtmfTransformEngine createDtmfTransformEngine()
createDtmfTransformEngine
in class MediaStreamImpl
protected SsrcTransformEngine createSsrcTransformEngine()
createSsrcTransformEngine
in class MediaStreamImpl
protected void deviceSessionChanged(MediaDeviceSession oldValue, MediaDeviceSession newValue)
localUserAudioLevelListener
and
streamAudioLevelListener
which have been set on this
AudioMediaStream will be automatically updated when a new
MediaDevice is set on this instance.deviceSessionChanged
in class MediaStreamImpl
oldValue
- the MediaDeviceSession with the
MediaDevice this instance used work withnewValue
- the MediaDeviceSession with the
MediaDevice this instance is to work withpublic void fireDTMFEvent(DTMFRtpTone tone, boolean end)
tone
- the new toneend
- true if the tone is to be ended or false to
be startedpublic AudioMediaDeviceSession getDeviceSession()
getDeviceSession
in class MediaStreamImpl
public int getLastMeasuredAudioLevel(long ssrc)
ssrc
- the SSRC ID whose last measured audio level we'd like to
retrieve.protected int getPriority()
getPriority
in class MediaStreamImpl
public void propertyChange(java.beans.PropertyChangeEvent ev)
propertyChange
in interface java.beans.PropertyChangeListener
ev
- The event which may contain a audio system change event.protected void registerCustomCodecFormats(StreamRTPManager rtpManager)
CUSTOM_CODEC_FORMATS
with a specific
RTPManager.registerCustomCodecFormats
in class MediaStreamImpl
rtpManager
- the RTPManager to register
CUSTOM_CODEC_FORMATS
withMediaStreamImpl.registerCustomCodecFormats(StreamRTPManager)
public void removeDTMFListener(DTMFListener listener)
removeDTMFListener
in interface AudioMediaStream
listener
- the DTMFListener to no longer be notified by
this AudioMediaStream about incoming DTMF tonesAudioMediaStream.removeDTMFListener(DTMFListener)
public void setCsrcAudioLevelListener(CsrcAudioLevelListener listener)
setCsrcAudioLevelListener
in interface AudioMediaStream
listener
- the CsrcAudioLevelListener that we'd like to
register or null if we'd like to stop receiving notifications.public void setLocalUserAudioLevelListener(SimpleAudioLevelListener listener)
setLocalUserAudioLevelListener
in interface AudioMediaStream
listener
- the SimpleAudioLevelListener that we'd like to
register or null if we want to stop local audio level
measurements.public void setOutputVolumeControl(VolumeControl outputVolumeControl)
setOutputVolumeControl
in interface AudioMediaStream
outputVolumeControl
- the VolumeControl which is to control
the volume (level) of the audio received in this
AudioMediaStream and played backpublic void setStreamAudioLevelListener(SimpleAudioLevelListener listener)
setStreamAudioLevelListener
in interface AudioMediaStream
listener
- the SimpleAudioLevelListener that we'd like to
register or null if we want to stop stream audio level
measurements.public void startSendingDTMF(DTMFTone tone, DTMFMethod dtmfMethod, int minimalToneDuration, int maximalToneDuration, int volume)
startSendingDTMF
in interface AudioMediaStream
tone
- the DTMFTone to start sending.dtmfMethod
- The kind of DTMF used (RTP, SIP-INOF or INBAND).minimalToneDuration
- The minimal DTMF tone duration.maximalToneDuration
- The maximal DTMF tone duration.volume
- The DTMF tone volume.java.lang.IllegalArgumentException
- if dtmfMethod is not one of
DTMFMethod.INBAND_DTMF
, DTMFMethod.RTP_DTMF
, and
DTMFMethod.SIP_INFO_DTMF
AudioMediaStream.startSendingDTMF(
DTMFTone, DTMFMethod, int, int, int)
public void stopSendingDTMF(DTMFMethod dtmfMethod)
stopSendingDTMF
in interface AudioMediaStream
dtmfMethod
- The kind of DTMF used (RTP, SIP-INOF or INBAND).java.lang.IllegalArgumentException
- if dtmfMethod is not one of
DTMFMethod.INBAND_DTMF
, DTMFMethod.RTP_DTMF
, and
DTMFMethod.SIP_INFO_DTMF
AudioMediaStream.stopSendingDTMF(DTMFMethod)
protected DiscardTransformEngine createDiscardEngine()
DiscardTransformEngine
for this stream. Allows
extenders to override.createDiscardEngine
in class MediaStreamImpl
protected TransformEngine getRTCPTermination()
MediaStreamImpl
.getRTCPTermination
in class MediaStreamImpl
public MediaStreamTrackReceiver getMediaStreamTrackReceiver()
MediaStreamTrackReceiver
of this MediaStream
.getMediaStreamTrackReceiver
in interface MediaStream
getMediaStreamTrackReceiver
in class AbstractMediaStream
MediaStreamTrackReceiver
of this MediaStream
,
or null.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.