Fixes issues with the REST public API of Jitsi Videobridge.

fix-message-formatting 5230
Lyubomir Marinov 12 years ago
parent 9446a74274
commit 97f27d1391

@ -1534,23 +1534,36 @@ public String getEntity()
public MediaDirection getDirection(MediaType mediaType)
{
SendersEnum senders = getSenders(mediaType);
if (senders == SendersEnum.none)
{
return MediaDirection.INACTIVE;
}
else if (senders == null || senders == SendersEnum.both)
{
return MediaDirection.SENDRECV;
}
else if (senders == SendersEnum.initiator)
return isInitiator()
? MediaDirection.RECVONLY
: MediaDirection.SENDONLY;
{
return
isInitiator()
? MediaDirection.RECVONLY
: MediaDirection.SENDONLY;
}
else //senders == SendersEnum.responder
return isInitiator()
? MediaDirection.SENDONLY
: MediaDirection.RECVONLY;
{
return
isInitiator()
? MediaDirection.SENDONLY
: MediaDirection.RECVONLY;
}
}
/**
* Get the current value of the <tt>senders</tt> field of the content with
* name <tt>mediaType</tt> in the Jingle session with this <tt>CallPeer</tt>
* Gets the current value of the <tt>senders</tt> field of the content with
* name <tt>mediaType</tt> in the Jingle session with this
* <tt>CallPeer</tt>.
*
* @param mediaType the <tt>MediaType</tt> for which to get the current
* value of the <tt>senders</tt> field.
* @return the current value of the <tt>senders</tt> field of the content
@ -1559,12 +1572,21 @@ else if (senders == SendersEnum.initiator)
*/
public SendersEnum getSenders(MediaType mediaType)
{
if (MediaType.AUDIO.equals(mediaType))
switch (mediaType)
{
case AUDIO:
return audioSenders;
else if (MediaType.VIDEO.equals(mediaType))
case DATA:
/*
* FIXME DATA has been introduced as a MediaType but explicit
* support for DATA content has not been added yet.
*/
return SendersEnum.none;
case VIDEO:
return videoSenders;
else
default:
throw new IllegalArgumentException("mediaType");
}
}
/**

@ -1544,8 +1544,7 @@ private void processContent(
{
for (CallPeerJabberImpl peer : call.getCallPeerList())
{
SendersEnum senders
= peer.getSenders(mediaType);
SendersEnum senders = peer.getSenders(mediaType);
boolean initiator = peer.isInitiator();
//check if the direction of the jingle session we have with
//this peer allows us receiving media. If senders is null,

@ -40,8 +40,8 @@ public abstract class AbstractPacketExtension
/**
* A map of all attributes that this extension is currently using.
*/
protected final Map<String, String> attributes
= new LinkedHashMap<String, String>();
protected final Map<String, Object> attributes
= new LinkedHashMap<String, Object>();
/**
* A list of all packets that are wrapped by this extension.
@ -121,7 +121,7 @@ public String toXML()
bldr.append("xmlns='").append(namespace).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ").append(entry.getKey()).append("='")
.append(entry.getValue()).append("'");
@ -235,7 +235,7 @@ public void setAttribute(String name, Object value)
synchronized(attributes)
{
if(value != null)
this.attributes.put(name, value.toString());
this.attributes.put(name, value);
else
this.attributes.remove(name);
}

@ -152,7 +152,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -155,7 +155,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -187,7 +187,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -162,7 +162,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -112,7 +112,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -212,7 +212,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -94,7 +94,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -144,7 +144,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -116,7 +116,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -84,7 +84,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -96,7 +96,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -84,7 +84,7 @@ public String toXML()
bldr.append("xmlns='").append(getNamespace()).append("'");
//add the rest of the attributes if any
for(Map.Entry<String, String> entry : attributes.entrySet())
for(Map.Entry<String, Object> entry : attributes.entrySet())
{
bldr.append(" ")
.append(entry.getKey())

@ -1038,10 +1038,12 @@ protected ConferenceInfoDocument getCurrentConferenceInfo(
for (CallPeer conferenceCallPeer : conferenceCallPeers)
{
if (conferenceCallPeer instanceof MediaAwareCallPeer<?,?,?>)
{
addPeerToConferenceInfo(
confInfo,
(MediaAwareCallPeer<?,?,?>)conferenceCallPeer,
true);
}
}
return confInfo;
@ -1063,27 +1065,22 @@ private void addPeerToConferenceInfo(
boolean remote)
{
String entity
= remote
? callPeer.getEntity()
: getLocalEntity(callPeer);
= remote ? callPeer.getEntity() : getLocalEntity(callPeer);
ConferenceInfoDocument.User user = confInfo.addNewUser(entity);
String displayName
= remote
? callPeer.getDisplayName()
: getLocalDisplayName();
= remote ? callPeer.getDisplayName() : getLocalDisplayName();
user.setDisplayText(displayName);
ConferenceInfoDocument.Endpoint endpoint
= user.addNewEndpoint(entity);
ConferenceInfoDocument.Endpoint endpoint = user.addNewEndpoint(entity);
endpoint.setStatus(
remote
remote
? getEndpointStatus(callPeer)
: ConferenceInfoDocument.EndpointStatusType.connected);
CallPeerMediaHandler<?> mediaHandler
= callPeer.getMediaHandler();
= callPeer.getMediaHandler();
for (MediaType mediaType : MediaType.values())
{
@ -1113,8 +1110,8 @@ else if (stream != null)
: callPeer.getCall().getCallPeerList())
{
MediaStream otherStream
= otherCallPeer
.getMediaHandler().getStream(mediaType);
= otherCallPeer.getMediaHandler().getStream(
mediaType);
if (otherStream != null)
{
srcId = otherStream.getLocalSourceID();

Loading…
Cancel
Save