Adds ice states to call info.

Fixes a problem with creating two transport managers for jabber calls and slow creating of upnpharvester.
cusax-fix
Damian Minkov 14 years ago
parent 2e0e368ed8
commit 4cb5d7107c

Binary file not shown.

@ -39,7 +39,7 @@ service.gui.ADD_CONTACT_TO=&Add contact to
service.gui.ADD_CONTACT_ERROR=Failed to add contact with id: {0}
service.gui.ADD_CONTACT_ERROR_TITLE=Add contact Error
service.gui.ADD_CONTACT_EXIST_ERROR=The contact {0} already exists in your contact list.
service.gui.ADD_CONTACT_NETWORK_ERROR=Failed to add contact with id: {0}. Network failure occurred.
service.gui.ADD_CONTACT_NETWORK_ERROR=Server did not respond to our request adding contact with id: {0}.
service.gui.ADD_CONTACT_NOT_SUPPORTED=Failed to add contact with id: {0}. Operation not supported.
service.gui.ADD_CONTACT_IDENTIFIER=In the field below enter the identifier of the contact you would like to add.
service.gui.ADD_CONTACT_WIZARD=Add contact wizard
@ -549,6 +549,11 @@ service.gui.callinfo.MEDIA_STREAM_RTP=RTP
service.gui.callinfo.MEDIA_STREAM_SRTP=SRTP
service.gui.callinfo.KEY_EXCHANGE_PROTOCOL=Key exchange protocol
service.gui.callinfo.ICE_CANDIDATE_EXTENDED_TYPE=ICE candidate extended type
service.gui.callinfo.ICE_STATE=ICE Processing State:
service.gui.callinfo.ICE_STATE.Waiting=Gather candidates
service.gui.callinfo.ICE_STATE.Running=Connectivity checks
service.gui.callinfo.ICE_STATE.Completed=Completed
service.gui.callinfo.ICE_STATE.Failed=Failed
service.gui.ALWAYS_TRUST=Always trust this certificate
service.gui.CERT_DIALOG_TITLE=Verify Certificate

@ -665,7 +665,7 @@ private void writeCall( CallRecordImpl callRecord,
.getStartTime().getTime()));
callPeerEndTime.append(String.valueOf(item.getEndTime()
.getTime()));
callPeerStates.append(item.getState().getLocalizedStateString());
callPeerStates.append(item.getState().getStateString());
}
historyWriter.addRecord(new String[] {

@ -7,6 +7,7 @@
package net.java.sip.communicator.impl.gui.main.call;
import java.awt.*;
import java.beans.*;
import java.util.*;
import javax.swing.*;
@ -20,6 +21,7 @@
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.ice4j.ice.*;
/**
* The frame displaying the statistical information for a call.
@ -28,7 +30,8 @@
* @author Yana Stamcheva
*/
public class CallInfoFrame
implements CallTitleListener
implements CallTitleListener,
PropertyChangeListener
{
/**
* The Call from which are computed the statisics displayed.
@ -215,8 +218,12 @@ private void constructCallPeersInfo(StringBuffer stringBuffer)
while(callPeers.hasNext())
{
CallPeer callPeer = (CallPeer) callPeers.next();
CallPeer callPeer = callPeers.next();
if(callPeer instanceof MediaAwareCallPeer)
{
((MediaAwareCallPeer)callPeer).getMediaHandler()
.addPropertyChangeListener(this);
}
stringBuffer.append("<br/>");
constructPeerInfo(callPeer, stringBuffer);
}
@ -259,6 +266,16 @@ private void constructPeerInfo(CallPeer callPeer, StringBuffer stringBuffer)
iceCandidateExtendedType));
}
String iceState = callPeerMediaHandler.getICEState();
if(iceState != null && !iceState.equals("Terminated"))
{
stringBuffer.append(getLineString(
resources.getI18NString(
"service.gui.callinfo.ICE_STATE"),
resources.getI18NString(
"service.gui.callinfo.ICE_STATE." + iceState)));
}
MediaStream mediaStream =
callPeerMediaHandler.getStream(MediaType.AUDIO);
@ -472,4 +489,16 @@ private void appendStreamEncryptionMethod(
transportProtocolString + " / " + rtpType));
}
/**
* Listen for ice property change to trigger call info update.
* @param evt the event for state change.
*/
public void propertyChange(PropertyChangeEvent evt)
{
if(evt.getPropertyName().equals(Agent.PROPERTY_ICE_PROCESSING_STATE))
{
callTitleChanged(null);
}
}
}

@ -782,4 +782,21 @@ protected DynamicPayloadTypeRegistry getDynamicPayloadTypes()
return registry;
}
/**
* Overrides to give access to the transport manager to send events
* about ICE state changes.
* @param property the name of the property of this
* <tt>PropertyChangeNotifier</tt> which had its value changed
* @param oldValue the value of the property with the specified name before
* the change
* @param newValue the value of the property with the specified name after
*/
protected void firePropertyChange(
String property,
Object oldValue,
Object newValue)
{
super.firePropertyChange(property, oldValue, newValue);
}
}

