From 891392e18a2a4f68d676144a8a6af53f29fec187 Mon Sep 17 00:00:00 2001 From: chenzo Date: Fri, 6 Jul 2012 11:55:21 +0000 Subject: [PATCH] Puts the Agent into WAITING state when creating a new media stream. This way all incoming connectivity checks are added to the preDiscoveredPairsQueue until this Agent turn back intro RUNNING state. --- src/org/ice4j/ice/Agent.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/org/ice4j/ice/Agent.java b/src/org/ice4j/ice/Agent.java index 5e96475..a2076d2 100644 --- a/src/org/ice4j/ice/Agent.java +++ b/src/org/ice4j/ice/Agent.java @@ -283,6 +283,15 @@ public class Agent = new IceMediaStream(Agent.this, mediaStreamName); mediaStreams.put(mediaStreamName, mediaStream); + + // Since we add a new stream, we must wait to add the component and the + // remote candidates before starting to "RUN" this Agent. + // This is usefull if this Agent is already in COMPLETED state + // (isStarted() == true) due to a previous successful ICE preocedure: + // this way incoming connectivity checks are registered in the + // preDiscoveredPairsQueue until this Agent is in RUNNING state. + this.setState(IceProcessingState.WAITING); + return mediaStream; }