Fix interoperability issue with Zfone3. Set the SSRC at the earliest possible time, start

ZRTP handshake only after SSRC is known to ZRTP. This modification disables half-duplex
(receive-only) RTP streams. This restriction may be lifted if "newmedia" goes into operation.
cusax-fix
Werner Dittmann 17 years ago
parent 4268a877c9
commit 81279054fd

@ -1427,8 +1427,21 @@ else if (format instanceof AudioFormat)
try
{
rtpManager.createSendStream(dataSource, i);
SendStream sendStream = rtpManager.createSendStream(dataSource, i);
TransformConnector transConnector =
this.transConnectors.get(rtpManager);
// If a ZRTP engine is availabe then set the SSRC of this stream
// currently ZRTP supports only one SSRC per engine
if (transConnector != null)
{
long ssrc = sendStream.getSSRC();
ZRTPTransformEngine engine
= (ZRTPTransformEngine) transConnector.getEngine();
engine.setOwnSSRC(ssrc);
}
logger.trace("Created a send stream for format " + format);
}
catch (Exception exc)

@ -480,6 +480,18 @@ public void cleanup()
}
}
/**
* Set the SSRC of the RTP transmitter stream.
*
* ZRTP fills the SSRC in the ZRTP messages.
*
* @param ssrc
*/
public void setOwnSSRC(long ssrc) {
ownSSRC = (int)(ssrc & 0xffffffff);
System.out.println("Own SSRC: " + ownSSRC);
}
/**
* The data output stream calls this method to transform outgoing
* packets.
@ -527,7 +539,7 @@ public RawPacket reverseTransform(RawPacket pkt)
{
// Check if we need to start ZRTP
if (!started && enableZrtp)
if (!started && enableZrtp && ownSSRC != 0)
{
startZrtp();
}
@ -566,7 +578,7 @@ public RawPacket reverseTransform(RawPacket pkt)
* In any case return null because ZRTP packets must never reach
* the application.
*/
if (enableZrtp)
if (enableZrtp && ownSSRC != 0)
{
ZrtpRawPacket zPkt = new ZrtpRawPacket(pkt);
if (!zPkt.checkCrc())

Loading…
Cancel
Save