public class CallPeerMediaHandlerJabberImpl extends AbstractCallPeerMediaHandlerJabberGTalkImpl<CallPeerJabberImpl>
AUDIO_LOCAL_SSRC, AUDIO_REMOTE_SSRC, locallyOnHold, SSRC_UNKNOWN, VIDEO_LOCAL_SSRC, VIDEO_REMOTE_SSRC
Constructor and Description |
---|
CallPeerMediaHandlerJabberImpl(CallPeerJabberImpl peer)
Creates a new handler that will be managing media streams for
peer.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
addDtlsAdvertisedEncryptions(boolean isInitiator,
IceUdpTransportPacketExtension remoteTransport,
org.jitsi.service.neomedia.MediaType mediaType)
Detects and adds DTLS-SRTP available encryption method present in the
transport (description) given in parameter.
|
void |
close()
Closes the CallPeerMediaHandler.
|
ContentPacketExtension |
createContentForMedia(org.jitsi.service.neomedia.MediaType mediaType)
Creates a
ContentPacketExtension for a particular stream. |
java.util.List<ContentPacketExtension> |
createContentList()
Creates a List containing the
ContentPacketExtension s of
the streams that this handler is prepared to initiate depending on
available MediaDevices and local on-hold and video transmission
preferences. |
java.util.List<ContentPacketExtension> |
createContentList(org.jitsi.service.neomedia.MediaType mediaType)
Creates a List containing the
ContentPacketExtension s of
the streams of a specific MediaType that this handler is
prepared to initiate depending on available MediaDevices and
local on-hold and video transmission preferences. |
protected void |
firePropertyChange(java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
Overrides to give access to the transport manager to send events
about ICE state changes.
|
java.lang.Iterable<ContentPacketExtension> |
generateSessionAccept()
Wraps up any ongoing candidate harvests and returns our response to the
last offer we've received, so that the peer could use it to send a
session-accept.
|
ContentPacketExtension |
getLocalContent(java.lang.String contentType)
Returns the local content of a specific content type (like audio or
video).
|
java.lang.Iterable<ContentPacketExtension> |
getLocalContentList()
Returns a complete list of call currently known local content-s.
|
org.jitsi.service.neomedia.QualityControl |
getQualityControl()
Returns the quality control for video calls if any.
|
ContentPacketExtension |
getRemoteContent(java.lang.String contentType)
Get the remote content of a specific content type (like audio or video).
|
long |
getRemoteSSRC(org.jitsi.service.neomedia.MediaType mediaType)
Gets the last-known SSRC of an RTP stream with a specific
MediaType received by a MediaStream of this instance.
|
protected TransportManagerJabberImpl |
getTransportManager()
Gets the TransportManager implementation handling our address
management.
|
java.util.List<java.awt.Component> |
getVisualComponents()
Gets the visual Components in which videos from the remote peer
are currently being rendered.
|
protected org.jitsi.service.neomedia.MediaStream |
initStream(java.lang.String streamName,
org.jitsi.service.neomedia.StreamConnector connector,
org.jitsi.service.neomedia.device.MediaDevice device,
org.jitsi.service.neomedia.format.MediaFormat format,
org.jitsi.service.neomedia.MediaStreamTarget target,
org.jitsi.service.neomedia.MediaDirection direction,
java.util.List<org.jitsi.service.neomedia.RTPExtension> rtpExtensions,
boolean masterStream)
Creates if necessary, and configures the stream that this
MediaHandler is using for the MediaType matching the
one of the MediaDevice.
|
boolean |
isRemotelyOnHold()
Determines whether the remote party has placed all our streams on hold.
|
protected void |
mediaHandlerPropertyChange(java.beans.PropertyChangeEvent ev)
Notifies this instance about a PropertyChangeEvent fired by the
associated
MediaHandler . |
void |
processAnswer(java.util.List<ContentPacketExtension> answer)
Handles the specified answer by creating and initializing the
corresponding MediaStreams.
|
(package private) void |
processColibriConferenceIQ(ColibriConferenceIQ conferenceIQ)
Notifies this instance that a specific ColibriConferenceIQ has
been received.
|
void |
processOffer(java.util.List<ContentPacketExtension> offer)
Parses and handles the specified offer and returns a content
extension representing the current state of this media handler.
|
void |
processTransportInfo(java.lang.Iterable<ContentPacketExtension> contents)
Processes the transport-related information provided by the remote
peer in a specific set of ContentPacketExtensions.
|
protected TransportManagerJabberImpl |
queryTransportManager()
Gets the TransportManager implementation handling our address
management.
|
void |
reinitAllContents()
Reinitialize all media contents.
|
void |
reinitContent(java.lang.String name,
ContentPacketExtension content,
boolean modify)
Reinitialize a media content such as video.
|
void |
removeContent(java.lang.String name)
Removes a media content with a specific name from the session represented
by this CallPeerMediaHandlerJabberImpl and closes its associated
media stream.
|
void |
setLocallyOnHold(boolean locallyOnHold)
Puts all MediaStreams in this handler locally on or off hold
(according to the value of locallyOnHold).
|
void |
setRemotelyOnHold(boolean onHold)
Acts upon a notification received from the remote party indicating that
they've put us on/off hold.
|
void |
setSupportedTransports(java.util.Collection<java.lang.String> transports)
Sets the jingle transports that this
CallPeerMediaHandlerJabberImpl supports.
|
void |
setSupportQualityControls(boolean value)
Sometimes as initing a call with custom preset can set and we force
that quality controls is supported.
|
void |
start()
Waits for the associated TransportManagerJabberImpl to conclude
any started connectivity establishment and then starts this
CallPeerMediaHandler.
|
protected void |
throwOperationFailedException(java.lang.String message,
int errorCode,
java.lang.Throwable cause)
Lets the underlying implementation take note of this error and only
then throws it to the using bundles.
|
addSDesAdvertisedEncryptions, addZrtpAdvertisedEncryptions, getLocalInputEvtAware, isRemoteZrtpCapable, selectSdesCryptoSuite, setAndAddPreferredEncryptionProtocol, setAndAddPreferredEncryptionProtocol, setLocalInputEvtAware, setSDesEncryptionOnDescription, setZrtpEncryptionOnDescription
addAdvertisedEncryptionMethod, addVideoListener, closeStream, findMediaFormat, fireVideoEvent, fireVideoEvent, getAdvertisedEncryptionMethods, getDefaultDevice, getDirectionUserPreference, getDynamicPayloadTypes, getEncryptionMethod, getExtensionsForType, getHarvestingTime, getICECandidateExtendedType, getICELocalHostAddress, getICELocalReflexiveAddress, getICELocalRelayedAddress, getICERemoteHostAddress, getICERemoteReflexiveAddress, getICERemoteRelayedAddress, getICEState, getLabel, getLocallySupportedFormats, getLocallySupportedFormats, getLocalVisualComponent, getMediaHandler, getMsid, getMsLabel, getNbHarvesting, getNbHarvesting, getPeer, getRtpExtensionsRegistry, getSrtpControls, getStream, getTotalHarvestingTime, getVisualComponent, initStream, intersectFormats, intersectRTPExtensions, isDeviceActive, isDeviceActive, isLocalAudioTransmissionEnabled, isLocallyOnHold, isLocalVideoTransmissionEnabled, isMute, isRTPTranslationEnabled, isSecure, processKeyFrameRequest, removeAndCleanupOtherSrtpControls, removeVideoListener, requestKeyFrame, sendHolePunchPacket, setCsrcAudioLevelListener, setDisableHolePunching, setLocalAudioTransmissionEnabled, setLocalUserAudioLevelListener, setLocalVideoTransmissionEnabled, setMediaHandler, setMute, setStreamAudioLevelListener, startSrtpMultistream
public CallPeerMediaHandlerJabberImpl(CallPeerJabberImpl peer)
peer
- that CallPeerJabberImpl instance that we will be
managing media for.public void close()
close
in class CallPeerMediaHandler<CallPeerJabberImpl>
public ContentPacketExtension createContentForMedia(org.jitsi.service.neomedia.MediaType mediaType) throws OperationFailedException
ContentPacketExtension
for a particular stream.mediaType
- MediaType of the contentContentPacketExtension
OperationFailedException
- if we fail to create the descriptions
for reasons like - problems with device interaction, allocating ports,
etc.public java.util.List<ContentPacketExtension> createContentList() throws OperationFailedException
ContentPacketExtension
s of
the streams that this handler is prepared to initiate depending on
available MediaDevices and local on-hold and video transmission
preferences.List
containing the ContentPacketExtension
s of
streams that this handler is prepared to initiate.OperationFailedException
- if we fail to create the descriptions
for reasons like problems with device interaction, allocating ports, etc.public java.util.List<ContentPacketExtension> createContentList(org.jitsi.service.neomedia.MediaType mediaType) throws OperationFailedException
ContentPacketExtension
s of
the streams of a specific MediaType that this handler is
prepared to initiate depending on available MediaDevices and
local on-hold and video transmission preferences.mediaType
- MediaType of the contentList
containing the ContentPacketExtension
s of
streams that this handler is prepared to initiate.OperationFailedException
- if we fail to create the descriptions
for reasons like - problems with device interaction, allocating ports,
etc.protected void firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
firePropertyChange
in class org.jitsi.util.event.PropertyChangeNotifier
property
- the name of the property of this
PropertyChangeNotifier which had its value changedoldValue
- the value of the property with the specified name before
the changenewValue
- the value of the property with the specified name afterpublic java.lang.Iterable<ContentPacketExtension> generateSessionAccept() throws OperationFailedException
ContentPacketExtension
s that
the call peer could use to send a session-accept.OperationFailedException
- if we fail to configure the media streampublic ContentPacketExtension getLocalContent(java.lang.String contentType)
contentType
- content type namepublic java.lang.Iterable<ContentPacketExtension> getLocalContentList()
ContentPacketExtension
null if not foundpublic org.jitsi.service.neomedia.QualityControl getQualityControl()
public ContentPacketExtension getRemoteContent(java.lang.String contentType)
contentType
- content type namepublic long getRemoteSSRC(org.jitsi.service.neomedia.MediaType mediaType)
getRemoteSSRC
in class CallPeerMediaHandler<CallPeerJabberImpl>
protected TransportManagerJabberImpl getTransportManager()
getTransportManager
in class CallPeerMediaHandler<CallPeerJabberImpl>
CallPeerMediaHandler.getTransportManager()
protected TransportManagerJabberImpl queryTransportManager()
queryTransportManager
in class CallPeerMediaHandler<CallPeerJabberImpl>
CallPeerMediaHandler.queryTransportManager()
public java.util.List<java.awt.Component> getVisualComponents()
getVisualComponents
in class CallPeerMediaHandler<CallPeerJabberImpl>
protected org.jitsi.service.neomedia.MediaStream initStream(java.lang.String streamName, org.jitsi.service.neomedia.StreamConnector connector, org.jitsi.service.neomedia.device.MediaDevice device, org.jitsi.service.neomedia.format.MediaFormat format, org.jitsi.service.neomedia.MediaStreamTarget target, org.jitsi.service.neomedia.MediaDirection direction, java.util.List<org.jitsi.service.neomedia.RTPExtension> rtpExtensions, boolean masterStream) throws OperationFailedException
streamName
- the name of the stream as indicated in the XMPP
content element.connector
- the MediaConnector that we'd like to bind the
newly created stream to.device
- the MediaDevice that we'd like to attach the newly
created MediaStream to.format
- the MediaFormat that we'd like the new
MediaStream to be set to transmit in.target
- the MediaStreamTarget containing the RTP and RTCP
address:port couples that the new stream would be sending packets to.direction
- the MediaDirection that we'd like the new
stream to use (i.e. sendonly, sendrecv, recvonly, or inactive).rtpExtensions
- the list of RTPExtensions that should be
enabled for this stream.masterStream
- whether the stream to be used as master if securedOperationFailedException
- if creating the stream fails for any
reason (like for example accessing the device or setting the format).protected void mediaHandlerPropertyChange(java.beans.PropertyChangeEvent ev)
MediaHandler
. Since this instance wraps around the
associated MediaHandler, it forwards the property changes as its
own. Allows extenders to override.
In the case of a telephony conference organized by the local peer/user
and utilizing the Jitsi Videobridge server-side technology, a single
MediaHandler is shared by multiple
CallPeerMediaHandlers in order to have a single
AudioMediaStream and a single VideoMediaStream.
However, CallPeerMediaHandlerJabberImpl has redefined the
reading/getting the remote audio and video SSRCs. Consequently,
CallPeerMediaHandlerJabberImpl has to COMPLETELY redefine the
writing/setting as well i.e. it has to stop related
PropertyChangeEvents fired by the super.mediaHandlerPropertyChange
in class CallPeerMediaHandler<CallPeerJabberImpl>
ev
- the PropertyChangeEvent fired by the associated
MediaHandlerpublic void processAnswer(java.util.List<ContentPacketExtension> answer) throws OperationFailedException, java.lang.IllegalArgumentException
answer
- the Jingle answerOperationFailedException
- if we fail to handle answer for
reasons like failing to initialize media devices or streams.java.lang.IllegalArgumentException
- if there's a problem with the syntax or
the semantics of answer. Method is synchronized in order to
avoid closing mediaHandler when we are currently in process of
initializing, configuring and starting streams and anybody interested
in this operation can synchronize to the mediaHandler instance to wait
processing to stop (method setState in CallPeer).void processColibriConferenceIQ(ColibriConferenceIQ conferenceIQ)
conferenceIQ
- the ColibriConferenceIQ which has been
receivedpublic void processOffer(java.util.List<ContentPacketExtension> offer) throws OperationFailedException, java.lang.IllegalArgumentException
offer
- the offer that we'd like to parse, handle and get an answer
for.OperationFailedException
- if we have a problem satisfying the
description received in offer (e.g. failed to open a device or
initialize a stream ...).java.lang.IllegalArgumentException
- if there's a problem with
offer's format or semantics.public void processTransportInfo(java.lang.Iterable<ContentPacketExtension> contents) throws OperationFailedException
contents
- the ContentPacketExtenions provided by the
remote peer and containing the transport-related information to
be processedOperationFailedException
- if anything goes wrong while processing
the transport-related information provided by the remote peer in
the specified set of ContentPacketExtensionspublic void reinitAllContents() throws OperationFailedException, java.lang.IllegalArgumentException
OperationFailedException
- if we fail to handle content
for reasons like failing to initialize media devices or streams.java.lang.IllegalArgumentException
- if there's a problem with the syntax or
the semantics of content. Method is synchronized in order to
avoid closing mediaHandler when we are currently in process of
initializing, configuring and starting streams and anybody interested
in this operation can synchronize to the mediaHandler instance to wait
processing to stop (method setState in CallPeer).public void reinitContent(java.lang.String name, ContentPacketExtension content, boolean modify) throws OperationFailedException, java.lang.IllegalArgumentException
name
- name of the Jingle contentcontent
- media contentmodify
- if it correspond to a content-modify for resolution changeOperationFailedException
- if we fail to handle content
for reasons like failing to initialize media devices or streams.java.lang.IllegalArgumentException
- if there's a problem with the syntax or
the semantics of content. Method is synchronized in order to
avoid closing mediaHandler when we are currently in process of
initializing, configuring and starting streams and anybody interested
in this operation can synchronize to the mediaHandler instance to wait
processing to stop (method setState in CallPeer).public void removeContent(java.lang.String name)
name
- the name of the media content to be removed from this sessionpublic void setRemotelyOnHold(boolean onHold)
onHold
- true if the remote party has put us on hold
and false if they've just put us off hold.public void setSupportQualityControls(boolean value)
value
- whether quality controls is supported..public void start() throws java.lang.IllegalStateException
start
in class CallPeerMediaHandler<CallPeerJabberImpl>
java.lang.IllegalStateException
- if no offer or answer has been provided or
generated earlierprotected void throwOperationFailedException(java.lang.String message, int errorCode, java.lang.Throwable cause) throws OperationFailedException
throwOperationFailedException
in class CallPeerMediaHandler<CallPeerJabberImpl>
message
- the message to be logged and then wrapped in a new
OperationFailedExceptionerrorCode
- the error code to be assigned to the new
OperationFailedExceptioncause
- the Throwable that has caused the necessity to log
an error and have a new OperationFailedException thrownOperationFailedException
- the exception that we wanted this method
to throw.public boolean isRemotelyOnHold()
isRemotelyOnHold
in class CallPeerMediaHandler<CallPeerJabberImpl>
public void setLocallyOnHold(boolean locallyOnHold)
setLocallyOnHold
in class CallPeerMediaHandler<CallPeerJabberImpl>
locallyOnHold
- true if we are to make our streams
stop transmitting and false if we are to start transmittingboolean addDtlsAdvertisedEncryptions(boolean isInitiator, IceUdpTransportPacketExtension remoteTransport, org.jitsi.service.neomedia.MediaType mediaType)
isInitiator
- true if the local call instance is the
initiator of the call; false, otherwise.remoteTransport
- the TRANSPORT elementmediaType
- The type of media (AUDIO or VIDEO).public void setSupportedTransports(java.util.Collection<java.lang.String> transports)
transports
- A Collection of XML namespaces of jingle
transport elements to be set as the supported jingle transports for this
CallPeerMediaHandlerJabberImpl
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.