Adds a CALL_PARTICIPANTS_CHANGE type for CallChangeEvent-s and fires events

with this type when content-modify or content-remove is received.
cusax-fix
Boris Grozev 13 years ago
parent 9e7653ceec
commit 1f39583d80

@ -1213,6 +1213,9 @@ public void callStateChanged(CallChangeEvent evt)
// no such call
if (callRecord == null)
return;
if (!CallChangeEvent.CALL_STATE_CHANGE
.equals(evt.getPropertyName()))
return;
if (evt.getNewValue().equals(CallState.CALL_ENDED))
{

@ -136,6 +136,9 @@ public void run()
});
return;
}
if (!CallChangeEvent.CALL_STATE_CHANGE
.equals(ev.getPropertyName()))
return;
// When the call state changes, we ensure here that the
// received call notification dialog is closed.

@ -620,8 +620,13 @@ public void modifyVideoContent()
if (logger.isDebugEnabled())
logger.debug("Updating video content for " + this);
boolean change = false;
for (CallPeerJabberImpl peer : getCallPeerList())
peer.sendModifyVideoContent();
change |= peer.sendModifyVideoContent();
if (change)
fireCallChangeEvent(
CallChangeEvent.CALL_PARTICIPANTS_CHANGE, null, null);
}
/**

@ -1131,8 +1131,10 @@ private MediaDirection getDirectionForJingle(MediaType mediaType)
* <tt>CallPeer</tt>, or content-remove if we stop video and video is
* enabled for the <tt>CallPeer</tt>.
*
* @return <tt>true</tt> if a modification was done (a Jingle message was
* sent).
*/
public void sendModifyVideoContent()
public boolean sendModifyVideoContent()
{
CallPeerMediaHandlerJabberImpl mediaHandler = getMediaHandler();
MediaDirection direction = getDirectionForJingle(MediaType.VIDEO);
@ -1145,7 +1147,7 @@ public void sendModifyVideoContent()
if (direction == MediaDirection.INACTIVE)
{
// no video content, none needed
return;
return false;
}
else
{
@ -1154,8 +1156,9 @@ public void sendModifyVideoContent()
if (logger.isInfoEnabled())
logger.info("Adding video content for " + this);
sendAddVideoContent();
return true;
}
return;
return false;
}
}
else
@ -1165,7 +1168,7 @@ public void sendModifyVideoContent()
// We could send a content-remove in this case, but instead
// we just set senders=none
//sendRemoveVideoContent();
//return;
//return true;
}
}
@ -1219,6 +1222,8 @@ else if (MediaDirection.SENDONLY == direction)
{
logger.warn("Exception occurred during media reinitialization", e);
}
return true;
}
/**

@ -326,8 +326,7 @@ protected void fireCallChangeEvent( String type,
new CallChangeListener[callListeners.size()]);
}
for (CallChangeListener listener : listeners)
if(type.equals(CallChangeEvent.CALL_STATE_CHANGE))
listener.callStateChanged(event);
listener.callStateChanged(event);
}
/**

@ -467,7 +467,9 @@ private void callStateChanged(CallChangeEvent ev)
}
finally
{
if (CallState.CALL_ENDED.equals(ev.getNewValue()))
if (CallChangeEvent.CALL_STATE_CHANGE
.equals(ev.getPropertyName())
&& CallState.CALL_ENDED.equals(ev.getNewValue()))
{
/*
* Should not be vital because Call will remove itself.

@ -27,6 +27,15 @@ public class CallChangeEvent
*/
public static final String CALL_STATE_CHANGE = "CallState";
/**
* The type of <tt>CallChangeEvent</tt> which indicates that there was some
* kind of change in the participants in the associated <tt>Call</tt> (e.g.
* a <tt>CallPeer</tt> participating in the <tt>Call</tt> has enabled
* or disabled video)
*/
public static final String CALL_PARTICIPANTS_CHANGE
= "CallParticipantsChanged";
/**
* Serial version UID.
*/

@ -308,6 +308,11 @@ private void callPeersChanged(CallPeerEvent event)
*/
public void callStateChanged(CallChangeEvent event)
{
if (CallChangeEvent.CALL_PARTICIPANTS_CHANGE
.equals(event.getPropertyName()))
{
notifyAll(event.getSourceCall());
}
}
/**

@ -664,6 +664,10 @@ public void propertyChange(PropertyChangeEvent evt)
*/
public void callStateChanged(CallChangeEvent evt)
{
if (!CallChangeEvent.CALL_STATE_CHANGE
.equals(evt.getPropertyName()))
return;
if (CallState.CALL_ENDED.equals(evt.getNewValue()))
recorder.stop();
}

Loading…
Cancel
Save