@ -634,7 +634,7 @@ private ContentPacketExtension createContent(MediaDevice dev)
{
MediaDirection direction
= dev.getDirection().and(
getDirectionUserPreference(dev.getMediaType()));
getDirectionUserPreference(dev.getMediaType()));
if(isLocallyOnHold())
direction = direction.and(MediaDirection.SENDONLY);
@ -1293,7 +1293,7 @@ public void processAnswer(List<ContentPacketExtension> answer)
* management
* @see CallPeerMediaHandler#getTransportManager()
*/
protected TransportManagerJabberImpl getTransportManager()
protected synchronized TransportManagerJabberImpl getTransportManager()
{
if (transportManager == null)
{
@ -1794,4 +1794,21 @@ public synchronized void close()
if (client != null)
client.fireRemoteControlRevoked(getPeer());
}
/**
* Overrides to give access to the transport manager to send events
* about ICE state changes.
* @param property the name of the property of this
* <tt>PropertyChangeNotifier</tt> which had its value changed
* @param oldValue the value of the property with the specified name before
* the change
* @param newValue the value of the property with the specified name after
*/
protected void firePropertyChange(
String property,
Object oldValue,
Object newValue)
{
super.firePropertyChange(property, oldValue, newValue);
}
}

@ -36,6 +36,7 @@
*/
public class IceUdpTransportManager
extends TransportManagerJabberImpl
implements PropertyChangeListener
{
/**
* The <tt>Logger</tt> used by the <tt>IceUdpTransportManager</tt>
@ -84,6 +85,7 @@ public IceUdpTransportManager(CallPeerJabberImpl callPeer)
{
super(callPeer);
iceAgent = createIceAgent();
iceAgent.addStateChangeListener(this);
}
/**
@ -1174,6 +1176,7 @@ public synchronized void close()
{
if(iceAgent != null)
{
iceAgent.removeStateChangeListener(this);
iceAgent.free();
}
}
@ -1190,4 +1193,24 @@ public String getICECandidateExtendedType()
return TransportManager.getICECandidateExtendedType(
this.iceAgent);
}
/**
* Returns the current state of ICE processing.
*
* @return the current state of ICE processing.
*/
public String getICEState()
{
return iceAgent.getState().toString();
}
/**
* Retransmit state change events from the Agent to the media handler.
* @param evt the event for state change.
*/
public void propertyChange(PropertyChangeEvent evt)
{
getCallPeer().getMediaHandler().firePropertyChange(
evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
}
}

@ -660,4 +660,14 @@ public String getICECandidateExtendedType()
{
return null;
}
/**
* Returns the current state of ICE processing.
*
* @return the current state of ICE processing.
*/
public String getICEState()
{
return null;
}
}

@ -45,6 +45,7 @@
*/
public class TransportManagerGTalkImpl
extends TransportManager<CallPeerGTalkImpl>
implements PropertyChangeListener
{
/**
* The <tt>Logger</tt> used by the <tt>IceUdpTransportManager</tt>
@ -105,6 +106,7 @@ public TransportManagerGTalkImpl(CallPeerGTalkImpl callPeer)
{
super(callPeer);
iceAgent = createIceAgent();
iceAgent.addStateChangeListener(this);
}
/**
@ -1305,6 +1307,7 @@ public void close()
if(iceAgent != null)
{
logger.info("Close transport manager agent");
iceAgent.removeStateChangeListener(this);
iceAgent.free();
}
}
@ -1321,4 +1324,24 @@ public String getICECandidateExtendedType()
return TransportManager.getICECandidateExtendedType(
this.iceAgent);
}
/**
* Retransmit state change events from the Agent.
* @param evt the event for state change.
*/
public void propertyChange(PropertyChangeEvent evt)
{
getCallPeer().getMediaHandler().firePropertyChange(
evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
}
/**
* Returns the current state of ICE processing.
*
* @return the current state of ICE processing.
*/
public String getICEState()
{
return iceAgent.getState().name();
}
}

@ -60,4 +60,14 @@ public String getICECandidateExtendedType()
{
return null;
}
/**
* Returns the current state of ICE processing.
*
* @return the current state of ICE processing.
*/
public String getICEState()
{
return null;
}
}

@ -1413,6 +1413,22 @@ public String getICECandidateExtendedType()
: transportManager.getICECandidateExtendedType();
}
/**
* Returns the current state of ICE processing.
*
* @return the current state of ICE processing if this transport
* manager is using ICE. Otherwise, returns null.
*/
public String getICEState()
{
TransportManager<?> transportManager = getTransportManager();
return
(transportManager == null)
? null
: transportManager.getICEState();
}
public MediaHandler getMediaHandler()
{
return mediaHandler;

@ -565,6 +565,14 @@ protected static void setNextMediaPortToTry(int nextMediaPortToTry)
*/
public abstract String getICECandidateExtendedType();
/**
* Returns the current state of ICE processing.
*
* @return the current state of ICE processing if this transport
* manager is using ICE. Otherwise, returns null.
*/
public abstract String getICEState();
/**
* Returns the ICE candidate extended type selected by the given agent.
*

Loading…
Cancel
Save