T
- the peer extension class like for example CallSipImpl
or CallJabberImplU
- the media handler extension class like for example
CallPeerMediaHandlerSipImpl or
CallPeerMediaHandlerJabberImplV
- the provider extension class like for example
ProtocolProviderServiceSipImpl or
ProtocolProviderServiceJabberImplpublic abstract class MediaAwareCallPeer<T extends MediaAwareCall<?,?,V>,U extends CallPeerMediaHandler<?>,V extends ProtocolProviderService> extends AbstractCallPeer<T,V> implements org.jitsi.service.neomedia.event.SrtpListener, CallPeerConferenceListener, org.jitsi.service.neomedia.event.CsrcAudioLevelListener, org.jitsi.service.neomedia.event.SimpleAudioLevelListener
callPeerConferenceListeners, callPeerListeners, callPeerSecurityListeners, NO_CONFERENCE_MEMBERS
ERROR, INFORMATION, SEVERE, WARNING
MAX_LEVEL, MIN_LEVEL
CALL_DURATION_START_TIME_UNKNOWN, MUTE_PROPERTY_NAME
Constructor and Description |
---|
MediaAwareCallPeer(T owningCall)
Creates a new call peer with address peerAddress.
|
Modifier and Type | Method and Description |
---|---|
void |
addConferenceMembersSoundLevelListener(ConferenceMembersSoundLevelListener listener)
Adds a specific ConferenceMembersSoundLevelListener to the list
of listeners interested in and notified about changes in conference
members sound level.
|
void |
addStreamSoundLevelListener(SoundLevelListener listener)
Adds a specific SoundLevelListener to the list of listeners
interested in and notified about changes in the sound level of the audio
sent by the remote party.
|
void |
addVideoPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a specific PropertyChangeListener to the list of
listeners which get notified when the properties (e.g.
|
void |
audioLevelChanged(int newLevel)
Notified by its very majesty the media service about changes in the audio
level of the stream coming from this peer, the method generates the
corresponding events and delivers them to the listeners that have
registered here.
|
void |
audioLevelsReceived(long[] audioLevels)
Implements
CsrcAudioLevelListener.audioLevelsReceived(long[]) . |
void |
callPeerAdded(CallPeerEvent evt)
Does nothing.
|
void |
callPeerRemoved(CallPeerEvent evt)
Does nothing.
|
void |
conferenceFocusChanged(CallPeerConferenceEvent evt)
Dummy implementation of
#conferenceFocusChanged(CallPeerConferenceEvent) . |
void |
conferenceMemberAdded(CallPeerConferenceEvent conferenceEvent)
Called when this peer becomes a mixer.
|
void |
conferenceMemberErrorReceived(CallPeerConferenceEvent ev)
Dummy implementation of
#conferenceMemberErrorReceived(CallPeerConferenceEvent) . |
void |
conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent)
Called when this peer stops being a mixer.
|
T |
getCall()
Returns a reference to the call that this peer belongs to.
|
abstract org.jitsi.service.neomedia.MediaDirection |
getDirection(org.jitsi.service.neomedia.MediaType mediaType)
Returns the direction of the session for media of type mediaType
that we have with this CallPeer.
|
abstract java.lang.String |
getEntity()
Gets the String to be used for this CallPeer when
we describe it in a ConferenceInfoDocument (e.g.
|
byte[] |
getImage()
The method returns an image representation of the call peer if one is
available.
|
ConferenceInfoDocument |
getLastConferenceInfoReceived()
Gets the last ConferenceInfoDocument sent to us by this
CallPeer.
|
int |
getLastConferenceInfoReceivedVersion()
Gets the version of the last ConferenceInfoDocument
sent to us by this CallPeer, or -1 if we haven't (yet) received
a ConferenceInformationDocument from this CallPeer.
|
ConferenceInfoDocument |
getLastConferenceInfoSent()
Returns the last ConferenceInfoDocument sent by us to this
CallPeer.
|
long |
getLastConferenceInfoSentTimestamp()
Gets the time (as obtained by System.currentTimeMillis())
at which we last sent a ConferenceInfoDocument to this
CallPeer.
|
U |
getMediaHandler()
Returns a reference to the CallPeerMediaHandler used by this
peer.
|
java.lang.String |
getPeerID()
Returns a unique identifier representing this peer.
|
V |
getProtocolProvider()
Returns the protocol provider that this peer belongs to.
|
boolean |
isConfInfoScheduled()
Check whether a conference-info document is scheduled to be sent to
this CallPeer (i.e.
|
boolean |
isJitsiVideobridge()
Determines whether this CallPeer is participating in a telephony
conference organized by the local user/peer utilizing the Jitsi
Videobridge server-side technology.
|
boolean |
isLocalVideoStreaming()
Determines whether we are currently streaming video toward whoever this
MediaAwareCallPeer represents.
|
boolean |
isMute()
Determines whether the audio stream (if any) being sent to this
peer is mute.
|
void |
logAndFail(java.lang.String message,
java.lang.Throwable throwable)
Logs message and cause and sets this peer's
state to CallPeerState.FAILED
|
void |
reevalLocalHoldStatus()
Updates the state of this CallPeer to match the locally-on-hold
status of our media handler.
|
void |
reevalRemoteHoldStatus()
Updates the state of this CallPeer to match the remotely-on-hold
status of our media handler.
|
void |
removeConferenceMember(ConferenceMember conferenceMember)
Removes a specific ConferenceMember from the list of
ConferenceMembers reported by this peer through
AbstractCallPeer.getConferenceMembers() and AbstractCallPeer.getConferenceMemberCount()
if it is contained and fires
CallPeerConferenceEvent#CONFERENCE_MEMBER_REMOVED to
the currently registered CallPeerConferenceListeners. |
void |
removeConferenceMembersSoundLevelListener(ConferenceMembersSoundLevelListener listener)
Removes a specific ConferenceMembersSoundLevelListener of the
list of listeners interested in and notified about changes in conference
members sound level.
|
void |
removeStreamSoundLevelListener(SoundLevelListener listener)
Removes a specific SoundLevelListener of the list of
listeners interested in and notified about changes in stream sound level
related information.
|
void |
removeVideoPropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a specific PropertyChangeListener from the list of
listeners which get notified when the properties (e.g.
|
void |
securityMessageReceived(java.lang.String messageType,
java.lang.String i18nMessage,
int severity)
Sets the security message associated with a failure/warning or
information coming from the encryption protocol.
|
void |
securityNegotiationStarted(org.jitsi.service.neomedia.MediaType mediaType,
org.jitsi.service.neomedia.SrtpControl sender)
Indicates that the other party has timeouted replying to our
offer to secure the connection.
|
void |
securityTimeout(org.jitsi.service.neomedia.MediaType mediaType)
Indicates that the other party has timeouted replying to our
offer to secure the connection.
|
void |
securityTurnedOff(org.jitsi.service.neomedia.MediaType mediaType)
Sets the security status to OFF for this call peer.
|
void |
securityTurnedOn(org.jitsi.service.neomedia.MediaType mediaType,
java.lang.String cipher,
org.jitsi.service.neomedia.SrtpControl sender)
Sets the security status to ON for this call peer.
|
void |
setCall(T call)
Sets the call containing this peer.
|
void |
setConfInfoScheduled(boolean confInfoScheduled)
Sets the property which indicates whether a conference-info document
is scheduled to be sent to this CallPeer.
|
void |
setImage(byte[] image)
Sets the byte array containing an image representation (photo or picture)
of the call peer.
|
void |
setLastConferenceInfoReceived(ConferenceInfoDocument confInfo)
Gets the last ConferenceInfoDocument sent to us by this
CallPeer.
|
void |
setLastConferenceInfoSent(ConferenceInfoDocument confInfo)
Sets the last ConferenceInfoDocument sent by us to this
CallPeer.
|
void |
setLastConferenceInfoSentTimestamp(long newTimestamp)
Sets the time (as obtained by System.currentTimeMillis())
at which we last sent a ConferenceInfoDocument to this
CallPeer.
|
void |
setLocalVideoAllowed(boolean allowed)
Modifies the local media setup to reflect the requested setting for the
streaming of the local video and then re-invites the peer represented by
this class using a corresponding SDP description..
|
protected void |
setMediaHandler(U mediaHandler)
Sets a reference to the CallPeerMediaHandler used by this
peer.
|
void |
setMute(boolean newMuteValue)
Sets the mute property for this call peer.
|
void |
setPeerID(java.lang.String peerID)
Sets the String that serves as a unique identifier of this
CallPeer.
|
void |
setState(CallPeerState newState,
java.lang.String reason,
int reasonCode)
Overrides the parent set state method in order to make sure that we
close our media handler whenever we enter a disconnected state.
|
addCallPeerConferenceListener, addCallPeerListener, addCallPeerSecurityListener, addConferenceMember, findConferenceMember, fireCallPeerChangeEvent, fireCallPeerChangeEvent, fireCallPeerChangeEvent, fireCallPeerConferenceEvent, fireCallPeerSecurityMessageEvent, fireCallPeerSecurityNegotiationStartedEvent, fireCallPeerSecurityOffEvent, fireCallPeerSecurityOnEvent, fireCallPeerSecurityTimeoutEvent, fireConferenceMemberErrorEvent, getAlternativeIMPPAddress, getCallDurationStartTime, getCallInfoURL, getConferenceMemberCount, getConferenceMembers, getCurrentSecuritySettings, getState, isConferenceFocus, removeCallPeerConferenceListener, removeCallPeerListener, removeCallPeerSecurityListener, setAlternativeIMPPAddress, setConferenceFocus, setState, setState, toString
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, getAddress, getContact, getDisplayName, getURI, removePropertyChangeListener
public MediaAwareCallPeer(T owningCall)
owningCall
- the call that contains this call peer.public void addConferenceMembersSoundLevelListener(ConferenceMembersSoundLevelListener listener)
addConferenceMembersSoundLevelListener
in interface CallPeer
listener
- the ConferenceMembersSoundLevelListener to addjava.lang.NullPointerException
- if listener is nullpublic void addStreamSoundLevelListener(SoundLevelListener listener)
addStreamSoundLevelListener
in interface CallPeer
listener
- the SoundLevelListener to addpublic void addVideoPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the PropertyChangeListener to be notified
when the properties associated with the specified Call change
their valuespublic void audioLevelChanged(int newLevel)
audioLevelChanged
in interface org.jitsi.service.neomedia.event.SimpleAudioLevelListener
newLevel
- the new audio level of the audio stream received from the
remote peerpublic void audioLevelsReceived(long[] audioLevels)
CsrcAudioLevelListener.audioLevelsReceived(long[])
.
Delivers the received audio levels to the
ConferenceMembersSoundLevelListener
s registered with this
MediaAwareCallPeer..audioLevelsReceived
in interface org.jitsi.service.neomedia.event.CsrcAudioLevelListener
audioLevels
- the levels that we need to dispatch to all registered
ConferenceMemberSoundLevelListeners.public void callPeerAdded(CallPeerEvent evt)
evt
- the event.public void callPeerRemoved(CallPeerEvent evt)
evt
- the event.public void conferenceFocusChanged(CallPeerConferenceEvent evt)
#conferenceFocusChanged(CallPeerConferenceEvent)
.conferenceFocusChanged
in interface CallPeerConferenceListener
evt
- ignoredpublic void conferenceMemberAdded(CallPeerConferenceEvent conferenceEvent)
conferenceMemberAdded
in interface CallPeerConferenceListener
conferenceEvent
- the event containing information (that we don't
really use) on the newly add member.public void conferenceMemberErrorReceived(CallPeerConferenceEvent ev)
#conferenceMemberErrorReceived(CallPeerConferenceEvent)
.conferenceMemberErrorReceived
in interface CallPeerConferenceListener
ev
- the eventpublic void conferenceMemberRemoved(CallPeerConferenceEvent conferenceEvent)
conferenceMemberRemoved
in interface CallPeerConferenceListener
conferenceEvent
- the event containing information (that we don't
really use) on the freshly removed member.public T getCall()
getCall
in interface CallPeer
getCall
in class AbstractCallPeer<T extends MediaAwareCall<?,?,V>,V extends ProtocolProviderService>
public byte[] getImage()
public U getMediaHandler()
public java.lang.String getPeerID()
public V getProtocolProvider()
getProtocolProvider
in interface CallPeer
getProtocolProvider
in class AbstractCallPeer<T extends MediaAwareCall<?,?,V>,V extends ProtocolProviderService>
public final boolean isJitsiVideobridge()
public boolean isLocalVideoStreaming()
public boolean isMute()
isMute
in interface CallPeer
isMute
in class AbstractCallPeer<T extends MediaAwareCall<?,?,V>,V extends ProtocolProviderService>
public void logAndFail(java.lang.String message, java.lang.Throwable throwable)
message
- a message to log and display to the user.throwable
- the exception that cause the error we are loggingpublic void reevalLocalHoldStatus()
public void reevalRemoteHoldStatus()
public void removeConferenceMembersSoundLevelListener(ConferenceMembersSoundLevelListener listener)
removeConferenceMembersSoundLevelListener
in interface CallPeer
listener
- the ConferenceMembersSoundLevelListener to
removepublic void removeStreamSoundLevelListener(SoundLevelListener listener)
removeStreamSoundLevelListener
in interface CallPeer
listener
- the SoundLevelListener to removepublic void removeVideoPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- the PropertyChangeListener to no longer be
notified when the properties associated with the specified Call
change their valuespublic void securityMessageReceived(java.lang.String messageType, java.lang.String i18nMessage, int severity)
securityMessageReceived
in interface org.jitsi.service.neomedia.event.SrtpListener
messageType
- the type of the message.i18nMessage
- the messageseverity
- severity levelpublic void securityNegotiationStarted(org.jitsi.service.neomedia.MediaType mediaType, org.jitsi.service.neomedia.SrtpControl sender)
securityNegotiationStarted
in interface org.jitsi.service.neomedia.event.SrtpListener
mediaType
- the MediaType of the call sessionsender
- the security controller that caused the eventpublic void securityTimeout(org.jitsi.service.neomedia.MediaType mediaType)
securityTimeout
in interface org.jitsi.service.neomedia.event.SrtpListener
mediaType
- the MediaType of the call sessionpublic void securityTurnedOff(org.jitsi.service.neomedia.MediaType mediaType)
securityTurnedOff
in interface org.jitsi.service.neomedia.event.SrtpListener
mediaType
- the MediaType of the call sessionpublic void securityTurnedOn(org.jitsi.service.neomedia.MediaType mediaType, java.lang.String cipher, org.jitsi.service.neomedia.SrtpControl sender)
securityTurnedOn
in interface org.jitsi.service.neomedia.event.SrtpListener
mediaType
- the MediaType of the call sessioncipher
- the ciphersender
- the security controller that caused the eventpublic void setCall(T call)
call
- the call that this call peer is participating in.public void setImage(byte[] image)
image
- a byte array containing the imagepublic void setLocalVideoAllowed(boolean allowed) throws OperationFailedException
allowed
- true if local video transmission is allowed and
false otherwise.OperationFailedException
- if video initialization fails.protected void setMediaHandler(U mediaHandler)
mediaHandler
- a reference to the CallPeerMediaHandler
instance that this peer uses for media related tips and tricks.public void setMute(boolean newMuteValue)
setMute
in class AbstractCallPeer<T extends MediaAwareCall<?,?,V>,V extends ProtocolProviderService>
newMuteValue
- the new value of the mute property for this call peerpublic void setPeerID(java.lang.String peerID)
peerID
- the ID of this call peer.public void setState(CallPeerState newState, java.lang.String reason, int reasonCode)
setState
in class AbstractCallPeer<T extends MediaAwareCall<?,?,V>,V extends ProtocolProviderService>
newState
- the CallPeerState that we are about to enter and
that we pass to our predecessor.reason
- a reason phrase explaining the state (e.g. if newState
indicates a failure) and that we pass to our predecessor.reasonCode
- the code for the reason of the state change.public ConferenceInfoDocument getLastConferenceInfoSent()
public void setLastConferenceInfoSent(ConferenceInfoDocument confInfo)
confInfo
- the document to set.public long getLastConferenceInfoSentTimestamp()
public void setLastConferenceInfoSentTimestamp(long newTimestamp)
newTimestamp
- the time to setpublic ConferenceInfoDocument getLastConferenceInfoReceived()
public void setLastConferenceInfoReceived(ConferenceInfoDocument confInfo)
public int getLastConferenceInfoReceivedVersion()
public abstract java.lang.String getEntity()
public boolean isConfInfoScheduled()
public void setConfInfoScheduled(boolean confInfoScheduled)
confInfoScheduled
- public abstract org.jitsi.service.neomedia.MediaDirection getDirection(org.jitsi.service.neomedia.MediaType mediaType)
mediaType
- the MediaType to usepublic void removeConferenceMember(ConferenceMember conferenceMember)
AbstractCallPeer.getConferenceMembers()
and AbstractCallPeer.getConferenceMemberCount()
if it is contained and fires
CallPeerConferenceEvent#CONFERENCE_MEMBER_REMOVED to
the currently registered CallPeerConferenceListeners.
When a ConferenceMember is removed from a conference with a
Jitsi-videobridge, an RTCP BYE packet is not always sent. Therefore,
if the ConferenceMember had an associated video SSRC, the stream
isn't be removed until it times out, leaving a blank video container in
the interface for a few seconds.
TODO: This works around the problem by removing the
ConferenceMember's ReceiveStream when the
ConferenceMember is removed. The proper solution is to ensure
that RTCP BYEs are sent whenever necessary, and when it is deployed this
code should be removed.removeConferenceMember
in class AbstractCallPeer<T extends MediaAwareCall<?,?,V>,V extends ProtocolProviderService>
conferenceMember
- a ConferenceMember to be removed from
the list of ConferenceMember reported by this peer. If the
specified ConferenceMember is no contained in the list, no event
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.