Commit 5e236e1b authored by Dele Olajide's avatar Dele Olajide Committed by dele

Rayo Plugin - Added support for jCumulus/RTMFP

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13805 b35dd754-fafc-0310-a699-88a17e54d16e
parent b1496343
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
public class B
{
public B(int i)
{
A = i;
}
public boolean A()
{
return B.A(0x7270e00L);
}
private int A;
private com.jcumulus.server.rtmfp.b.B B;
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.b.A;
import com.jcumulus.server.rtmfp.b.D;
import com.jcumulus.server.rtmfp.g.B;
import java.io.IOException;
import org.apache.log4j.Logger;
// Referenced classes of package com.jcumulus.server.rtmfp:
// N
public class C
{
public C()
{
J = new byte[64];
B = 0;
C = 120;
D = new byte[256];
L = new B(D);
F = true;
}
public C(byte abyte0[], String s)
{
J = new byte[64];
B = 0;
C = 120;
D = new byte[256];
L = new B(D);
M = abyte0;
F = false;
K = s;
H = new byte[N.F + 11];
try
{
com.jcumulus.server.rtmfp.b.C.A().read(J);
System.arraycopy(new byte[] {
3, 26, 0, 0, 2, 30, 0, -127, 2, 13,
2
}, 0, H, 0, 11);
I = com.jcumulus.server.rtmfp.N.B();
System.arraycopy(I.A(), 0, H, 11, N.F);
}
catch(IOException ioexception)
{
E.error(ioexception.getMessage(), ioexception);
}
}
public C(byte abyte0[])
{
J = new byte[64];
B = 0;
C = 120;
D = new byte[256];
L = new B(D);
M = abyte0;
F = false;
H = new byte[73];
try
{
com.jcumulus.server.rtmfp.b.C.A().read(J);
System.arraycopy(new byte[] {
3, 26, 0, 0, 2, 30, 0, 65, 14
}, 0, H, 0, 9);
com.jcumulus.server.rtmfp.b.C.A().read(H, 9, 64);
}
catch(IOException ioexception)
{
E.error(ioexception.getMessage(), ioexception);
}
}
public D A(byte abyte0[], byte abyte1[], int i)
{
byte abyte2[] = com.jcumulus.server.rtmfp.N.A(I.B(), abyte0);
return new D(com.jcumulus.server.rtmfp.N.A(abyte2, abyte1, i, H), com.jcumulus.server.rtmfp.N.B(abyte2, abyte1, i, H));
}
public void A()
{
if(L.A() == 0)
{
L.A(B);
if(!F)
{
L.D(H.length);
L.A(H, H.length);
L.B((byte)88);
}
}
}
public byte A(B b)
{
b.B(L.B());
return (byte)L.A();
}
private static final Logger E = Logger.getLogger(C.class);
public static final int A = 64;
boolean F;
byte M[];
byte J[];
String K;
int B;
byte C;
byte H[];
com.jcumulus.server.rtmfp.b.B G;
D I;
byte D[];
B L;
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.b.C;
import com.jcumulus.server.rtmfp.d.H;
import com.jcumulus.server.rtmfp.e.F;
import org.apache.log4j.Logger;
public class Client
{
private static final Logger Log = Logger.getLogger(Client.class);
protected byte B[];
private String I;
private String E;
private String D;
private String C;
private short G;
protected boolean A;
protected H F;
public Client()
{
}
public void C()
{
if(F != null)
{
F.A("Connect.Closed", "Server close connection");
F.B(true);
A = true;
}
}
public void A(String s, Object aobj[])
{
if(F != null)
{
F f = F.A(s);
Object aobj1[] = aobj;
int i = aobj1.length;
for(int j = 0; j < i; j++)
{
Object obj = aobj1[j];
f.A(obj);
}
F.B(true);
}
}
public byte[] A()
{
return B;
}
public String E()
{
return com.jcumulus.server.rtmfp.b.C.A(B);
}
public String H()
{
return I;
}
public void B(String s)
{
I = s;
}
public String G()
{
return E;
}
public void A(String s)
{
E = s;
}
public String I()
{
return D;
}
public void C(String s)
{
D = s;
}
public String B()
{
return C;
}
public void D(String s)
{
C = s;
}
public short D()
{
return G;
}
public void A(short word0)
{
G = word0;
}
public H F()
{
return F;
}
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.d.H;
import com.jcumulus.server.rtmfp.g.B;
public interface D
{
public abstract void A(boolean flag);
public abstract boolean A(H h);
public abstract void B(H h);
public abstract B A(byte byte0, int i, H h);
public abstract boolean A();
public abstract B B();
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.b.A;
import com.jcumulus.server.rtmfp.b.C;
import com.jcumulus.server.rtmfp.b.D;
import com.jcumulus.server.rtmfp.g.B;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
public class F extends H
{
private static final Logger W = Logger.getLogger(F.class);
Map X;
byte V[];
private Sessions Y;
F(Sessions l)
{
super(0, 0, com.jcumulus.server.rtmfp.N.A, com.jcumulus.server.rtmfp.N.A);
X = new HashMap();
V = new byte[77];
Y = l;
I = true;
System.arraycopy(new byte[] {
1, 10, 65, 14
}, 0, V, 0, 4);
try
{
com.jcumulus.server.rtmfp.b.C.A().read(V, 4, 64);
}
catch(IOException ioexception)
{
W.error(ioexception.getMessage(), ioexception);
}
System.arraycopy(new byte[] {
2, 21, 2, 2, 21, 5, 2, 21, 14
}, 0, V, 68, 9);
}
void A(B b, I i, byte abyte0[], String s)
{
com.jcumulus.server.rtmfp.C c = i.C;
if(c == null)
{
c = new com.jcumulus.server.rtmfp.C(abyte0, s);
X.put(new String(c.J), c);
i.C = c;
}
b.B((byte)64);
b.A(c.J, 64);
}
protected void B(AudioPacket a)
{
byte byte0 = a.L();
if(byte0 != 11)
{
W.error((new StringBuilder()).append("Marker handshake wrong : should be 0b and not ").append(byte0).toString());
return;
}
a.E();
byte byte1 = a.L();
a.A(a.E());
int i = N.C();
N.E(3);
byte byte2 = A(byte1, a, N);
N.F(i);
if(byte2 > 0)
{
N.B(byte2);
N.A((short)(N.A() - N.C() - 2));
E();
}
D = 0;
}
private byte A(byte byte0, AudioPacket a, B b)
{
switch(byte0)
{
case 48: // '0'
a.L();
int i = (a.L() & 0xff) - 1;
byte byte1 = a.L();
String s = new String(a.F(i));
byte abyte0[] = a.F(16);
b.A(abyte0);
if(byte1 != 15)
{
if(byte1 == 10)
{
I l = A(abyte0);
A(b, l, abyte0, s);
b.A(V, V.length);
return 112;
}
W.error("Unkown handshake first way with 'type' type");
}
break;
case 56: // '8'
case 57: // '9'
D = a.C();
if(a.J() != 64)
{
W.error("Bad handshake cookie its size should be 64 bytes");
return 0;
}
com.jcumulus.server.rtmfp.C c = (com.jcumulus.server.rtmfp.C)X.get(new String(a.B(64)));
if(c == null)
{
if(byte0 != 57)
{
W.error("Handshake cookie unknown");
return 0;
}
c = new com.jcumulus.server.rtmfp.C();
int j = a.H();
c.J = a.F(64);
c.K = new String(a.F(64));
a.E(j);
X.put(new String(c.J), c);
}
P p = new P();
p.A(M.L());
if(c.B == 0)
{
D d = null;
if(byte0 == 56)
{
a.D(64);
int k = a.J();
try
{
MessageDigest messagedigest = MessageDigest.getInstance("SHA-256");
messagedigest.update(a.B(k));
p.B = messagedigest.digest();
}
catch(NoSuchAlgorithmException nosuchalgorithmexception)
{
W.error(nosuchalgorithmexception.getMessage(), nosuchalgorithmexception);
}
byte abyte1[] = new byte[a.J() - 2];
a.D(2);
abyte1 = a.F(abyte1.length);
k = a.J();
d = c.A(abyte1, a.G(), k);
}
com.jcumulus.server.rtmfp.b.C.A(c.K, p);
H h = Y.A(D, d.B(), d.A(), p);
c.B = h.O;
String s1 = null;
if(byte0 != 57)
s1 = p.L().toString();
p.N().clear();
p.N().add(s1);
c.A();
}
c.A(b);
return c.C;
case 65: // 'A'
case 69: // 'E'
default:
W.error((new StringBuilder()).append("Unkown handshake packet id ").append(byte0).toString());
break;
}
return 0;
}
public void E()
{
A((byte)11, false);
}
}
This diff is collapsed.
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
public class I extends B
{
public I()
{
super(0);
}
public I(int i)
{
super(i);
}
C C;
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
public interface ISessions
{
public abstract H A(int i, byte abyte0[], byte abyte1[], P p);
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.apache.log4j.Logger;
public class K
{
private static final Logger D = Logger.getLogger(K.class);
public static final int B = 32;
Encryption E;
SecretKeySpec C;
int A;
public K(byte abyte0[], Encryption encrypt)
{
E = encrypt;
if(abyte0 == null)
{
return;
} else
{
A = abyte0.length;
C = new SecretKeySpec(abyte0, 0, 16, "AES");
return;
}
}
public boolean A()
{
return C != null;
}
byte[] A(byte abyte0[], int i, int j)
{
if(C == null)
return abyte0;
try
{
byte abyte1[] = new byte[16];
IvParameterSpec ivparameterspec = new IvParameterSpec(abyte1);
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
if(E == Encryption.ENCRYPT)
cipher.init(1, C, ivparameterspec);
if(E == Encryption.DECRYPT)
cipher.init(2, C, ivparameterspec);
return cipher.doFinal(abyte0, i, j);
}
catch(NoSuchAlgorithmException nosuchalgorithmexception)
{
D.error(nosuchalgorithmexception.getMessage(), nosuchalgorithmexception);
}
catch(NoSuchPaddingException nosuchpaddingexception)
{
D.error(nosuchpaddingexception.getMessage(), nosuchpaddingexception);
}
catch(InvalidKeyException invalidkeyexception)
{
D.error(invalidkeyexception.getMessage(), invalidkeyexception);
}
catch(BadPaddingException badpaddingexception)
{
D.error(badpaddingexception.getMessage(), badpaddingexception);
}
catch(IllegalBlockSizeException illegalblocksizeexception)
{
D.error(illegalblocksizeexception.getMessage(), illegalblocksizeexception);
}
catch(InvalidAlgorithmParameterException invalidalgorithmparameterexception)
{
D.error(invalidalgorithmparameterexception.getMessage(), invalidalgorithmparameterexception);
}
return null;
}
public static enum Encryption {
DECRYPT, ENCRYPT
}
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.b.C;
import com.jcumulus.server.rtmfp.b.D;
import com.jcumulus.server.rtmfp.g.B;
import java.io.IOException;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.log4j.Logger;
// Referenced classes of package com.jcumulus.server.rtmfp:
// K, C
public class N
{
public static byte A[] = "Adobe Systems 02".getBytes();
public static int B = 1935;
public static int C = 12;
public static int G = 1192;
private static final Logger E = Logger.getLogger(C.class);
private static byte D[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -55, 15,
-38, -94, 33, 104, -62, 52, -60, -58, 98, -117,
-128, -36, 28, -47, 41, 2, 78, 8, -118, 103,
-52, 116, 2, 11, -66, -90, 59, 19, -101, 34,
81, 74, 8, 121, -114, 52, 4, -35, -17, -107,
25, -77, -51, 58, 67, 27, 48, 43, 10, 109,
-14, 95, 20, 55, 79, -31, 53, 109, 109, 81,
-62, 69, -28, -123, -75, 118, 98, 94, 126, -58,
-12, 76, 66, -23, -90, 55, -19, 107, 11, -1,
92, -74, -12, 6, -73, -19, -18, 56, 107, -5,
90, -119, -97, -91, -82, -97, 36, 17, 124, 75,
31, -26, 73, 40, 102, 81, -20, -26, 83, -127,
-1, -1, -1, -1, -1, -1, -1, -1
};
public static int F = 128;
public N()
{
}
public static int A(AudioPacket a)
{
int i = 0;
for(int j = 0; j < 3; j++)
i ^= a.C();
a.E(4);
return i;
}
public static void A(B b, int i)
{
Packet a = b.G();
a.E(4);
b.F(0);
b.A(a.C() ^ a.C() ^ i);
}
public static boolean A(K k, AudioPacket a)
{
byte abyte0[] = k.A(a.G(), 0, a.I());
if(abyte0 == null)
{
return false;
} else
{
a.A(abyte0, abyte0.length);
return B(a);
}
}
public static B A(K k, B b)
{
if(k.A())
{
int i = (-1 - b.A()) + 5 & 0xf;
b.F(b.A());
b.A((byte)-1, i);
} else
{
E.error("AesEncrypt not valid");
}
A(b);
byte abyte0[] = k.A(b.B(), 4, b.A() - 4);
if(abyte0 != null)
{
abyte0 = A(abyte0, 0, 4);
return new B(abyte0, abyte0.length);
} else
{
return null;
}
}
private static byte[] A(byte abyte0[], int i, int j)
{
int k = abyte0.length;
byte abyte1[] = new byte[k + j];
System.arraycopy(abyte0, 0, abyte1, 0, i);
for(int l = 0; l < j; l++)
abyte1[i + l] = 0;
System.arraycopy(abyte0, i, abyte1, i + j, k - i);
return abyte1;
}
public static boolean B(AudioPacket a)
{
short word0 = a.E();
short word1 = C(a);
return word0 == word1;
}
public static void A(B b)
{
AudioPacket a = b.G();
a.E(6);
short word0 = C(a);
b.F(4);
b.A(word0);
}
public static short C(AudioPacket a)
{
int i = 0;
int j = a.H();
while(a.I() > 0)
i += a.I() != 1 ? a.E() & 0xffff : a.L() & 0xff;
a.E(j);
i = (i >> 16) + (i & 0xffff);
i += i >> 16;
return (short)(~i & 0xffff);
}
public static D B()
{
BigInteger biginteger = new BigInteger(1, D);
BigInteger biginteger1 = BigInteger.valueOf(2L);
byte abyte0[] = new byte[D.length];
try
{
com.jcumulus.server.rtmfp.b.C.A().read(abyte0);
BigInteger biginteger2 = new BigInteger(1, abyte0);
byte abyte1[] = biginteger1.modPow(biginteger2, biginteger).toByteArray();
byte abyte2[] = Arrays.copyOfRange(abyte1, abyte1.length - F, abyte1.length);
return new D(abyte0, abyte2);
}
catch(IOException ioexception)
{
E.error(ioexception.getMessage(), ioexception);
}
return null;
}
public static byte[] A(byte abyte0[], byte abyte1[])
{
BigInteger biginteger = new BigInteger(1, D);
byte abyte2[] = (new BigInteger(1, abyte1)).modPow(new BigInteger(1, abyte0), biginteger).toByteArray();
return Arrays.copyOfRange(abyte2, abyte2.length - F, abyte2.length);
}
public static byte[] B(byte abyte0[], byte abyte1[], int i, byte abyte2[])
{
try
{
SecretKeySpec secretkeyspec = new SecretKeySpec(abyte1, 0, i, "hmacSHA256");
Mac mac = Mac.getInstance("hmacSHA256");
mac.init(secretkeyspec);
byte abyte3[] = mac.doFinal(abyte2);
secretkeyspec = new SecretKeySpec(abyte0, "hmacSHA256");
mac = Mac.getInstance("hmacSHA256");
mac.init(secretkeyspec);
return mac.doFinal(abyte3);
}
catch(NoSuchAlgorithmException nosuchalgorithmexception)
{
E.error(nosuchalgorithmexception.getMessage(), nosuchalgorithmexception);
}
catch(InvalidKeyException invalidkeyexception)
{
E.error(invalidkeyexception.getMessage(), invalidkeyexception);
}
return null;
}
public static byte[] A(byte abyte0[], byte abyte1[], int i, byte abyte2[])
{
try
{
SecretKeySpec secretkeyspec = new SecretKeySpec(abyte2, "hmacSHA256");
Mac mac = Mac.getInstance("hmacSHA256");
mac.init(secretkeyspec);
mac.update(abyte1, 0, i);
byte abyte3[] = mac.doFinal();
secretkeyspec = new SecretKeySpec(abyte0, "hmacSHA256");
mac = Mac.getInstance("hmacSHA256");
mac.init(secretkeyspec);
return mac.doFinal(abyte3);
}
catch(NoSuchAlgorithmException nosuchalgorithmexception)
{
E.error(nosuchalgorithmexception.getMessage(), nosuchalgorithmexception);
}
catch(InvalidKeyException invalidkeyexception)
{
E.error(invalidkeyexception.getMessage(), invalidkeyexception);
}
return null;
}
public static short A()
{
return A((new com.jcumulus.server.rtmfp.b.B()).getTime());
}
public static short A(long l)
{
return (short)(int)(0x13880L / (l * 4L));
}
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.application.Publication;
import com.jcumulus.server.rtmfp.application.Listener;
import com.jcumulus.server.rtmfp.client.ClientHandler;
import com.jcumulus.server.rtmfp.d.H;
import com.jcumulus.server.rtmfp.e.B;
import com.jcumulus.server.rtmfp.e.F;
import java.lang.reflect.Method;
import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
public class P extends Client
{
private static final Logger L = Logger.getLogger(P.class);
private SocketAddress J;
private List N;
private ClientHandler K;
private boolean M;
public P()
{
N = new ArrayList();
}
public void A(ClientHandler a)
{
K = a;
}
public boolean A(B b, com.jcumulus.server.rtmfp.e.A a)
{
if(!M)
M = K == null || K.onConnection(this, b, a);
else
L.error((new StringBuilder()).append("Client ").append(B).append(" seems already connected!").toString());
return M;
}
public void E(String s)
{
if(M && K != null)
K.onFailed(this, s);
}
public void O()
{
if(M)
{
M = false;
if(K != null)
K.onDisconnection(this);
}
}
public boolean A(String s, B b)
{
if(M && K != null)
{
try
{
Method method = K.getClass().getMethod(s, new Class[] {
com.jcumulus.server.rtmfp.Client.class, b.getClass()
});
Object obj = method.invoke(K, new Object[] {
this, b
});
F f = F.J();
f.A(obj);
return true;
}
catch(Throwable throwable)
{
L.error(throwable.getMessage(), throwable);
}
return false;
} else
{
L.warn("RPC client before connection");
F.B("Call.Failed", "Client must be connected before remote procedure calling");
return true;
}
}
public boolean A(Publication b)
{
if(M)
{
return K == null || K.onPublish(this, b);
} else
{
L.warn("Publication client before connection");
return false;
}
}
public void B(Publication b)
{
if(M)
{
if(K != null)
K.onUnpublish(this, b);
return;
} else
{
L.warn("Unpublication client before connection");
return;
}
}
public boolean B(Listener i)
{
if(M)
{
return K == null || K.onSubscribe(this, i);
} else
{
L.warn("Subscription client before connection");
return false;
}
}
public void A(Listener i)
{
if(M)
{
if(K != null)
K.onUnsubscribe(this, i);
return;
} else
{
L.warn("Unsubscription client before connection");
return;
}
}
public void A(Publication b, String s, com.jcumulus.server.rtmfp.packet.Packet a)
{
if(M)
{
if(K != null)
K.onDataPacket(this, b, s, a);
return;
} else
{
L.warn("DataPacket client before connection");
return;
}
}
public void B(Publication b, int i, com.jcumulus.server.rtmfp.packet.Packet a)
{
if(M)
{
if(K != null)
K.onPacket(this, b, i, a);
return;
} else
{
L.warn("Packet client before connection");
return;
}
}
public void A(Publication b, int i, com.jcumulus.server.rtmfp.packet.Packet a)
{
if(M)
{
if(K != null)
K.onVideoPacket(this, b, i, a);
return;
} else
{
L.warn("VideoPacket client before connection");
return;
}
}
public void J()
{
}
public List N()
{
return N;
}
public void A(H h)
{
F = h;
}
public boolean K()
{
return A;
}
public SocketAddress L()
{
return J;
}
public void A(SocketAddress socketaddress)
{
J = socketaddress;
}
public boolean M()
{
return M;
}
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import org.apache.log4j.Logger;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.*;
public class RtmfpChannelUpstreamHandler extends SimpleChannelUpstreamHandler
{
private static final Logger Log = Logger.getLogger(RtmfpChannelUpstreamHandler.class);
private Sessions sessions;
public RtmfpChannelUpstreamHandler(Sessions sessions)
{
this.sessions = sessions;
}
public void messageReceived(ChannelHandlerContext channelhandlercontext, MessageEvent messageevent) throws Exception
{
ChannelBuffer channelbuffer = (ChannelBuffer)messageevent.getMessage();
if(channelbuffer.readableBytes() < 16)
Log.debug((new StringBuilder()).append("Incorrect packet received from ").append(messageevent.getRemoteAddress()).toString());
byte abyte0[] = channelbuffer.array();
AudioPacket packet = new AudioPacket(abyte0, channelbuffer.readableBytes());
int i = com.jcumulus.server.rtmfp.N.A(packet);
H h = sessions.A(i);
if(h == null)
{
Log.warn((new StringBuilder()).append("Session with id=").append(i).append(" isn't found").toString());
return;
} else
{
h.A(messageevent.getChannel(), messageevent.getRemoteAddress());
h.A(packet);
return;
}
}
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import org.jboss.netty.channel.*;
import org.jboss.netty.handler.execution.ExecutionHandler;
import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
public class ServerPipelineFactory implements ChannelPipelineFactory
{
private OrderedMemoryAwareThreadPoolExecutor orderedmemoryawarethreadpoolexecutor = null;
private Sessions sessions;
public ServerPipelineFactory(Sessions sessions, OrderedMemoryAwareThreadPoolExecutor orderedmemoryawarethreadpoolexecutor)
{
this.sessions = sessions;
this.orderedmemoryawarethreadpoolexecutor = orderedmemoryawarethreadpoolexecutor;
}
public ChannelPipeline getPipeline() throws Exception
{
ChannelPipeline channelpipeline = Channels.pipeline();
channelpipeline.addLast("pipelineExecutor", new ExecutionHandler(orderedmemoryawarethreadpoolexecutor));
channelpipeline.addLast("handler", new RtmfpChannelUpstreamHandler(sessions));
return channelpipeline;
}
}
package com.jcumulus.server.rtmfp;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import java.util.*;
import org.apache.log4j.Logger;
public class Sessions implements ISessions
{
private static Logger A = Logger.getLogger(Sessions.class);
private F D;
private Map C;
int B;
public Sessions()
{
C = new HashMap();
B = 1;
D = new F(this);
}
public H A(int i, byte abyte0[], byte abyte1[], P p)
{
int j = A();
H h = new H(j, i, abyte0, abyte1, p);
C.put(Integer.valueOf(j), h);
A.info((new StringBuilder()).append("Session ").append(j).append(" created").toString());
return h;
}
public H A(int i)
{
if(i == 0)
return D;
H h = (H)C.get(Integer.valueOf(i));
if(h != null && !h.F)
return h;
else
return null;
}
public Collection B()
{
return C.values();
}
private int A()
{
int i = B;
B++;
return i;
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
public class A
{
private int B;
private int C;
private int A;
A(int i, int j, int k)
{
B = i;
C = j;
A = k;
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import java.util.HashMap;
import java.util.Map;
public class C
{
private Map A;
private E B;
public C()
{
A = new HashMap();
B = new E(A);
}
public E getStreams()
{
return B;
}
public Map getPublications()
{
return A;
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
public class D extends H
{
public D(byte abyte0[], com.jcumulus.server.rtmfp.D d)
{
super((byte)8, abyte0, d);
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.P;
import com.jcumulus.server.rtmfp.d.H;
import java.util.*;
import org.apache.log4j.Logger;
public class E
{
private static Logger A = Logger.getLogger(E.class);
private List D;
private Map C;
Integer B;
public E(Map map)
{
D = new ArrayList();
B = Integer.valueOf(0);
C = map;
}
public Integer A()
{
Integer integer = B;
Integer integer1 = B = Integer.valueOf(B.intValue() + 1);
Integer _tmp = integer;
A.info((new StringBuilder()).append("New stream ").append(B).toString());
D.add(B);
return B;
}
public Publication A(String s)
{
Publication b = (Publication)C.get(s);
if(b != null)
{
return b;
} else
{
Publication b1 = new Publication(s);
C.put(s, b1);
return b1;
}
}
public Publication A(P p, int i, String s, H h)
throws Exception
{
Publication b = A(s);
try
{
b.A(p, i, h);
}
catch(Exception exception)
{
if(b.B() == 0 && b.A().size() == 0)
A(b);
throw exception;
}
return b;
}
public void A(P p, int i, String s)
{
Publication b = (Publication)C.get(s);
if(b == null)
{
A.debug((new StringBuilder()).append("The stream '").append(s).append("' with a ").append(i).append(" id doesn't exist, unpublish useless").toString());
return;
}
b.B(p, i);
if(b.B() == 0 && b.A().size() == 0)
A(b);
}
public boolean A(P p, int i, String s, H h, double d)
{
Publication b = (Publication)C.get(s);
boolean flag = false;
if(b == null)
b = A(s);
if(b != null)
{
flag = b.A(p, i, h, d == -3000D);
if(!flag && b.B() == 0 && b.A().size() == 0)
A(b);
}
return flag;
}
public void B(P p, int i, String s)
{
Publication b = (Publication)C.get(s);
if(b == null)
{
A.debug((new StringBuilder()).append("The stream '").append(s).append("' doesn't exists, unsubscribe useless").toString());
return;
}
b.A(p, i);
if(b.B() == 0 && b.A().size() == 0)
A(b);
}
void A(Publication b)
{
C.remove(b.C());
}
public void A(Integer integer)
{
A.debug((new StringBuilder()).append("Stream ").append(integer).append(" deleted").toString());
D.remove(integer);
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.D;
public class F extends H
{
public F(byte abyte0[], D d)
{
super((byte)9, abyte0, d);
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.b.B;
import java.util.List;
public class G
{
private int H;
private double C;
private int G;
private List B;
private int F;
private B D;
private int E;
private int A;
public G()
{
}
public void A(int i, int j, int k)
{
}
public void E()
{
}
public int F()
{
return H;
}
public void C(int i)
{
H = i;
}
public void G()
{
H++;
}
public double H()
{
return C;
}
public void A(double d)
{
C = d;
}
public int B()
{
return G;
}
public void E(int i)
{
G = i;
}
public List D()
{
return B;
}
public void A(List list)
{
B = list;
}
public int A()
{
return F;
}
public void A(int i)
{
F = i;
}
public B C()
{
return D;
}
public void A(B b)
{
D = b;
}
public int J()
{
return E;
}
public void D(int i)
{
E = i;
}
public int I()
{
return A;
}
public void B(int i)
{
A = i;
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.D;
import com.jcumulus.server.rtmfp.g.B;
import org.apache.log4j.Logger;
// Referenced classes of package com.jcumulus.server.rtmfp.application:
// G, I
public class H extends com.jcumulus.server.rtmfp.d.H
{
private static final Logger W = Logger.getLogger(H.class);
private byte V;
private G T;
private boolean U;
public H(byte byte0, byte abyte0[], D d)
{
super(abyte0, d);
T = new G();
V = byte0;
}
void A(int i, Packet a, boolean flag)
{
if(flag)
{
if(a.H() >= 5)
{
a.E(a.H() - 5);
B b = new B(a.G(), 5);
b.B(V);
b.A(i);
A(a.G(), a.I(), a.G(), 5);
return;
}
W.warn("Written unbuffered impossible, it requires 5 head bytes available on PacketReader given");
}
com.jcumulus.server.rtmfp.g.A a1 = A(true);
a1.B(V);
a1.A(i);
a1.B(a.G());
}
public G M()
{
return T;
}
public boolean L()
{
return U;
}
public void C(boolean flag)
{
U = flag;
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.d.H;
import com.jcumulus.server.rtmfp.e.F;
import com.jcumulus.server.rtmfp.g.A;
import org.apache.log4j.Logger;
public class Listener
{
private static final Logger E = Logger.getLogger(Listener.class);
private Publication K;
private int B;
private boolean A;
private int D;
private boolean F;
private int G;
private int H;
private int L;
private H J;
private D C;
private com.jcumulus.server.rtmfp.application.F I;
public Listener(int i, Publication b, H h, boolean flag)
{
B = i;
K = b;
J = h;
A = flag;
}
public Publication getPublication()
{
return K;
}
public void C()
{
if(C == null)
C = J.B();
else
E.warn((new StringBuilder()).append("Listener ").append(B).append(" audio track has already been initialized").toString());
if(I == null)
I = J.K();
else
E.warn((new StringBuilder()).append("Listener ").append(B).append(" video track has already been initialized").toString());
A();
}
private void A()
{
if(I != null)
A(((H) (I)));
if(C != null)
A(((H) (C)));
A(J);
D++;
}
private int A(int i)
{
if(i == 0)
i = 1;
if(G == 0 && H == 0)
{
G = i;
E.debug((new StringBuilder()).append("Deltatime assignment : ").append(G).toString());
}
if(G > i)
{
E.warn((new StringBuilder()).append("Time infererior to deltaTime on listener ").append(B).append(", certainly a non increasing time").toString());
G = i;
}
L = (i - G) + H;
return L;
}
private void A(H h)
{
E.debug((new StringBuilder()).append("Writing bound ").append(D).append(" on flow writer ").append(h.E()).toString());
A a = h.A(false);
a.A((short)34);
a.A(D);
a.A(3);
}
public void A(String s)
{
J.A("Play.PublishNotify", (new StringBuilder()).append(s).append(" is now published").toString());
F = false;
}
public void B(String s)
{
J.A("Play.UnpublishNotify", (new StringBuilder()).append(s).append(" is now unpublished").toString());
G = 0;
H = L;
C.M().E();
I.M().E();
}
public void B()
{
if(C != null)
C.A();
if(I != null)
I.A();
J.B(true);
}
public void A(String s, Packet a)
{
if(A)
{
int i = s.length() + 9;
if(a.H() >= i)
{
a.E(a.H() - i);
J.A(a.G(), a.I());
return;
}
E.warn((new StringBuilder()).append("Written unbuffered impossible, it requires ").append(i).append(" head bytes available on PacketReader given").toString());
}
J.B(s).E().B(a.G());
}
public void B(int i, Packet a)
{
if(C == null)
{
E.error((new StringBuilder()).append("Listener ").append(B).append(" must be initialized before to be used").toString());
return;
}
if(C.L())
{
C.C(false);
A();
}
C.A(A(i), a, A);
}
public void A(int i, Packet a)
{
if(I == null)
{
E.error((new StringBuilder()).append("Listener ").append(B).append(" must be initialized before to be used").toString());
return;
}
if((a.K() & 0xf0) == 16)
F = true;
if(!F)
{
E.debug((new StringBuilder()).append("Video frame dropped for listener ").append(B).append(" to wait first key frame").toString());
I.M().G();
return;
}
if(I.L())
{
I.C(false);
A();
}
I.A(A(i), a, A);
}
}
package com.jcumulus.server.rtmfp.application;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.P;
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.d.E;
import com.jcumulus.server.rtmfp.d.H;
import com.google.common.base.Strings;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.locks.LockSupport;
import org.apache.log4j.Logger;
// Referenced classes of package com.jcumulus.server.rtmfp.application:
// G, I
public class Publication
{
private static final Logger F = Logger.getLogger(Publication.class);
private P E;
private H A;
private boolean G;
private String J;
private int I;
private Map H;
private G D;
private G C;
private _A B;
private class _A extends Thread
{
public void A()
{
D = true;
interrupt();
}
public void run()
{
long l = System.nanoTime();
do
{
if(D)
break;
l += G * 0xf4240L;
A.D();
long l1 = l - System.nanoTime() - E * 0xf4240L;
if(l1 > 0L)
LockSupport.parkNanos(l1);
} while(true);
}
protected static final long C = 0L;
protected static final long B = 0xf4240L;
protected long E;
protected Object F;
protected long G;
protected volatile boolean D;
final Publication A;
private _A()
{
super();
A = Publication.this;
F = new Object();
G = 20L;
D = false;
setPriority(10);
E = 0L; // timing_shift
}
}
public Publication(String s)
{
G = false;
H = new HashMap();
D = new G();
C = new G();
B = new _A();
B.start();
F.info((new StringBuilder()).append("New publication ").append(s).toString());
J = s;
}
public boolean A(P p, int i, H h, boolean flag)
{
Listener j = (Listener)H.get(Integer.valueOf(i));
if(j != null)
{
F.warn((new StringBuilder()).append("Listener ").append(i).append(" is already subscribed for publication ").append(I).toString());
return true;
}
Listener k = new Listener(i, this, h, flag);
if(p.B(k))
{
H.put(Integer.valueOf(i), k);
h.A("Play.Reset", (new StringBuilder()).append("Playing and resetting ").append(J).toString());
h.A("Play.Start", (new StringBuilder()).append("Started playing ").append(J).toString());
k.C();
return true;
} else
{
h.A("Play.Failed", (new StringBuilder()).append("Not authorized to play ").append(J).toString());
return false;
}
}
public void A(P p, int i)
{
Listener j = (Listener)H.get(Integer.valueOf(i));
if(j == null)
{
F.warn((new StringBuilder()).append("Listener ").append(i).append(" is already unsubscribed of publication ").append(I).toString());
return;
} else
{
p.A(j);
H.remove(Integer.valueOf(i));
return;
}
}
public void A(String s, String s1)
{
if(I == 0)
{
F.error((new StringBuilder()).append("Publication ").append(J).append(" is not published").toString());
return;
}
if(A != null)
{
if(!Strings.isNullOrEmpty(s))
A.A(s, s1);
A.A("close");
} else
{
F.warn((new StringBuilder()).append("Publisher ").append(I).append(" has no controller to close it").toString());
}
}
public void A(P p, int i, H h)
throws Exception
{
if(I != 0)
{
if(h != null)
h.A("Publish.BadName", (new StringBuilder()).append(J).append(" is already published").toString());
throw new Exception((new StringBuilder()).append(J).append(" is already published").toString());
}
I = i;
if(!p.A(this))
{
String s = (new StringBuilder()).append("Not allowed to publish ").append(J).toString();
I = 0;
if(h != null)
h.A("Publish.BadName", s);
throw new Exception(s);
}
E = p;
A = h;
G = false;
Listener j;
for(Iterator iterator = H.values().iterator(); iterator.hasNext(); j.A(J))
j = (Listener)iterator.next();
D();
if(h != null)
h.A("Publish.Start", (new StringBuilder()).append(J).append(" is now published").toString());
}
public void B(P p, int i)
{
B.A();
if(I != i)
{
F.warn((new StringBuilder()).append("Unpublish '").append(J).append("' operation with a ").append(i).append(" id different than its publisher ").append(I).append(" id").toString());
return;
}
Listener j;
for(Iterator iterator = H.values().iterator(); iterator.hasNext(); j.B(J))
j = (Listener)iterator.next();
D();
p.B(this);
D.E();
C.E();
I = 0;
E = null;
A = null;
}
public void D()
{
Listener i;
for(Iterator iterator = H.values().iterator(); iterator.hasNext(); i.B())
i = (Listener)iterator.next();
}
public void A(String s, Packet a)
{
if(I == 0)
{
F.error((new StringBuilder()).append("Data packet pushed on a publication ").append(I).append(" who is idle").toString());
return;
}
int i = a.H();
for(Iterator iterator = H.values().iterator(); iterator.hasNext(); a.E(i))
{
Listener j = (Listener)iterator.next();
j.A(s, a);
}
E.A(this, s, a);
}
public void B(int i, AudioPacket a, int j)
{
int k = a.H();
if(j > 0)
F.info((new StringBuilder()).append(j).append(" audio fragments lost on publication ").append(I).toString());
C.A(i, a.M(), j);
for(Iterator iterator = H.values().iterator(); iterator.hasNext(); a.E(k))
{
Listener l = (Listener)iterator.next();
l.B(i, a);
}
if(E != null)
E.B(this, i, a);
}
public void A(int i, AudioPacket a, int j)
{
if(j > 0)
G = false;
if((a.K() & 0xf0) == 16)
G = true;
D.A(i, a.M(), j);
if(j > 0)
F.info((new StringBuilder()).append(j).append(" video fragments lost on publication ").append(I).toString());
if(!G)
{
F.debug((new StringBuilder()).append("No key frame available on publication ").append(I).append(", frame dropped to wait first key frame").toString());
D.G();
return;
}
int k = a.H();
for(Iterator iterator = H.values().iterator(); iterator.hasNext(); a.E(k))
{
Listener l = (Listener)iterator.next();
l.A(i, a);
}
if(E != null)
E.A(this, i, a);
}
public int B()
{
return I;
}
public Map A()
{
return H;
}
public String C()
{
return J;
}
}
package com.jcumulus.server.rtmfp.b;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import java.io.IOException;
import java.io.InputStream;
import java.util.Random;
public class A extends InputStream
{
public A()
{
B = new Random();
A = false;
}
public int read() throws IOException
{
A();
int i = B.nextInt() % 256;
if(i < 0)
i = -i;
return i;
}
public int read(byte abyte0[], int i, int j) throws IOException
{
A();
byte abyte1[] = new byte[j];
B.nextBytes(abyte1);
System.arraycopy(abyte1, 0, abyte0, i, j);
return j;
}
public int read(byte abyte0[]) throws IOException
{
A();
B.nextBytes(abyte0);
return abyte0.length;
}
public long skip(long l) throws IOException
{
A();
return l;
}
public void close()
{
A = true;
}
private void A() throws IOException
{
if(A)
throw new IOException("Input stream closed");
else
return;
}
public int available()
{
return 0x7fffffff;
}
private Random B;
private boolean A;
}
package com.jcumulus.server.rtmfp.b;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import java.util.Date;
public class B extends Date
{
public B()
{
super((new Date()).getTime());
}
public void A()
{
setTime((new Date()).getTime());
}
public boolean A(long l)
{
long l1 = (new B()).getTime() - getTime();
return l1 > l;
}
public long B()
{
Long long1 = Long.valueOf((new Date()).getTime());
long l = long1.longValue() - getTime();
if(l == 0L)
l = 1L;
return l;
}
public static final int A = 4;
}
package com.jcumulus.server.rtmfp.b;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.P;
public class C
{
public C()
{
}
public static void A(String s, P p)
{
}
public static A A()
{
return B;
}
public static boolean B(byte abyte0[], byte abyte1[])
{
if(abyte0.length != abyte1.length)
return false;
for(int i = 0; i < abyte0.length; i++)
if(abyte0[i] != abyte1[i])
return false;
return true;
}
public static boolean A(byte abyte0[], byte abyte1[])
{
for(int i = 0; i < abyte0.length; i++)
if(abyte0[i] != abyte1[i])
return false;
return true;
}
public static byte A(int i)
{
if(i >= 0x200000)
return 4;
if(i >= 16384)
return 3;
return ((byte)(i < 128 ? 1 : 2));
}
public static String A(byte abyte0[])
{
int i = 0;
char ac[] = new char[abyte0.length * 2];
for(int j = 0; j < abyte0.length; j++)
{
ac[i++] = A[abyte0[j] >> 4 & 0xf];
ac[i++] = A[abyte0[j] & 0xf];
}
return new String(ac);
}
private static final A B = new A();
private static final char A[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f'
};
}
package com.jcumulus.server.rtmfp.b;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
public class D
{
public D(byte abyte0[], byte abyte1[])
{
B = abyte0;
A = abyte1;
}
public byte[] B()
{
return B;
}
public void A(byte abyte0[])
{
B = abyte0;
}
public byte[] A()
{
return A;
}
public void B(byte abyte0[])
{
A = abyte0;
}
private byte B[];
private byte A[];
}
package com.jcumulus.server.rtmfp.client;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.Client;
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.application.Publication;
import com.jcumulus.server.rtmfp.application.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.voip.server.*;
import com.sun.voip.*;
public class ClientHandler implements IClientHandler
{
private static Logger log = LoggerFactory.getLogger(ClientHandler.class);
private short counter = 0;
public boolean onConnection(Client client, com.jcumulus.server.rtmfp.e.B b, com.jcumulus.server.rtmfp.e.A a)
{
log.info("onConnect ");
return true;
}
public void onFailed(Client client, String s)
{
log.info("onFailed " + s);
}
public void onDisconnection(Client client)
{
log.info("onDisconnection ");
}
public boolean onPublish(Client client, Publication b)
{
log.info("onPublish " + b.C());
return true;
}
public void onUnpublish(Client client, Publication b)
{
log.info("onUnPublish " + b.C());
}
public boolean onSubscribe(Client client, Listener i)
{
log.info("onSubscribe " + i.getPublication().C());
String publishName = i.getPublication().C();
if (RtmfpCallAgent.publishHandlers.containsKey(publishName) == false)
{
RtmfpCallAgent.publishHandlers.put(publishName, com.jcumulus.server.rtmfp.d.E.I.getStreams().A(publishName));
}
return true;
}
public void onUnsubscribe(Client client, Listener i)
{
log.info("onUnsubscribe " + i.getPublication().C());
String publishName = i.getPublication().C();
if (RtmfpCallAgent.publishHandlers.containsKey(publishName))
{
Publication publication = RtmfpCallAgent.publishHandlers.remove(publishName);
publication = null;
}
}
public void onDataPacket(Client client, Publication b, String s, Packet a)
{
log.info("onDataPacket ");
}
public void onPacket(Client client, Publication b, int i, Packet a)
{
String streamName = b.C();
if (RtmfpCallAgent.playHandlers.containsKey(streamName))
{
MemberReceiver memberReceiver = RtmfpCallAgent.playHandlers.get(streamName);
if (memberReceiver != null)
{
if (counter < 20) log.info("onPacket " + streamName);
byte[] stream = a.G();
int[] l16Buffer = new int[stream.length - 1];
AudioConversion.ulawToLinear(stream, 1, stream.length - 1, l16Buffer);
l16Buffer = MemberSender.normalize(l16Buffer);
memberReceiver.handleWebRtcMedia(l16Buffer, counter++);
}
}
}
public void onVideoPacket(Client client, Publication b, int i, Packet a)
{
log.info("onVideoPacket ");
}
public void sendDigit(Client client, com.jcumulus.server.rtmfp.e.B b)
{
String stream = b.E();
String digit = b.E();
//Application.component.sendDigit(stream, digit);
}
}
package com.jcumulus.server.rtmfp.client;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.Client;
import com.jcumulus.server.rtmfp.e.B;
import com.jcumulus.server.rtmfp.application.Publication;
import com.jcumulus.server.rtmfp.application.Listener;
public interface IClientHandler
{
public abstract boolean onConnection(Client client, B b, com.jcumulus.server.rtmfp.e.A a);
public abstract void onFailed(Client client, String s);
public abstract void onDisconnection(Client client);
public abstract boolean onPublish(Client client, Publication b);
public abstract void onUnpublish(Client client, Publication b);
public abstract boolean onSubscribe(Client client, Listener i);
public abstract void onUnsubscribe(Client client, Listener i);
public abstract void onDataPacket(Client client, Publication b, String s, Packet a);
public abstract void onPacket(Client client, Publication b, int i, Packet a);
public abstract void onVideoPacket(Client client, Publication b, int i, Packet a);
}
package com.jcumulus.server.rtmfp.d;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.D;
import com.jcumulus.server.rtmfp.P;
import com.jcumulus.server.rtmfp.application.Publication;
import com.jcumulus.server.rtmfp.application.C;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import org.apache.log4j.Logger;
// Referenced classes of package com.jcumulus.server.rtmfp.d:
// E, H
public class A extends com.jcumulus.server.rtmfp.d.E
{
static enum _A
{
IDLE, PUBLISHING, PLAYING
}
private static final Logger _ = Logger.getLogger(E.class);
public static final byte Z[] = {
0, 84, 67, 4
};
public static final String X = "NetStream";
int b;
Publication c;
_A W;
boolean V;
int Y;
String a;
public A(int i, byte abyte0[], P p, D d)
{
super(i, abyte0, "NetStream", p, d);
Packet a1 = new AudioPacket(abyte0, abyte0.length);
a1.D(4);
b = a1.J();
Iterator iterator = I.getPublications().values().iterator();
do
{
if(!iterator.hasNext())
break;
Publication b1 = (Publication)iterator.next();
if(b1.B() != b)
continue;
c = b1;
break;
} while(true);
}
public void C()
{
super.C();
H();
}
void H()
{
if(W == _A.PUBLISHING)
{
I.getStreams().A(K, b, a);
O.A("Unpublish.Success", (new StringBuilder()).append(a).append(" is now unpublished").toString());
} else
if(W == _A.PLAYING)
{
I.getStreams().B(K, b, a);
O.A("Play.Stop", (new StringBuilder()).append("Stopped playing ").append(a).toString());
}
W = _A.IDLE;
}
protected void C(AudioPacket a1)
{
if(c != null && c.B() == b)
{
c.B(a1.C(), a1, Y);
Y = 0;
} else
{
_.warn("an audio packet has been received on a no publisher FlowStream, certainly a publication currently closing");
}
}
protected void A(AudioPacket a1)
{
if(c != null && c.B() == b)
{
c.A(a1.C(), a1, Y);
Y = 0;
} else
{
_.warn("a video packet has been received on a no publisher FlowStream, certainly a publication currently closing");
}
}
protected void A()
{
if(c != null && c.B() == b)
c.D();
}
protected void A(byte byte0, Packet a1)
{
short word0 = a1.E();
if(word0 == 34)
{
_.debug((new StringBuilder()).append("Bound ").append(A).append(" : ").append(a1.C()).append(" ").append(a1.C()).toString());
return;
} else
{
_.error((new StringBuilder()).append("Unknown raw flag ").append(word0).append(" on FlowStream ").append(A).toString());
super.A(byte0, a1);
return;
}
}
protected void A(int i)
{
if(c != null)
Y += i;
super.A(i);
}
protected void A(String s, com.jcumulus.server.rtmfp.e.B b1)
{
if("play".equals(s))
{
H();
a = b1.E();
double d = -2000D;
if(b1.B())
d = b1.N().doubleValue();
if(I.getStreams().A(K, b, a, O, d))
W = _A.PLAYING;
} else
if("closeStream".equals(s))
H();
else
if("publish".equals(s))
{
H();
a = b1.E();
_.info((new StringBuilder()).append("Create new publication with name - ").append(a).toString());
String s1;
if(b1.B())
s1 = b1.E();
try
{
I.getStreams().A(K, b, a, O);
W = _A.PUBLISHING;
}
catch(Exception exception)
{
_.error(exception.getMessage(), exception);
}
} else
if(W == _A.PUBLISHING)
{
if(c == null)
{
c = (Publication)I.getPublications().get(a);
if(c == null)
_.error((new StringBuilder()).append("Publication ").append(a).append(" unfound, related for the ").append(s).append(" message").toString());
}
if(c != null)
c.A(s, b1.M());
} else
{
super.A(s, b1);
}
}
}
package com.jcumulus.server.rtmfp.d;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
public class B
{
private byte A;
private AudioPacket B;
B(AudioPacket a, byte byte0)
{
A = byte0;
B = a;
}
public AudioPacket B()
{
return B;
}
public byte A()
{
return A;
}
}
package com.jcumulus.server.rtmfp.d;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.D;
import com.jcumulus.server.rtmfp.P;
// Referenced classes of package com.jcumulus.server.rtmfp.d:
// E
public class C extends E
{
public C(int i, P p, D d)
{
super(i, Q, "NetGroup", p, d);
}
public static final byte Q[] = {
0, 71, 67
};
public static final String R = "NetGroup";
}
package com.jcumulus.server.rtmfp.d;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import org.apache.log4j.Logger;
public class D
{
private static final Logger D = Logger.getLogger(E.class);
private byte B[];
private AudioPacket C;
private int A;
public D(AudioPacket a)
{
B = new byte[0];
B = a.G();
A = 1;
}
public void A(AudioPacket a)
{
byte abyte0[] = new byte[B.length + a.I()];
System.arraycopy(B, 0, abyte0, 0, B.length);
System.arraycopy(a.G(), 0, abyte0, B.length, a.I());
B = abyte0;
A++;
}
public AudioPacket A()
{
if(C != null)
{
D.error("Packet already released");
return C;
} else
{
C = new AudioPacket(B, B.length);
C.G(A);
return C;
}
}
public int B()
{
return A;
}
}
This diff is collapsed.
package com.jcumulus.server.rtmfp.d;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.D;
import com.jcumulus.server.rtmfp.P;
import com.jcumulus.server.rtmfp.e.A;
import com.jcumulus.server.rtmfp.e.B;
import com.jcumulus.server.rtmfp.e.E;
import com.jcumulus.server.rtmfp.application.C;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.util.*;
// Referenced classes of package com.jcumulus.server.rtmfp.d:
// E, H
public class F extends com.jcumulus.server.rtmfp.d.E
{
public F(int i, P p, D d)
{
super(i, S, "NetConnection", p, d);
U = new ArrayList();
}
public void A(String s, B b)
{
if("connect".equals(s))
{
b.C();
E e = b.L();
b.K();
K.A(e.A("swfUrl", ""));
K.C(e.A("pageUrl", ""));
K.D(e.A("flashVer", ""));
if(e.A("objectEncoding", Double.valueOf(0.0D)).doubleValue() == 0.0D)
{
O.B("Connect.Error", "ObjectEncoding client must be in a AMF3 format (not AMF0)");
return;
}
K.A(O);
int i = O.D();
A a1 = O.C("Connect.Success", "Connection succeeded");
a1.A("objectEncoding", 3D);
boolean flag = K.A(b, a1);
a1.A();
if(!flag)
{
O.A(i);
K.C();
}
} else
if("setPeerInfo".equals(s))
{
String s1;
for(; b.B(); K.N().add(s1))
s1 = b.E();
com.jcumulus.server.rtmfp.g.A a = O.A(false);
a.A((short)41);
a.A(JiveGlobals.getIntProperty("voicebridge.rtmfp.keep.alive.server", 5));
a.A(JiveGlobals.getIntProperty("voicebridge.rtmfp.keep.alive.peer", 5));
} else
if(!"initStream".equals(s))
if("createStream".equals(s))
{
com.jcumulus.server.rtmfp.e.F f = O.J();
Integer integer1 = I.getStreams().A();
U.add(integer1);
f.A(integer1.intValue());
} else
if("deleteStream".equals(s))
{
Integer integer = Integer.valueOf(b.N().intValue());
U.remove(integer);
I.getStreams().A(integer);
} else
if(!K.A(s, b))
O.B("Call.Failed", (new StringBuilder()).append("Method '").append(s).append("' not found").toString());
}
public static final byte S[] = {
0, 84, 67, 4, 0
};
public static final String T = "NetConnection";
List U;
}
package com.jcumulus.server.rtmfp.d;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
public class G extends I
{
public G(byte abyte0[], int i, byte abyte1[], int j)
{
super(false);
}
public int C()
{
return 0;
}
}
This diff is collapsed.
package com.jcumulus.server.rtmfp.d;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
import com.jcumulus.server.rtmfp.packet.*;
import java.util.LinkedHashMap;
import java.util.Map;
public abstract class I
{
public static final byte F = 0;
public static final byte E = 8;
public static final byte D = 9;
public static final byte C = 20;
public static final byte H = 15;
private Map A;
private boolean B;
protected byte G[];
protected I(boolean flag)
{
A = new LinkedHashMap();
G = new byte[20000];
B = flag;
}
public abstract int C();
public Packet D()
{
return new Packet(G, C());
}
public Packet A(int i)
{
Packet b = new Packet(G, C());
b.E(i);
return b;
}
public Map B()
{
return A;
}
public boolean A()
{
return B;
}
}
package com.jcumulus.server.rtmfp.d;
/**
* jCumulus is a Java port of Cumulus OpenRTMP
*
* Copyright 2011 OpenRTMFP
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License received along this program for more
* details (or else see http://www.gnu.org/licenses/).
*
*
* This file is a part of jCumulus.
*/
public class J extends K
{
public J()
{
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -451,7 +451,7 @@ public class ConferenceMember implements TreatmentDoneListener,
this.callHandler = callHandler;
if (cp.getProtocol() != null && "WebRtc".equals(cp.getProtocol()) == false)
if (cp.getProtocol() != null && "WebRtc".equals(cp.getProtocol()) == false && "Rtmfp".equals(cp.getProtocol()) == false)
{
if (rtcpAddress != null) {
this.rtcpAddress = rtcpAddress;
......
......@@ -376,7 +376,7 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
if (cp.getProtocol() != null && "WebRtc".equals(cp.getProtocol()))
if (cp.getProtocol() != null && ("WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol())))
{
conferenceManager.getConferenceReceiver().addMember(this);
......@@ -870,7 +870,7 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
private boolean callIsDead() {
if (cp.getProtocol() != null && "WebRtc".equals(cp.getProtocol()))
if (cp.getProtocol() != null && ("WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol())))
{
return false;
}
......
......@@ -1851,7 +1851,7 @@ public class Application implements CallEventListener {
if ("protocol".equalsIgnoreCase(parameter))
{
if (value.equalsIgnoreCase("SIP") == false && value.equalsIgnoreCase("NS") == false && value.equalsIgnoreCase("WebRtc") == false)
if (value.equalsIgnoreCase("SIP") == false && value.equalsIgnoreCase("NS") == false && value.equalsIgnoreCase("WebRtc") == false && value.equalsIgnoreCase("Rtmfp") == false)
{
reportError("Invalid protocol: " + value);
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment