|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.util.event.PropertyChangeNotifier
net.java.sip.communicator.service.protocol.media.CallPeerMediaHandler<T>
T - the peer extension class like for example CallPeerSipImpl
or CallPeerJabberImplpublic abstract class CallPeerMediaHandler<T extends MediaAwareCallPeer<?,?,?>>
A utility class implementing media control code shared between current telephony implementations. This class is only meant for use by protocol implementations and should not be accessed by bundles that are simply using the telephony functionalities.
| Field Summary | |
|---|---|
static String |
AUDIO_LOCAL_SSRC
The name of the CallPeerMediaHandler property which specifies the local SSRC of its audio MediaStream. |
static String |
AUDIO_REMOTE_SSRC
The name of the CallPeerMediaHandler property which specifies the remote SSRC of its audio MediaStream. |
static long |
SSRC_UNKNOWN
The constant which signals that a SSRC value is unknown. |
static String |
VIDEO_LOCAL_SSRC
The name of the CallPeerMediaHandler property which specifies the local SSRC of its video MediaStream. |
static String |
VIDEO_REMOTE_SSRC
The name of the CallPeerMediaHandler property which specifies the remote SSRC of its video MediaStream. |
| Constructor Summary | |
|---|---|
CallPeerMediaHandler(T peer,
SrtpListener srtpListener)
Creates a new handler that will be managing media streams for peer. |
|
| Method Summary | |
|---|---|
void |
addAdvertisedEncryptionMethod(SrtpControlType encryptionMethod)
Adds encryption method to the list of advertised secure methods. |
void |
addVideoListener(VideoListener listener)
Registers a specific VideoListener with this instance so that it starts receiving notifications from it about changes in the availability of visual Components displaying video. |
void |
close()
Closes and null-ifies all streams and connectors and readies this media handler for garbage collection (or reuse). |
protected void |
closeStream(MediaType mediaType)
Closes the MediaStream that this instance uses for a specific MediaType and prepares it for garbage collection. |
Component |
createLocalVisualComponent()
Gets local visual Component of the local peer. |
void |
disposeLocalVisualComponent(Component component)
Disposes of a specific local visual Component of the local peer. |
protected MediaFormat |
findMediaFormat(List<MediaFormat> formats,
MediaFormat format)
Finds a MediaFormat in a specific list of MediaFormats which matches a specific MediaFormat. |
protected boolean |
fireVideoEvent(int type,
Component visualComponent,
int origin)
Notifies the VideoListeners registered with this CallPeerMediaHandler about a specific type of change in the availability of a specific visual Component depicting video. |
void |
fireVideoEvent(VideoEvent event)
Notifies the VideoListeners registered with this CallPeerMediaHandler about a specific VideoEvent. |
SrtpControlType[] |
getAdvertisedEncryptionMethods()
Returns the advertised methods for securing the call, this are the methods like SDES, ZRTP that are indicated in the initial session initialization. |
long |
getAudioRemoteSSRC()
Gets the last-known remote SSRC of the audio MediaStream of this instance. |
protected MediaDevice |
getDefaultDevice(MediaType mediaType)
Gets a MediaDevice which is capable of capture and/or playback of media of the specified MediaType, is the default choice of the user for a MediaDevice with the specified MediaType and is appropriate for the current states of the associated CallPeer and Call. |
protected MediaDirection |
getDirectionUserPreference(MediaType mediaType)
Gets the MediaDirection value which represents the preference of the user with respect to streaming media of the specified MediaType. |
protected DynamicPayloadTypeRegistry |
getDynamicPayloadTypes()
Returns the DynamicPayloadTypeRegistry instance we are currently
using. |
SrtpControlType |
getEncryptionMethod(MediaType mediaType)
Gets the SRTP control type used for a given media type. |
protected List<RTPExtension> |
getExtensionsForType(MediaType type)
Returns a (possibly empty) List of RTPExtensions supported by the device that this media handler uses to handle media of the specified type. |
String |
getICECandidateExtendedType()
Returns the extended type of the candidate selected if this transport manager is using ICE. |
String |
getICEState()
Returns the current state of ICE processing. |
MediaHandler |
getMediaHandler()
|
T |
getPeer()
Returns the peer that is this media handler's "raison d'etre". |
protected DynamicRTPExtensionsRegistry |
getRtpExtensionsRegistry()
Returns the DynamicRTPExtensionsRegistry instance we are
currently using. |
protected Map<MediaTypeSrtpControl,SrtpControl> |
getSrtpControls()
Gets the SrtpControls of the MediaStreams of this instance. |
MediaStream |
getStream(MediaType mediaType)
Gets the MediaStream of this CallPeerMediaHandler which is of a specific MediaType. |
protected abstract TransportManager<T> |
getTransportManager()
Gets the TransportManager implementation handling our address management. |
Component |
getVisualComponent()
Deprecated. |
List<Component> |
getVisualComponents()
Gets the visual Components in which videos from the remote peer are currently being rendered. |
protected MediaStream |
initStream(StreamConnector connector,
MediaDevice device,
MediaFormat format,
MediaStreamTarget target,
MediaDirection direction,
List<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. |
protected List<MediaFormat> |
intersectFormats(List<MediaFormat> remoteFormats,
List<MediaFormat> localFormats)
Compares a list of MediaFormats offered by a remote party to the list of locally supported RTPExtensions as returned by one of our local MediaDevices and returns a third List that contains their intersection. |
protected List<RTPExtension> |
intersectRTPExtensions(List<RTPExtension> remoteExtensions,
List<RTPExtension> supportedExtensions)
Compares a list of RTPExtensions offered by a remote party to the list of locally supported RTPExtensions as returned by one of our local MediaDevices and returns a third List that contains their intersection. |
boolean |
isLocalAudioTransmissionEnabled()
Determines whether this media handler is currently set to transmit local audio. |
boolean |
isLocallyOnHold()
Determines whether this handler's streams have been placed on hold. |
boolean |
isLocalVideoTransmissionEnabled()
Determines whether this media handler is currently set to transmit local video. |
boolean |
isMute()
Determines whether the audio stream of this media handler is currently on mute. |
boolean |
isRemotelyOnHold()
Determines whether the remote party has placed all our streams on hold. |
boolean |
isSecure()
Returns the secure state of the call. |
boolean |
processKeyFrameRequest()
Processes a request for a (video) key frame from the remote peer to the local peer. |
(package private) void |
registerAudioLevelListeners(AudioMediaStream audioStream)
Registers all audio level listeners currently known to this media handler with the specified audioStream. |
void |
removeVideoListener(VideoListener listener)
Unregisters a specific VideoListener from this instance so that it stops receiving notifications from it about changes in the availability of visual Components displaying video. |
protected boolean |
requestKeyFrame()
Requests a key frame from the remote peer of the associated VideoMediaStream of this CallPeerMediaHandler. |
protected void |
sendHolePunchPacket(MediaStreamTarget target)
Sends empty UDP packets to target destination data/control ports in order to open port on NAT or RTP proxy if any. |
void |
setCsrcAudioLevelListener(CsrcAudioLevelListener csrcAudioLevelListener)
Sets csrcAudioLevelListener as the listener that will be receiving notifications for changes in the audio levels of the remote participants that our peer is mixing. |
void |
setLocalAudioTransmissionEnabled(boolean enabled)
Specifies whether this media handler should be allowed to transmit local audio. |
void |
setLocallyOnHold(boolean locallyOnHold)
Puts all MediaStreams in this handler locally on or off hold (according to the value of locallyOnHold). |
void |
setLocalUserAudioLevelListener(SimpleAudioLevelListener listener)
If the local AudioMediaStream has already been created, sets listener as the SimpleAudioLevelListener that it should notify for local user level events. |
void |
setLocalVideoTransmissionEnabled(boolean enabled)
Specifies whether this media handler should be allowed to transmit local video. |
void |
setMediaHandler(MediaHandler mediaHandler)
|
void |
setMute(boolean mute)
Causes this handler's AudioMediaStream to stop transmitting the audio being fed from this stream's MediaDevice and transmit silence instead. |
void |
setStreamAudioLevelListener(SimpleAudioLevelListener listener)
If the local AudioMediaStream has already been created, sets listener as the SimpleAudioLevelListener that it should notify for stream user level events. |
void |
start()
Starts this CallPeerMediaHandler. |
void |
startSrtpMultistream(SrtpControl master)
Passes multiStreamData to the video stream that we are using in this media handler (if any) so that the underlying SRTP lib could properly handle stream security. |
protected abstract void |
throwOperationFailedException(String message,
int errorCode,
Throwable cause)
Lets the underlying implementation take note of this error and only then throws it to the using bundles. |
| Methods inherited from class net.java.sip.communicator.util.event.PropertyChangeNotifier |
|---|
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String AUDIO_LOCAL_SSRC
public static final String AUDIO_REMOTE_SSRC
public static final long SSRC_UNKNOWN
public static final String VIDEO_LOCAL_SSRC
public static final String VIDEO_REMOTE_SSRC
| Constructor Detail |
|---|
public CallPeerMediaHandler(T peer,
SrtpListener srtpListener)
peer - that CallPeer instance that we will be managing
media for.srtpListener - the object that receives SRTP security events.| Method Detail |
|---|
public void setLocallyOnHold(boolean locallyOnHold)
locallyOnHold - true if we are to make our audio stream
stop transmitting and false if we are to start transmitting
again.public void close()
protected void closeStream(MediaType mediaType)
mediaType - the MediaType that we'd like to stop a stream
for.public boolean isLocallyOnHold()
public void setMute(boolean mute)
mute - true if we are to make our audio stream start
transmitting silence and false if we are to end the transmission
of silence and use our stream's MediaDevice again.public boolean isMute()
protected MediaDirection getDirectionUserPreference(MediaType mediaType)
mediaType - the MediaType to retrieve the user preference
for
public void setLocalVideoTransmissionEnabled(boolean enabled)
enabled - true if the media handler should transmit local
video and false otherwise.public boolean isLocalVideoTransmissionEnabled()
public void setLocalAudioTransmissionEnabled(boolean enabled)
enabled - true if the media handler should transmit local
audio and false otherwise.public boolean isLocalAudioTransmissionEnabled()
public boolean isSecure()
public SrtpControlType[] getAdvertisedEncryptionMethods()
public void addAdvertisedEncryptionMethod(SrtpControlType encryptionMethod)
encryptionMethod - the method to add.public void startSrtpMultistream(SrtpControl master)
master - the data that we are supposed to pass to our
video stream.public long getAudioRemoteSSRC()
protected MediaDevice getDefaultDevice(MediaType mediaType)
For example, when the local peer is acting as a conference focus in the Call of the associated CallPeer, the audio device must be a mixer.
mediaType - the MediaType in which the retrieved
MediaDevice is to capture and/or play back media
public void addVideoListener(VideoListener listener)
listener - the VideoListener to be registered with this
instance and to start receiving notifications from it about changes in
the availability of visual Components displaying video
protected boolean fireVideoEvent(int type,
Component visualComponent,
int origin)
type - the type of change as defined by VideoEvent in the
availability of the specified visual Component depicting videovisualComponent - the visual Component depicting video
which has been added or removed in this CallPeerMediaHandlerorigin - VideoEvent.LOCAL if the origin of the video is
local (e.g. it is being locally captured); VideoEvent.REMOTE if
the origin of the video is remote (e.g. a remote peer is streaming it)
public void fireVideoEvent(VideoEvent event)
event - the VideoEvent to fire to the
VideoListeners registered with this
CallPeerMediaHandlerpublic Component createLocalVisualComponent()
public void disposeLocalVisualComponent(Component component)
component - the local visual Component of the local peer to
dispose of@Deprecated public Component getVisualComponent()
public List<Component> getVisualComponents()
public void removeVideoListener(VideoListener listener)
listener - the VideoListener to be unregistered from this
instance and to stop receiving notifications from it about changes in the
availability of visual Components displaying videopublic void setLocalUserAudioLevelListener(SimpleAudioLevelListener listener)
listener - the SimpleAudioLevelListener to add or
null if we are trying to remove it.public void setStreamAudioLevelListener(SimpleAudioLevelListener listener)
listener - the SimpleAudioLevelListener to add or
null if we are trying to remove it.public void setCsrcAudioLevelListener(CsrcAudioLevelListener csrcAudioLevelListener)
csrcAudioLevelListener - the CsrcAudioLevelListener to set
to our audio streams.protected Map<MediaTypeSrtpControl,SrtpControl> getSrtpControls()
protected MediaStream initStream(StreamConnector connector,
MediaDevice device,
MediaFormat format,
MediaStreamTarget target,
MediaDirection direction,
List<RTPExtension> rtpExtensions,
boolean masterStream)
throws OperationFailedException
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 secured
OperationFailedException - if creating the stream fails for any
reason (like, for example, accessing the device or setting the format).protected boolean requestKeyFrame()
protected void sendHolePunchPacket(MediaStreamTarget target)
target - MediaStreamTargetpublic boolean processKeyFrameRequest()
void registerAudioLevelListeners(AudioMediaStream audioStream)
audioStream - the AudioMediaStream that we'd like to
register our audio level listeners with.public MediaStream getStream(MediaType mediaType)
mediaType - the MediaType of the MediaStream to
retrieve
public boolean isRemotelyOnHold()
protected List<MediaFormat> intersectFormats(List<MediaFormat> remoteFormats,
List<MediaFormat> localFormats)
remoteFormats - remote MediaFormat found in the
SDP messagelocalFormats - local supported MediaFormat of our device
protected MediaFormat findMediaFormat(List<MediaFormat> formats,
MediaFormat format)
formats - the list of MediaFormats to find the specified
matching MediaFormat intoformat - encoding of the MediaFormat to find
protected List<RTPExtension> intersectRTPExtensions(List<RTPExtension> remoteExtensions,
List<RTPExtension> supportedExtensions)
remoteExtensions - the List of RTPExtensions as
advertised by the remote party.supportedExtensions - the List of RTPExtensions
that a local MediaDevice returned as supported.
protected List<RTPExtension> getExtensionsForType(MediaType type)
type - the MediaType of the device whose
RTPExtensions we are interested in.
protected DynamicPayloadTypeRegistry getDynamicPayloadTypes()
DynamicPayloadTypeRegistry instance we are currently
using.
DynamicPayloadTypeRegistry instance we are currently
using.protected DynamicRTPExtensionsRegistry getRtpExtensionsRegistry()
DynamicRTPExtensionsRegistry instance we are
currently using.
DynamicRTPExtensionsRegistry instance we are
currently using.
public void start()
throws IllegalStateException
IllegalStateException - if this method is called without this
handler having first seen a media description or having generated an
offer.public T getPeer()
MediaAwareCallPeer that this handler is servicing.
protected abstract void throwOperationFailedException(String message,
int errorCode,
Throwable cause)
throws OperationFailedException
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 thrown
OperationFailedException - the exception that we wanted this method
to throw.protected abstract TransportManager<T> getTransportManager()
public SrtpControlType getEncryptionMethod(MediaType mediaType)
mediaType - the MediaType to get the SRTP control type for
public String getICECandidateExtendedType()
public String getICEState()
public MediaHandler getMediaHandler()
public void setMediaHandler(MediaHandler mediaHandler)
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||