diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-10-07 15:24:48 +0300 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-10-10 08:22:07 +0300 |
commit | 9eec6e2305c98494c4b508c299a51f9b69917f61 (patch) | |
tree | 65352cbfc28ce6454c0552be53365925db6432ce /src/net/java/sip/communicator/service/protocol/media | |
parent | 7c8960801da77aaf374af8172199c341bea5f07a (diff) | |
download | jitsi-9eec6e2305c98494c4b508c299a51f9b69917f61.zip jitsi-9eec6e2305c98494c4b508c299a51f9b69917f61.tar.gz jitsi-9eec6e2305c98494c4b508c299a51f9b69917f61.tar.bz2 |
Romoves the use of enum-like constants from SrtpListeners because it is a part of neomedia and may use MediaType instead.
Diffstat (limited to 'src/net/java/sip/communicator/service/protocol/media')
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java | 77 | ||||
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/media/MediaHandler.java | 20 |
2 files changed, 67 insertions, 30 deletions
diff --git a/src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java b/src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java index d9e1733..59c885c 100644 --- a/src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java +++ b/src/net/java/sip/communicator/service/protocol/media/MediaAwareCallPeer.java @@ -15,6 +15,7 @@ import net.java.sip.communicator.util.*; import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.event.*; +import org.jitsi.service.protocol.event.*; /** * A utility class implementing media control code shared between current @@ -852,7 +853,9 @@ public abstract class MediaAwareCallPeer * @param severity severity level */ public void securityMessageReceived( - String messageType, String i18nMessage, int severity) + String messageType, + String i18nMessage, + int severity) { fireCallPeerSecurityMessageEvent(messageType, i18nMessage, @@ -863,60 +866,72 @@ public abstract class MediaAwareCallPeer * Indicates that the other party has timeouted replying to our * offer to secure the connection. * - * @param sessionType the type of the call session - audio or video. + * @param mediaType the <tt>MediaType</tt> of the call session * @param sender the security controller that caused the event */ - public void securityNegotiationStarted(int sessionType, SrtpControl sender) + public void securityNegotiationStarted( + MediaType mediaType, + SrtpControl sender) { - CallPeerSecurityNegotiationStartedEvent evt = - new CallPeerSecurityNegotiationStartedEvent(this, sessionType, sender); - fireCallPeerSecurityNegotiationStartedEvent(evt); + fireCallPeerSecurityNegotiationStartedEvent( + new CallPeerSecurityNegotiationStartedEvent( + this, + toSessionType(mediaType), + sender)); } /** * Indicates that the other party has timeouted replying to our * offer to secure the connection. * - * @param sessionType the type of the call session - audio or video. + * @param mediaType the <tt>MediaType</tt> of the call session */ - public void securityTimeout(int sessionType) + public void securityTimeout(MediaType mediaType) { - CallPeerSecurityTimeoutEvent evt = - new CallPeerSecurityTimeoutEvent(this, sessionType); - fireCallPeerSecurityTimeoutEvent(evt); + fireCallPeerSecurityTimeoutEvent( + new CallPeerSecurityTimeoutEvent( + this, + toSessionType(mediaType))); } /** * Sets the security status to OFF for this call peer. * - * @param sessionType the type of the call session - audio or video. + * @param mediaType the <tt>MediaType</tt> of the call session */ - public void securityTurnedOff(int sessionType) + public void securityTurnedOff(MediaType mediaType) { // If this event has been triggered because of a call end event and the // call is already ended we don't need to alert the user for // security off. if((call != null) && !call.getCallState().equals(CallState.CALL_ENDED)) { - CallPeerSecurityOffEvent event - = new CallPeerSecurityOffEvent( this, sessionType); - fireCallPeerSecurityOffEvent(event); + fireCallPeerSecurityOffEvent( + new CallPeerSecurityOffEvent( + this, + toSessionType(mediaType))); } } /** * Sets the security status to ON for this call peer. * - * @param sessionType the type of the call session - audio or video. + * @param mediaType the <tt>MediaType</tt> of the call session * @param cipher the cipher * @param sender the security controller that caused the event */ - public void securityTurnedOn(int sessionType, String cipher, - SrtpControl sender) + public void securityTurnedOn( + MediaType mediaType, + String cipher, + SrtpControl sender) { getMediaHandler().startSrtpMultistream(sender); fireCallPeerSecurityOnEvent( - new CallPeerSecurityOnEvent(this, sessionType, cipher, sender)); + new CallPeerSecurityOnEvent( + this, + toSessionType(mediaType), + cipher, + sender)); } /** @@ -1211,4 +1226,26 @@ public abstract class MediaAwareCallPeer super.removeConferenceMember(conferenceMember); } + + /** + * Converts a specific <tt>MediaType</tt> into a <tt>sessionType</tt> value + * in the terms of the <tt>CallPeerSecurityStatusEvent</tt> class. + * + * @param mediaType the <tt>MediaType</tt> to be converted + * @return the <tt>sessionType</tt> value in the terms of the + * <tt>CallPeerSecurityStatusEvent</tt> class that is equivalent to the + * specified <tt>mediaType</tt> + */ + private static int toSessionType(MediaType mediaType) + { + switch (mediaType) + { + case AUDIO: + return CallPeerSecurityStatusEvent.AUDIO_SESSION; + case VIDEO: + return CallPeerSecurityStatusEvent.VIDEO_SESSION; + default: + throw new IllegalArgumentException("mediaType"); + } + } } diff --git a/src/net/java/sip/communicator/service/protocol/media/MediaHandler.java b/src/net/java/sip/communicator/service/protocol/media/MediaHandler.java index 4b5db9e..e4de1df 100644 --- a/src/net/java/sip/communicator/service/protocol/media/MediaHandler.java +++ b/src/net/java/sip/communicator/service/protocol/media/MediaHandler.java @@ -154,30 +154,30 @@ public class MediaHandler } } - public void securityTimeout(int sessionType) + public void securityNegotiationStarted( + MediaType mediaType, SrtpControl sender) { for (SrtpListener listener : getSrtpListeners()) - listener.securityTimeout(sessionType); + listener.securityNegotiationStarted(mediaType, sender); } - public void securityTurnedOff(int sessionType) + public void securityTimeout(MediaType mediaType) { for (SrtpListener listener : getSrtpListeners()) - listener.securityTurnedOff(sessionType); + listener.securityTimeout(mediaType); } - public void securityTurnedOn( - int sessionType, String cipher, SrtpControl sender) + public void securityTurnedOff(MediaType mediaType) { for (SrtpListener listener : getSrtpListeners()) - listener.securityTurnedOn(sessionType, cipher, sender); + listener.securityTurnedOff(mediaType); } - public void securityNegotiationStarted(int sessionType, - SrtpControl sender) + public void securityTurnedOn( + MediaType mediaType, String cipher, SrtpControl sender) { for (SrtpListener listener : getSrtpListeners()) - listener.securityNegotiationStarted(sessionType, sender); + listener.securityTurnedOn(mediaType, cipher, sender); } }; |