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);
}
}
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.client.*;
import com.jcumulus.server.rtmfp.packet.*;
import com.jcumulus.server.rtmfp.b.C;
import com.jcumulus.server.rtmfp.d.E;
import com.jcumulus.server.rtmfp.d.F;
import com.jcumulus.server.rtmfp.g.B;
import com.google.common.base.Strings;
import java.net.SocketAddress;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
import org.jboss.netty.channel.Channel;
public class H implements D
{
private static final Logger J = Logger.getLogger(H.class);
int O;
int D;
protected P M;
boolean I;
boolean F;
byte H;
K S;
K K;
protected final B N;
Channel Q;
com.jcumulus.server.rtmfp.b.B G;
short A;
boolean U;
int B;
int E;
Map L;
com.jcumulus.server.rtmfp.d.H R;
int P;
Map C;
Map T;
public H(int i, int j, byte abyte0[], byte abyte1[])
{
this(i, j, abyte0, abyte1, new P());
}
public H(int i, int j, byte abyte0[], byte abyte1[], P p)
{
N = new B();
G = new com.jcumulus.server.rtmfp.b.B();
A = 0;
U = false;
L = new HashMap();
P = 1;
C = new HashMap();
T = new HashMap();
H = 0;
F = false;
I = false;
O = i;
D = j;
M = p;
M.A(new ClientHandler());
S = new K(abyte0, com.jcumulus.server.rtmfp.K.Encryption.DECRYPT);
K = new K(abyte1, com.jcumulus.server.rtmfp.K.Encryption.ENCRYPT);
N.E(11);
N.C(com.jcumulus.server.rtmfp.N.G);
}
public I A(byte abyte0[])
{
I i = (I)T.get(abyte0);
if(i == null)
{
i = new I();
T.put(abyte0, i);
}
return i;
}
public void A(Channel channel, SocketAddress socketaddress)
{
Q = channel;
M.A(socketaddress);
}
public void A(AudioPacket a)
{
if(!com.jcumulus.server.rtmfp.N.A(S, a))
{
J.error((new StringBuilder()).append("Decrypt error on session ").append(O).toString());
return;
} else
{
B(a);
return;
}
}
protected void A(B b)
{
if(Q == null)
{
J.error((new StringBuilder()).append("Impossible to send on a null socket for session ").append(O).toString());
return;
}
B b1 = com.jcumulus.server.rtmfp.N.A(K, b);
if(b1 != null)
{
com.jcumulus.server.rtmfp.N.A(b1, D);
Q.write(b1.E(), M.L());
}
}
public boolean A(com.jcumulus.server.rtmfp.d.H h)
{
return R == h;
}
public void B(com.jcumulus.server.rtmfp.d.H h)
{
while(++P == 0 || C.get(Integer.valueOf(P)) != null) ;
h.B(P);
if(L.size() > 0)
h.C(((E[])L.values().toArray(new E[L.size()]))[0].D());
C.put(Integer.valueOf(P), h);
}
public com.jcumulus.server.rtmfp.g.B A(byte paramByte, int paramInt, com.jcumulus.server.rtmfp.d.H paramH)
{
if (this.U)
synchronized (this.N)
{
this.N.B(11);
this.N.C(this.N.C());
return this.N;
}
this.R = paramH;
int i = paramInt + 3;
if (i > this.N.D())
{
A(false);
if (i > this.N.D())
{
J.error("Message truncated because exceeds maximum UDP packet size on session " + this.O);
i = this.N.D();
}
this.R = null;
}
synchronized (this.N)
{
this.N.C(this.N.C() + i);
this.N.B(paramByte);
this.N.A((short)paramInt);
return this.N;
}
}
private void D()
{
if(F)
return;
B++;
synchronized(N)
{
N.B((byte)12);
N.A((short)0);
}
A(false);
if(B == 10 || G.A(0x15752a00L))
C();
}
private void A(String s)
{
if(U)
return;
synchronized(N)
{
N.B(11);
}
Integer integer;
for(Iterator iterator = C.keySet().iterator(); iterator.hasNext(); ((com.jcumulus.server.rtmfp.d.H)C.get(integer)).I())
integer = (Integer)iterator.next();
this.M.A((com.jcumulus.server.rtmfp.d.H)null);
this.M.J();
this.U = true;
if(!Strings.isNullOrEmpty(s))
{
J.warn((new StringBuilder()).append("Session failed id : ").append(s).toString());
M.E(s);
D();
}
}
public void C()
{
if(F)
return;
M.O();
M.C();
U = true;
M.A((com.jcumulus.server.rtmfp.d.H)null);
M.J();
E e;
for(Iterator iterator = L.values().iterator(); iterator.hasNext(); e.C())
e = (E)iterator.next();
L.clear();
com.jcumulus.server.rtmfp.d.H h;
for(Iterator iterator1 = C.values().iterator(); iterator1.hasNext(); h.F())
h = (com.jcumulus.server.rtmfp.d.H)iterator1.next();
C.clear();
F = true;
J.info((new StringBuilder()).append("Session ").append(O).append(" died").toString());
}
protected void B(AudioPacket a)
{
if(F)
return;
if(!U && M.K())
A("");
if(M.N().size() == 0)
{
J.error((new StringBuilder()).append("Session ").append(O).append(" has no any addresses!").toString());
M.N().add(M.L().toString());
}
G.A();
byte byte0 = (byte)(a.L() | 0xfffffff0);
A = a.E();
if(byte0 == -3)
{
short word0 = com.jcumulus.server.rtmfp.N.A(G.getTime());
short word1 = a.E();
M.A((short)(word1 <= word0 ? word0 - word1 : 0));
} else
if(byte0 != -7)
J.warn("Packet marker unknown : marker");
byte byte1 = 0;
E e = null;
int i = 0;
int j = 0;
byte byte2 = a.I() <= 0 ? -1 : a.L();
boolean flag = false;
do
{
if(byte2 == -1)
break;
short word2 = a.E();
AudioPacket a1 = new AudioPacket(a.G(), word2);
switch(byte2)
{
case 112: // 'p'
break;
case 12: // '\f'
A("failed on client side");
break;
case 76: // 'L'
C();
return;
case 1: // '\001'
if(!M.M())
A("Timeout connection client");
else
A((byte)65, 0, null);
// fall through
case 65: // 'A'
E = 0;
break;
case 94: // '^'
int k = a1.J();
com.jcumulus.server.rtmfp.d.H h = (com.jcumulus.server.rtmfp.d.H)C.get(Integer.valueOf(k));
if(h != null)
h.D((new StringBuilder()).append("FlowWriter rejected on session ").append(O).toString());
else
J.warn((new StringBuilder()).append("FlowWriter ").append(k).append(" unfound for failed signal on session ").append(O).toString());
break;
case 24: // '\030'
A("ack negative from server");
break;
case 81: // 'Q'
int l = a1.J();
com.jcumulus.server.rtmfp.d.H h1 = (com.jcumulus.server.rtmfp.d.H)C.get(Integer.valueOf(l));
if(h1 != null)
h1.A(a1);
else
J.warn((new StringBuilder()).append("FlowWriter ").append(l).append(" unfound for acknowledgment on session").append(O).toString());
break;
case 16: // '\020'
byte1 = a1.L();
int i1 = a1.J();
i = a1.J() - 1;
j = a1.J() - 1;
if(U)
break;
e = (E)L.get(Integer.valueOf(i1));
if((byte1 & com.jcumulus.server.rtmfp.d.E.N.intValue()) != 0)
{
byte abyte0[] = a1.F(a1.L() & 0xff);
if(e == null)
e = A(i1, abyte0);
if(a1.L() > 0)
{
if(a1.L() != 10)
J.warn((new StringBuilder()).append("Unknown fullduplex header part for the flow '").append(i1).append("'").toString());
else
a1.J();
byte byte3;
for(byte3 = a1.L(); byte3 > 0 && a1.I() > 0; byte3 = a1.L())
{
J.warn((new StringBuilder()).append("Unknown message part on flow '").append(i1).append("'").toString());
a1.D(byte3);
}
if(byte3 > 0)
J.error("Bad header message part, finished before scheduled");
}
}
if(e == null)
J.warn((new StringBuilder()).append("Flow ").append(i1).append(" unfound").toString());
// fall through
case 17: // '\021'
i++;
j++;
if(byte2 == 17)
byte1 = a1.L();
if(e == null)
break;
e.A(i, j, a1, byte1);
if(!Strings.isNullOrEmpty(e.G()) || M.K())
{
A(e.G());
e = null;
}
break;
default:
J.error((new StringBuilder()).append("Message type '").append(byte2).append("' unknown").toString());
break;
}
a.D(word2);
byte2 = a.I() <= 0 ? -1 : a.L();
if(e != null && byte2 != 17)
{
e.F();
if(e.B())
L.remove(Integer.valueOf(e.D()));
e = null;
}
} while(true);
A((byte)74, true);
}
private E A(int i, byte abyte0[])
{
if(F)
{
J.error((new StringBuilder()).append("Session ").append(i).append(" is died, no more Flow creation possible").toString());
return null;
}
Object obj = (E)L.get(Integer.valueOf(i));
if(obj != null)
{
J.warn((new StringBuilder()).append("Flow ").append(i).append(" has already been created").toString());
return ((E) (obj));
}
if(com.jcumulus.server.rtmfp.b.C.B(abyte0, com.jcumulus.server.rtmfp.d.F.S))
obj = new F(i, M, this);
else
if(com.jcumulus.server.rtmfp.b.C.B(abyte0, com.jcumulus.server.rtmfp.d.C.Q))
obj = new com.jcumulus.server.rtmfp.d.C(i, M, this);
else
if(com.jcumulus.server.rtmfp.b.C.A(com.jcumulus.server.rtmfp.d.A.Z, abyte0))
obj = new com.jcumulus.server.rtmfp.d.A(i, abyte0, M, this);
else
J.error((new StringBuilder()).append("New unknown flow '").append(Arrays.toString(abyte0)).append("' on session ").append(O).toString());
if(obj != null)
{
J.debug((new StringBuilder()).append("New flow ").append(i).append(" on session ").append(O).toString());
L.put(Integer.valueOf(i), obj);
}
return ((E) (obj));
}
public void A(boolean flag)
{
A((byte)74, flag);
}
protected void A(byte byte0, boolean flag)
{
R = null;
if(F)
return;
if(N.A() >= com.jcumulus.server.rtmfp.N.C)
{
if(G.A(0x1c9c380L))
flag = false;
byte byte1 = 0;
if(flag)
byte0 += 4;
else
byte1 = 2;
B b1;
synchronized(N)
{
b1 = N.F();
N.B(11);
N.C(com.jcumulus.server.rtmfp.N.G);
}
if(b1 != null)
{
b1.C(0);
b1.G(byte1);
b1.F(6);
b1.B(byte0);
b1.A(com.jcumulus.server.rtmfp.N.A());
if(flag)
b1.A((short)(A + com.jcumulus.server.rtmfp.N.A(G.B())));
A(b1);
}
}
}
public boolean A()
{
return U;
}
public B B()
{
N.C(com.jcumulus.server.rtmfp.N.G);
return N;
}
}
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;
}
}
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.b.C;
import com.jcumulus.server.rtmfp.e.H;
import com.jcumulus.server.rtmfp.g.A;
import com.jcumulus.server.rtmfp.g.B;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
// Referenced classes of package com.jcumulus.server.rtmfp.d:
// H, D, B
public class E
{
private static final Logger F = Logger.getLogger(E.class);
public static final Integer N = Integer.valueOf(128);
public static final Integer C = Integer.valueOf(16);
public static final Integer M = Integer.valueOf(32);
public static final Integer H = Integer.valueOf(2);
public static final Integer E = Integer.valueOf(1);
public static com.jcumulus.server.rtmfp.application.C I = new com.jcumulus.server.rtmfp.application.C();
protected int A;
private int J;
protected P K;
private boolean G;
private D D;
private com.jcumulus.server.rtmfp.d.D B;
protected com.jcumulus.server.rtmfp.d.H O;
private Map P;
private String L;
public E(int i, byte abyte0[], String s, P p, D d)
{
P = new HashMap();
A = i;
J = 0;
K = p;
G = false;
B = null;
D = d;
O = new com.jcumulus.server.rtmfp.d.H(abyte0, d);
O.C(i);
O.C(s);
}
public void C()
{
E();
O.C();
}
void E()
{
if(G)
return;
if(O.G() != null)
F.debug((new StringBuilder()).append("Flow ").append(A).append(" consumed").toString());
G = true;
}
protected void A(String s)
{
F.error((new StringBuilder()).append("Flow ").append(A).append(" failed : %s").append(s).toString());
if(!G)
{
B b = D.A((byte)94, com.jcumulus.server.rtmfp.b.C.A(A) + 1, null);
b.D(A);
b.B((byte)0);
}
}
private byte B(AudioPacket a)
{
if(a.I() == 0)
return 0;
byte byte0 = a.L();
switch(byte0)
{
case 17: // '\021'
a.D(1);
// fall through
case 20: // '\024'
a.D(4);
return 20;
case 15: // '\017'
a.D(5);
break;
case 4: // '\004'
a.D(4);
break;
case 2: // '\002'
case 3: // '\003'
case 5: // '\005'
case 6: // '\006'
case 7: // '\007'
case 10: // '\n'
case 11: // '\013'
case 12: // '\f'
case 13: // '\r'
case 14: // '\016'
case 16: // '\020'
case 18: // '\022'
case 19: // '\023'
default:
F.error((new StringBuilder()).append("Unpacking type '").append(byte0).append("' unknown").toString());
break;
case 1: // '\001'
case 8: // '\b'
case 9: // '\t'
break;
}
return byte0;
}
public void F()
{
int i = 0;
ArrayList arraylist = new ArrayList();
int j = J;
boolean flag = false;
Integer integer;
for(Iterator iterator = P.keySet().iterator(); iterator.hasNext();)
integer = (Integer)iterator.next();
int k = B == null ? 127 : B.B() <= 16128 ? 16128 - B.B() : 0;
if(O.G() == null)
k = 0;
B b = D.A((byte)81, com.jcumulus.server.rtmfp.b.C.A(A) + com.jcumulus.server.rtmfp.b.C.A(k) + com.jcumulus.server.rtmfp.b.C.A(J) + i, null);
b.D(A);
b.D(k);
b.D(J);
Integer integer1;
for(Iterator iterator1 = arraylist.iterator(); iterator1.hasNext(); b.D(integer1.intValue()))
integer1 = (Integer)iterator1.next();
A();
O.A();
}
public void A(int i, int j, AudioPacket a, byte byte0)
{
if(G)
return;
int k = J + 1;
if(i < k)
{
F.debug((new StringBuilder()).append("Stage ").append(i).append(" on flow ").append(A).append(" has already been received").toString());
return;
}
if(j > i)
{
F.warn((new StringBuilder()).append("DeltaNAck ").append(j).append(" superior to stage ").append(i).append(" on flow ").append(A).toString());
j = i;
}
if(J < i - j)
{
Iterator iterator = P.keySet().iterator();
do
{
if(!iterator.hasNext())
break;
Integer integer = (Integer)iterator.next();
if(integer.intValue() > i)
break;
AudioPacket a1 = ((com.jcumulus.server.rtmfp.d.B)P.get(integer)).B();
A(integer.intValue(), a1, ((com.jcumulus.server.rtmfp.d.B)P.get(integer)).A());
if(G)
return;
iterator.remove();
} while(true);
k = i;
}
if(i > k)
{
com.jcumulus.server.rtmfp.d.B b = (com.jcumulus.server.rtmfp.d.B)P.get(Integer.valueOf(i));
if(b == null)
{
P.put(Integer.valueOf(i), new com.jcumulus.server.rtmfp.d.B(a, byte0));
if(P.size() > 100)
F.debug((new StringBuilder()).append("fragmentMap.size()=").append(P.size()).toString());
} else
{
F.debug((new StringBuilder()).append("Stage ").append(i).append(" on flow ").append(A).append(" has already been received").toString());
}
} else
{
A(k++, a, byte0);
Iterator iterator1 = P.keySet().iterator();
do
{
if(!iterator1.hasNext())
break;
Integer integer1 = (Integer)iterator1.next();
if(integer1.intValue() > k)
break;
AudioPacket a2 = ((com.jcumulus.server.rtmfp.d.B)P.get(integer1)).B();
A(k++, a2, ((com.jcumulus.server.rtmfp.d.B)P.get(integer1)).A());
if(G)
break;
iterator1.remove();
} while(true);
}
}
void A(int i, AudioPacket a, byte byte0)
{
if(i <= J)
{
F.error((new StringBuilder()).append("Stage ").append(i).append(" not sorted on flow").append(A).toString());
return;
}
if(i > J + 1)
{
int j = i - J - 1;
J = i;
if(B != null)
B = null;
if((byte0 != 0) & (M != null))
{
A(j + 1);
return;
}
A(j);
} else
{
J = i;
}
if((byte0 & H.intValue()) != 0)
{
if(B != null)
B = null;
return;
}
if((byte0 & M.intValue()) != 0)
{
if(B == null)
{
F.warn("A received message tells to have a 'beforepart' and nevertheless partbuffer is empty, certainly some packets were lost");
A(1);
B = null;
return;
}
B.A(a);
if((byte0 & C.intValue()) != 0)
return;
a = B.A();
} else
if((byte0 & C.intValue()) != 0)
{
if(B != null)
{
F.error("A received message tells to have not 'beforepart' and nevertheless partbuffer exists");
A(B.B());
}
B = new com.jcumulus.server.rtmfp.d.D(a);
return;
}
byte byte1 = B(a);
if(byte1 != 0)
{
O.A(Double.valueOf(0.0D));
String s = null;
com.jcumulus.server.rtmfp.e.B b = new com.jcumulus.server.rtmfp.e.B(a);
if(byte1 == 20 || byte1 == 15)
{
s = b.E();
if(byte1 == 20)
{
O.A(b.N());
if(b.G() == com.jcumulus.server.rtmfp.e.H.Null)
b.P();
}
}
try
{
switch(byte1)
{
case 15: // '\017'
case 20: // '\024'
A(s, b);
break;
case 8: // '\b'
C(a);
break;
case 9: // '\t'
A(a);
break;
default:
A(byte1, a);
break;
}
}
catch(Exception exception)
{
F.error(exception.getMessage(), exception);
L = (new StringBuilder()).append("flow error, ").append(exception).toString();
}
}
O.A(Double.valueOf(0.0D));
if(B != null)
B = null;
if((byte0 & E.intValue()) != 0)
E();
}
protected void A(String s, com.jcumulus.server.rtmfp.e.B b)
{
F.error((new StringBuilder()).append("Message '").append(s).append("' unknown for flow ").append(A).toString());
}
protected void A(byte byte0, Packet a)
{
F.error((new StringBuilder()).append("Raw message unknown for flow ").append(A).toString());
}
protected void C(AudioPacket a)
{
F.error((new StringBuilder()).append("Audio packet untreated for flow ").append(A).toString());
}
protected void A(AudioPacket a)
{
F.error((new StringBuilder()).append("Video packet untreated for flow ").append(A).toString());
}
protected void A(int i)
{
F.info((new StringBuilder()).append(i).append(" fragments lost on flow").append(A).toString());
}
protected void A()
{
}
public boolean B()
{
return G;
}
public int D()
{
return A;
}
public String G()
{
return L;
}
}
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;
}
}
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.packet.*;
import com.jcumulus.server.rtmfp.b.C;
import com.jcumulus.server.rtmfp.application.F;
import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
// Referenced classes of package com.jcumulus.server.rtmfp.d:
// L, I, E, G,
// K, J
public class H
{
private static final Logger G = Logger.getLogger(H.class);
private static J S = new J();
private int J;
private boolean K;
private int C;
private byte I[];
private D H;
private boolean B;
private L A;
private final List P = new ArrayList();
private int N;
private final List O = new ArrayList();
private int L;
private int M;
private int D;
private int F;
private Double E;
private String R;
private int Q;
public H(byte abyte0[], D d)
{
A = new L();
K = false;
J = 0;
N = 0;
L = 0;
B = false;
E = Double.valueOf(0.0D);
Q = 0;
C = 0;
H = d;
I = abyte0;
F = 0;
M = 0;
D = 0;
d.B(this);
}
public com.jcumulus.server.rtmfp.application.D B()
{
return new com.jcumulus.server.rtmfp.application.D(I, H);
}
public F K()
{
return new F(I, H);
}
public void F()
{
B = true;
I();
}
public void D(String s)
{
G.warn((new StringBuilder()).append("FlowWriter ").append(J).append(" has failed : ").append(s).toString());
N = L = M = D = 0;
I();
if(B)
{
return;
} else
{
H.B(this);
return;
}
}
public void I()
{
}
public void C()
{
if(B)
return;
if(N > 0)
if(D() != 0);
B = true;
A();
}
protected com.jcumulus.server.rtmfp.e.A C(String s, String s1)
{
return A("_result", s, s1);
}
public com.jcumulus.server.rtmfp.e.A A(String s, String s1)
{
return A("onStatus", s, s1);
}
public com.jcumulus.server.rtmfp.e.A B(String s, String s1)
{
return A("_error", s, s1);
}
public void A(AudioPacket a)
{
int i = a.J();
if(i == 0)
{
G.error("Negative acknowledgment");
D("Negative acknowledgment");
return;
}
int j = L;
int k = a.J();
int l = L + 1;
if(k > N)
{
G.error((new StringBuilder()).append("Acknowledgment received ").append(k).append(" superior than the current sending stage ").append(N).append(" on flowWriter ").append(J).toString());
L = N;
} else
if(k <= L)
{
if(a.I() == 0)
G.debug((new StringBuilder()).append("Acknowledgment ").append(k).append(" obsolete on flowWriter ").append(J).toString());
} else
{
L = k;
}
int i1 = L;
int j1 = a.H();
while(a.I() > 0)
i1 += a.J() + a.J() + 2;
if(j1 != a.H())
a.E(j1);
int k1 = 0;
int l1 = 0;
boolean flag = false;
boolean flag1 = true;
boolean flag2 = false;
synchronized(O)
{
ListIterator listiterator = O.listIterator();
do
{
if(flag2 || !listiterator.hasNext())
break;
I i2 = (I)listiterator.next();
if(i2.B().size() == 0)
{
G.error((new StringBuilder()).append("Message ").append(l + 1).append(" is bad formatted on flowWriter ").append(J).toString());
} else
{
Integer ainteger[] = (Integer[])i2.B().keySet().toArray(new Integer[0]);
Integer integer = ainteger[0];
int j2 = 0;
do
{
if(j2 >= ainteger.length)
break;
if(L >= l)
{
i2.B().remove(ainteger[0]);
ainteger = (Integer[])i2.B().keySet().toArray(new Integer[0]);
j2 = 0;
if(j2 < ainteger.length)
integer = ainteger[j2];
D++;
l++;
continue;
}
do
{
if(flag2 || k1 != 0)
break;
if(k1 == 0)
if(a.I() > 0)
{
k1 = a.J() + 1;
l1 = k + 1;
k = l1 + k1 + a.J();
} else
{
flag2 = true;
break;
}
if(l1 > N)
{
G.error((new StringBuilder()).append("Lost information received ").append(l1).append(" have not been yet sent on flowWriter ").append(J).toString());
flag2 = true;
break;
}
if(l1 > L)
break;
k1--;
l1++;
} while(true);
if(flag2)
break;
if(l1 != l)
{
if(flag)
{
l++;
if(j2 < ainteger.length - 1)
{
j2++;
integer = ainteger[j2];
}
flag1 = true;
} else
{
L = l;
}
} else
if(!i2.A())
{
if(flag)
{
j2++;
integer = ainteger[j2];
l++;
flag1 = true;
} else
{
G.debug((new StringBuilder()).append("FlowWriter ").append(J).append(" : message ").append(l).append(" lost").toString());
D--;
M++;
L = l;
}
k1--;
l1++;
} else
{
flag = true;
if(((Integer)i2.B().get(integer)).intValue() >= i1 || k == l1 + 2)
{
l++;
flag1 = true;
k1--;
l1++;
if(j2 < ainteger.length - 1)
{
j2++;
integer = ainteger[j2];
}
} else
{
G.debug((new StringBuilder()).append("FlowWriter ").append(J).append(" : stage ").append(l).append(" repeated").toString());
int k2 = integer.intValue();
Packet b1 = i2.A(k2);
int i3 = b1.I();
i2.B().put(integer, Integer.valueOf(N));
int j3 = i3;
byte byte0 = 0;
if(k2 > 0)
byte0 |= com.jcumulus.server.rtmfp.d.E.M.intValue();
if(j2 < ainteger.length - 1)
{
j2++;
integer = ainteger[j2];
byte0 |= com.jcumulus.server.rtmfp.d.E.C.intValue();
j3 = integer.intValue() - k2;
}
com.jcumulus.server.rtmfp.g.B b2 = H.B();
int k3 = j3 + 4;
if(!flag1 && k3 > b2.D())
{
H.A(false);
flag1 = true;
}
if(flag1)
k3 += D(l);
if(k3 > b2.D())
H.A(false);
k3 -= 3;
A(H.A(((byte)(flag1 ? 16 : 17)), k3, null), l, byte0, flag1, b1, j3);
i3 -= j3;
flag1 = false;
k1--;
l1++;
l++;
}
}
} while(true);
if(i2.B().size() == 0)
{
if(i2.A())
F--;
if(D > 0)
{
Packet b = i2.D();
int l2 = b.I();
A(D, M, b, l2);
D = M = 0;
}
listiterator.remove();
}
}
} while(true);
}
if(k1 > 0 && a.I() > 0)
G.error((new StringBuilder()).append("Some lost information received have not been yet sent on flowWriter ").append(J).toString());
if(F == 0)
A.B();
else
if(L > j || flag)
A.A();
}
public void A(int i)
{
if(i >= D())
{
G.error((new StringBuilder()).append("Impossible to cancel ").append(i).append(" message on flowWriter ").append(J).toString());
return;
}
synchronized(P)
{
for(int j = i; j < P.size(); j++)
P.remove(i);
}
}
public void A(byte abyte0[], int i)
{
A(abyte0, i, ((byte []) (null)), 0);
}
public void A(byte abyte0[], int i, byte abyte1[], int j)
{
if(B || I == null || H.A())
return;
G g = new G(abyte0, i, abyte1, j);
synchronized(P)
{
P.add(g);
}
A();
}
private K H()
{
if(B || I == null || H.A())
return S;
K k = new K();
synchronized(P)
{
P.add(k);
}
return k;
}
public com.jcumulus.server.rtmfp.g.A A(boolean flag)
{
K k = H();
if(!flag)
{
k.E().B((byte)4);
k.E().A(0);
}
return k.E();
}
public com.jcumulus.server.rtmfp.e.F B(String s)
{
K k = H();
k.E().B((byte)15);
k.E().B((byte)0);
k.E().A(0);
k.F().A(s);
return k.F();
}
private void A(com.jcumulus.server.rtmfp.g.A a, String s, double d)
{
a.B((byte)20);
a.A(0);
a.B((byte)2);
a.D(s.getBytes());
a.B((byte)0);
a.A(d);
a.B((byte)5);
}
public com.jcumulus.server.rtmfp.e.F A(String s)
{
K k = H();
A(k.E(), s, 0.0D);
return k.F();
}
public com.jcumulus.server.rtmfp.e.F J()
{
K k = H();
A(k.E(), "_result", E.doubleValue());
return k.F();
}
com.jcumulus.server.rtmfp.e.A A(String s, String s1, String s2)
{
K k = H();
A(k.E(), s, E.doubleValue());
String s3 = R;
if(!Strings.isNullOrEmpty(s1))
{
s3 = (new StringBuilder()).append(s3).append(".").toString();
s3 = (new StringBuilder()).append(s3).append(s1).toString();
}
boolean flag = k.F().D();
k.F().B(true);
com.jcumulus.server.rtmfp.e.A a = new com.jcumulus.server.rtmfp.e.A(k.F());
if(s.equals("_error"))
a.A("level", "error");
else
a.A("level", "status");
a.A("code", s3);
if(!Strings.isNullOrEmpty(s2))
a.A("description", s2);
k.F().B(flag);
return a;
}
public void A()
{
B(false);
}
public void B(boolean flag)
{
boolean flag1 = !H.A(this);
synchronized(P)
{
for(Iterator iterator = P.iterator(); iterator.hasNext();)
{
I i = (I)iterator.next();
if(i.A())
{
F++;
A.C();
}
int j = 0;
Packet b = i.D();
int k = b.I();
do
{
com.jcumulus.server.rtmfp.g.B b1 = H.B();
if(b1.D() < 12)
{
H.A(false);
flag1 = true;
}
boolean flag2 = flag1;
int l = k;
int i1 = l + 4;
N++;
if(flag2)
i1 += D(N);
byte byte0 = 0;
if(j > 0)
byte0 |= com.jcumulus.server.rtmfp.d.E.M.intValue();
if(i1 > b1.D())
{
byte0 |= com.jcumulus.server.rtmfp.d.E.C.intValue();
l = b1.D() - (i1 - l);
i1 = b1.D();
flag1 = true;
} else
{
flag1 = false;
}
i1 -= 3;
A(H.A(((byte)(flag2 ? 16 : 17)), (short)i1, this), N, byte0, flag2, b, l);
i.B().put(Integer.valueOf(j), Integer.valueOf(N));
k -= l;
j += l;
} while(k > 0);
synchronized(O)
{
O.add(i);
}
}
P.clear();
}
if(flag)
H.A(true);
}
int D(int i)
{
int j = com.jcumulus.server.rtmfp.b.C.A(J);
j += com.jcumulus.server.rtmfp.b.C.A(i);
if(L > i)
G.error((new StringBuilder()).append("stageAck ").append(L).append(" superior to stage ").append(i).append(" on flowWriter ").append(J).toString());
j += com.jcumulus.server.rtmfp.b.C.A(i - L);
j += L <= 0 ? I.length + (C != 0 ? 4 + com.jcumulus.server.rtmfp.b.C.A(C) : 2) : 0;
return j;
}
public void A(com.jcumulus.server.rtmfp.g.B b, int i, byte byte0, boolean flag, Packet b1, int j)
{
if(L == 0 && flag)
byte0 |= com.jcumulus.server.rtmfp.d.E.N.intValue();
if(j == 0)
byte0 |= com.jcumulus.server.rtmfp.d.E.H.intValue();
if(B)
byte0 |= com.jcumulus.server.rtmfp.d.E.E.intValue();
G.debug((new StringBuilder()).append("FlowWriter ").append(J).append(" stage ").append(i).toString());
b.B(byte0);
if(flag)
{
b.D(J);
b.D(i);
b.D((byte0 & com.jcumulus.server.rtmfp.d.E.H.intValue()) == 0 ? i - L : 0);
if(L == 0)
{
b.C(I);
if(C > 0)
{
b.B((byte)(1 + com.jcumulus.server.rtmfp.b.C.A(C)));
b.B((byte)10);
b.D(C);
}
b.B((byte)0);
}
}
if(j > 0)
b.B(b1.F(j));
}
protected void A(int i, int j, Packet b, int k)
{
}
public int D()
{
synchronized (this.P)
{
return this.P.size();
}
}
public int E()
{
return J;
}
public void B(int i)
{
J = i;
}
public void C(int i)
{
C = i;
}
public void C(String s)
{
R = s;
}
public void A(Double double1)
{
E = double1;
}
public byte[] G()
{
return I;
}
}
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()
{
}
}
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.e.F;
import com.jcumulus.server.rtmfp.g.A;
// Referenced classes of package com.jcumulus.server.rtmfp.d:
// I
public class K extends I
{
public K()
{
super(true);
J = new A(G);
I = new F(J);
}
public F F()
{
return I;
}
public A E()
{
return J;
}
public int C()
{
return J.A();
}
private F I;
private A J;
}
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 L
{
public L()
{
}
public void C()
{
}
public void B()
{
}
public void A()
{
}
}
package com.jcumulus.server.rtmfp.e;
/**
* 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;
public class A
{
public A(F f)
{
A = f;
f.C();
}
public void A(String s)
{
A.C(s);
}
public void A(String s, B b)
{
A.A(s, b);
}
public void A(E e)
{
A.A(e);
}
public void A(String s, int i)
{
A.A(s, Integer.valueOf(i));
}
public void A(String s, double d)
{
A.A(s, Double.valueOf(d));
}
public void A(String s, String s1)
{
A.A(s, s1);
}
public void A(String s, byte abyte0[])
{
A.A(s, abyte0);
}
public void A()
{
A.B();
}
private F A;
}
package com.jcumulus.server.rtmfp.e;
/**
* 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.E;
import com.google.common.base.Strings;
import java.util.LinkedList;
import org.apache.log4j.Logger;
public class B
{
private static final Logger D = Logger.getLogger(E.class);
private Packet F;
boolean C;
int E;
int K;
int J;
LinkedList A;
LinkedList H;
LinkedList B;
LinkedList I;
LinkedList G;
public B(AudioPacket a)
{
A = new LinkedList();
H = new LinkedList();
B = new LinkedList();
I = new LinkedList();
G = new LinkedList();
F = a;
}
public void K()
{
C = true;
}
public void C()
{
C = false;
}
public String E()
{
A();
H h = G();
if(h == com.jcumulus.server.rtmfp.e.H.Null)
{
F.D(1);
return "";
}
if(h != com.jcumulus.server.rtmfp.e.H.String)
{
D.error((new StringBuilder()).append("Type ").append(h).append(" is not a AMF String type").toString());
return null;
}
F.D(1);
if(E != 0)
return J();
if(F() == 12)
return new String(F.F(F.C()));
else
return new String(F.F(F.E() & 0xffff));
}
public void P()
{
A();
H h = G();
if(h == com.jcumulus.server.rtmfp.e.H.Null)
{
F.D(1);
return;
} else
{
D.error((new StringBuilder()).append("Type ").append(h).append(" is not a AMF Null type").toString());
return;
}
}
public Double N()
{
A();
H h = G();
if(h == com.jcumulus.server.rtmfp.e.H.Null)
{
F.D(1);
return Double.valueOf(0.0D);
}
if(h != com.jcumulus.server.rtmfp.e.H.Number)
{
D.error((new StringBuilder()).append("Type ").append(h).append(" is not a AMF Number type").toString());
return Double.valueOf(0.0D);
} else
{
F.D(1);
return Double.valueOf(F.B());
}
}
private int H()
{
A();
H h = G();
if(h == com.jcumulus.server.rtmfp.e.H.Null)
{
F.D(1);
return 0;
}
if(h != com.jcumulus.server.rtmfp.e.H.Integer && h != com.jcumulus.server.rtmfp.e.H.Number)
{
D.error((new StringBuilder()).append("Type ").append(h).append(" is not a AMF Integer type").toString());
return 0;
}
F.D(1);
if(h == com.jcumulus.server.rtmfp.e.H.Number)
return (int)F.B();
int i = F.J();
if(i > 0xfffffff)
i -= 0x20000000;
return i;
}
public boolean O()
{
A();
H h = G();
if(h == com.jcumulus.server.rtmfp.e.H.Null)
{
F.D(1);
return false;
}
if(h != com.jcumulus.server.rtmfp.e.H.Boolean)
{
D.error((new StringBuilder()).append("Type ").append(h).append(" is not a AMF Boolean type").toString());
return false;
}
if(E != 0)
{
return F.L() != 2;
} else
{
F.D(1);
return F.L() != 0;
}
}
private C D()
{
A();
C c = new C();
H h = G();
if(h == com.jcumulus.server.rtmfp.e.H.Null)
{
F.D(1);
c.A(false);
return c;
}
if(h != com.jcumulus.server.rtmfp.e.H.Object)
{
D.error((new StringBuilder()).append("Type ").append(h).append(" is not a AMF Object type").toString());
c.A(false);
return c;
}
if(E == 0)
{
if(C)
I.push(Integer.valueOf(F.H()));
if(F() == 16)
{
F.D(1);
c.A(J());
} else
{
F.D(1);
}
D d = new D(E);
A.push(d);
if(J != 0)
d.B = J;
d.E = true;
c.A(true);
return c;
}
F.D(1);
int i = F.H();
int j = F.J();
boolean flag = (j & 1) != 0;
j >>= 1;
if(!flag && j > B.size())
{
D.error("AMF3 reference not found");
c.A(false);
return c;
}
D d1 = new D(E);
A.push(d1);
if(flag)
{
if(C)
B.push(Integer.valueOf(i));
} else
{
d1.B = F.H();
F.E(((Integer)B.get(j)).intValue());
j = F.J() >> 1;
}
flag = (j & 1) != 0;
j >>= 1;
if(flag)
{
G.push(Integer.valueOf(i));
c.A(J());
} else
if(j <= G.size())
{
K = F.H();
F.E(((Integer)G.get(j)).intValue());
j = F.J() >> 2;
c.A(J());
} else
{
D.error("AMF3 classDef reference not found");
j = 2;
}
if((j & 1) != 0)
d1.C = true;
else
if((j & 2) != 0)
d1.E = true;
j >>= 2;
if(!d1.C)
{
d1.F = new LinkedList();
for(int k = 0; k < j; k++)
{
String s = J();
d1.F.add(s);
}
}
A();
c.A(true);
return c;
}
private G I()
{
G g = new G();
A();
if(A.size() == 0)
{
D.error("AMFReader::readItem called without a AMFReader::readObject or a AMFReader::readArray before");
g.A(com.jcumulus.server.rtmfp.e.H.End);
return g;
}
D d = (D)A.getLast();
E = d.D;
boolean flag = false;
if(d.G == 17)
{
D.error("AMFReader::readItem on a dictionary, used AMFReader::readKey and AMFReader::readValue rather");
g.A(com.jcumulus.server.rtmfp.e.H.End);
return g;
}
if(d.F.size() > 0)
{
g.A((String)d.F.getFirst());
d.F.removeFirst();
} else
if(d.G == 10)
{
if(d.A == 0)
{
flag = true;
} else
{
d.A--;
g.A("");
}
} else
if(!d.E)
{
if(d.C)
{
d.C = false;
g.A(com.jcumulus.server.rtmfp.e.H.RawObjectContent);
return g;
}
flag = true;
} else
{
String s = J();
g.A(s);
if(Strings.isNullOrEmpty(s))
{
if(d.G == 9)
{
d.G = 10;
return I();
}
flag = true;
} else
if(d.G == 0);
}
if(flag)
{
if(E == 0 && d.G != 10)
{
byte byte0 = F.L();
if(byte0 != 9)
D.error("AMF0 end marker object absent");
}
K = d.B;
A();
A.removeLast();
g.A(com.jcumulus.server.rtmfp.e.H.End);
return g;
} else
{
g.A(G());
return g;
}
}
private String J()
{
if(E == 0)
return new String(F.A());
int i = F.H();
int j = F.J();
boolean flag = (j & 1) != 0;
j >>= 1;
String s;
if(flag)
{
s = new String(F.F(j));
if(!Strings.isNullOrEmpty(s))
H.push(Integer.valueOf(i));
} else
{
if(j > H.size())
{
D.error("AMF3 string reference not found");
return null;
}
K = F.H();
F.E(((Integer)H.get(j)).intValue());
s = new String(F.F(F.J() >> 1));
A();
}
return s;
}
public H G()
{
A();
if(E != F.H())
if(A.size() > 0)
E = ((D)A.getLast()).D;
else
E = 0;
if(!B())
return com.jcumulus.server.rtmfp.e.H.End;
byte byte0 = F();
if(E == 0 && byte0 == 17)
{
F.D(1);
E = F.H();
if(!B())
return com.jcumulus.server.rtmfp.e.H.End;
byte0 = F();
}
if(E != 0)
{
switch(byte0)
{
case 0: // '\0'
case 1: // '\001'
return com.jcumulus.server.rtmfp.e.H.Null;
case 2: // '\002'
case 3: // '\003'
return com.jcumulus.server.rtmfp.e.H.Boolean;
case 4: // '\004'
return com.jcumulus.server.rtmfp.e.H.Integer;
case 5: // '\005'
return com.jcumulus.server.rtmfp.e.H.Number;
case 6: // '\006'
return com.jcumulus.server.rtmfp.e.H.String;
case 8: // '\b'
return com.jcumulus.server.rtmfp.e.H.Date;
case 9: // '\t'
return com.jcumulus.server.rtmfp.e.H.Array;
case 17: // '\021'
return com.jcumulus.server.rtmfp.e.H.Dictionary;
case 10: // '\n'
return com.jcumulus.server.rtmfp.e.H.Object;
case 12: // '\f'
return com.jcumulus.server.rtmfp.e.H.ByteArray;
case 7: // '\007'
case 11: // '\013'
case 13: // '\r'
case 14: // '\016'
case 15: // '\017'
case 16: // '\020'
default:
D.error((new StringBuilder()).append("Unknown AMF3 type ").append(byte0).toString());
break;
}
F.D(1);
return G();
}
switch(byte0)
{
case 5: // '\005'
case 6: // '\006'
return com.jcumulus.server.rtmfp.e.H.Null;
case 1: // '\001'
return com.jcumulus.server.rtmfp.e.H.Boolean;
case 0: // '\0'
return com.jcumulus.server.rtmfp.e.H.Number;
case 2: // '\002'
case 12: // '\f'
return com.jcumulus.server.rtmfp.e.H.String;
case 8: // '\b'
case 10: // '\n'
return com.jcumulus.server.rtmfp.e.H.Array;
case 11: // '\013'
return com.jcumulus.server.rtmfp.e.H.Date;
case 3: // '\003'
case 16: // '\020'
return com.jcumulus.server.rtmfp.e.H.Object;
case 7: // '\007'
F.D(1);
short word0 = F.E();
if(word0 > I.size())
{
D.error("AMF0 reference not found");
return G();
} else
{
J = F.H();
F.E(((Integer)I.get(word0)).intValue());
return G();
}
case 9: // '\t'
D.error("AMF end object type without begin object type before");
F.D(1);
return G();
case 13: // '\r'
D.warn("Unsupported type in AMF format");
F.D(1);
return G();
case 4: // '\004'
case 14: // '\016'
case 15: // '\017'
default:
D.error((new StringBuilder()).append("Unknown AMF type ").append(byte0).toString());
F.D(1);
return G();
}
}
public com.jcumulus.server.rtmfp.e.E L()
{
com.jcumulus.server.rtmfp.e.E e = new com.jcumulus.server.rtmfp.e.E();
C c = D();
if(!c.A())
return null;
if(!Strings.isNullOrEmpty(c.C()))
D.warn((new StringBuilder()).append("Object seems not be a simple object because it has a ").append(c.C()).append(" type").toString());
do
{
G g;
if((g = I()).B() == com.jcumulus.server.rtmfp.e.H.End)
break;
String s = g.A();
if(com.jcumulus.server.rtmfp.e.H.Null == g.B())
{
P();
e.G(s);
continue;
}
if(com.jcumulus.server.rtmfp.e.H.Boolean == g.B())
{
e.A(s, O());
continue;
}
if(com.jcumulus.server.rtmfp.e.H.Integer == g.B())
{
e.A(s, H());
continue;
}
if(com.jcumulus.server.rtmfp.e.H.String == g.B())
{
String s1 = E();
e.B(s, s1);
continue;
}
if(com.jcumulus.server.rtmfp.e.H.Number == g.B())
{
e.A(s, N().doubleValue());
continue;
}
if(com.jcumulus.server.rtmfp.e.H.Date == g.B())
break;
D.error((new StringBuilder()).append("AMF ").append(g.B()).append(" type unsupported in an AMFDataObj conversion").toString());
F.D(1);
} while(true);
return e;
}
private byte F()
{
return F.G()[0];
}
public boolean B()
{
A();
return F.I() > 0;
}
private void A()
{
if(K > 0)
{
F.E(K);
K = 0;
}
}
public Packet M()
{
return F;
}
}
package com.jcumulus.server.rtmfp.e;
/**
* 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 C
{
public C()
{
}
public boolean A()
{
return A;
}
public void A(boolean flag)
{
A = flag;
}
public String C()
{
return (String)B;
}
public H B()
{
return (H)B;
}
public void A(Object obj)
{
B = obj;
}
private boolean A;
private Object B;
}
package com.jcumulus.server.rtmfp.e;
/**
* 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.LinkedList;
public class D
{
public D(int i)
{
this(i, (byte)0);
}
public D(int i, byte byte0)
{
F = new LinkedList();
D = i;
B = 0;
E = false;
C = false;
A = 0;
G = byte0;
}
LinkedList F;
int B;
boolean E;
boolean C;
int A;
byte G;
int D;
}
package com.jcumulus.server.rtmfp.e;
/**
* 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.*;
public class E
{
public E()
{
C = new HashMap();
E = new HashMap();
B = new HashMap();
G = new HashMap();
D = new HashMap();
F = new HashMap();
A = new ArrayList();
H = new HashMap();
}
public void B(String s, String s1)
{
H.put(s, com.jcumulus.server.rtmfp.e.H.String);
C.put(s, s1);
}
public void A(String s, E e)
{
H.put(s, com.jcumulus.server.rtmfp.e.H.Object);
F.put(s, e);
}
public void A(String s, int i)
{
H.put(s, com.jcumulus.server.rtmfp.e.H.Integer);
E.put(s, Integer.valueOf(i));
}
public void A(String s, double d)
{
H.put(s, com.jcumulus.server.rtmfp.e.H.Number);
B.put(s, Double.valueOf(d));
}
public void A(String s, boolean flag)
{
H.put(s, com.jcumulus.server.rtmfp.e.H.Boolean);
G.put(s, Boolean.valueOf(flag));
}
public void A(String s, B b)
{
H.put(s, com.jcumulus.server.rtmfp.e.H.Date);
D.put(s, b);
}
public void G(String s)
{
H.put(s, com.jcumulus.server.rtmfp.e.H.Null);
A.add(s);
}
public boolean F(String s)
{
return H.containsKey(s);
}
public Map A()
{
return H;
}
public String H(String s)
{
return A(s, ((String) (null)));
}
public String A(String s, String s1)
{
String s2 = (String)C.get(s);
return s2 == null ? s1 : s2;
}
public Integer B(String s)
{
return A(s, ((Integer) (null)));
}
public Integer A(String s, Integer integer)
{
Integer integer1 = (Integer)E.get(s);
return integer1 == null ? integer : integer1;
}
public Double D(String s)
{
return A(s, ((Double) (null)));
}
public Double A(String s, Double double1)
{
Double double2 = (Double)B.get(s);
return double2 == null ? double1 : double2;
}
public B C(String s)
{
return B(s, ((B) (null)));
}
public B B(String s, B b)
{
B b1 = (B)D.get(s);
return b1 == null ? b : b1;
}
public Boolean A(String s)
{
return A(s, ((Boolean) (null)));
}
public Boolean A(String s, Boolean boolean1)
{
Boolean boolean2 = (Boolean)G.get(s);
return boolean2 == null ? boolean1 : boolean2;
}
public E E(String s)
{
return B(s, ((E) (null)));
}
public E B(String s, E e)
{
E e1 = (E)F.get(s);
return e1 == null ? e : e1;
}
private Map C;
private Map E;
private Map B;
private Map G;
private Map D;
private Map F;
private List A;
private Map H;
}
package com.jcumulus.server.rtmfp.e;
/**
* 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 com.jcumulus.server.rtmfp.g.A;
import com.google.common.base.Strings;
import java.util.*;
import org.apache.log4j.Logger;
// Referenced classes of package com.jcumulus.server.rtmfp.e:
// E, H
public class F
{
public F(A a)
{
C = new HashMap();
A = new ArrayList();
G = new LinkedList();
F = a;
}
public void A(String s)
{
H = Integer.valueOf(0);
if(Strings.isNullOrEmpty(s))
{
F.B(((byte)(E ? 1 : 6)));
return;
}
if(!E)
{
if(B)
{
if(s.length() > 65535)
{
F.B((byte)12);
F.A(s.length());
F.A(s);
} else
{
F.B((byte)2);
F.D(s.getBytes());
}
return;
}
F.B((byte)17);
}
F.B((byte)6);
E(s);
H = Integer.valueOf(A.size());
}
private void B(String s)
{
H = Integer.valueOf(0);
if(!E)
{
F.D(s.getBytes());
return;
} else
{
E(s);
return;
}
}
private void E(String s)
{
if(!Strings.isNullOrEmpty(s))
{
Integer integer = (Integer)C.get(s);
if(integer != null)
{
F.D(integer.intValue() << 1);
return;
}
C.put(s, Integer.valueOf(C.size()));
}
F.D(s.length() << 1 | 1);
F.A(s);
}
public void A()
{
H = Integer.valueOf(0);
F.B(((byte)(E ? 1 : 5)));
}
public void A(boolean flag)
{
H = Integer.valueOf(0);
if(!E)
{
F.B((byte)1);
F.B((byte)(flag ? 1 : 0));
} else
{
F.B(((byte)(flag ? 3 : 2)));
}
}
public void A(B b)
{
H = Integer.valueOf(0);
if(!E)
{
if(B)
{
F.B((byte)11);
F.A((double)b.getTime() / 1000D);
F.A((short)0);
return;
}
F.B((byte)17);
}
F.B((byte)8);
F.B((byte)1);
F.A((double)b.getTime() / 1000D);
A.add(Integer.valueOf(8));
H = Integer.valueOf(A.size());
}
public void A(double d)
{
H = Integer.valueOf(0);
F.B(((byte)(E ? 5 : 0)));
F.A(d);
}
public void A(int i)
{
H = Integer.valueOf(0);
if(!E)
{
if(B)
{
A(i);
return;
}
F.B((byte)17);
}
F.B((byte)4);
if(i > 0xfffffff)
{
D.error("AMF Integer maximum value reached");
i = 0xfffffff;
} else
if(i < 0)
i += 0x20000000;
F.D(i);
}
private A B(int i)
{
H = Integer.valueOf(0);
if(!E)
F.B((byte)17);
F.B((byte)12);
F.D(i << 1 | 1);
A.add(Integer.valueOf(12));
H = Integer.valueOf(A.size());
return F;
}
public void A(byte abyte0[], int i)
{
A a = B(i);
a.A(abyte0, i);
}
void A(String s, Integer integer)
{
B(s);
if(integer != null)
A(integer.intValue());
else
A();
}
void A(String s, Double double1)
{
B(s);
if(double1 != null)
A(double1.doubleValue());
else
A();
}
void A(String s, String s1)
{
B(s);
if(s1 != null)
A(s1);
else
A();
}
void A(String s, B b)
{
B(s);
if(b != null)
A(b);
else
A();
}
void A(String s, Boolean boolean1)
{
B(s);
if(boolean1 != null)
A(boolean1.booleanValue());
else
A();
}
void A(String s, byte abyte0[])
{
B(s);
if(abyte0 != null)
A(abyte0, abyte0.length);
else
A();
}
void A(String s, E e)
{
B(s);
if(e != null)
A(e);
else
A();
}
void C(String s)
{
B(s);
A();
}
void C()
{
A("", false);
}
void D(String s)
{
A(s, false);
}
void A(String s, boolean flag)
{
H = Integer.valueOf(0);
if(!E)
{
if(B && !flag)
{
G.push(Integer.valueOf(0));
if(Strings.isNullOrEmpty(s))
{
F.B((byte)3);
} else
{
F.B((byte)16);
A(s);
}
return;
}
F.B((byte)17);
E = true;
}
F.B((byte)10);
A.add(Integer.valueOf(10));
H = Integer.valueOf(A.size());
G.push(H);
int i = 1;
i |= 2;
if(flag)
i |= 4;
else
i |= 8;
F.D(i);
B(s);
}
void B()
{
if(G.size() == 0)
{
D.error("AMFWriter.endObject called without beginObject calling");
return;
}
H = (Integer)G.pollLast();
if(!E)
{
F.A((short)0);
F.B((byte)9);
return;
}
F.B((byte)1);
if(G.size() == 0 || ((Integer)G.getLast()).intValue() == 0)
E = false;
}
public void A(Object obj)
{
if(obj == null)
A();
else
if(obj instanceof E)
A((E)obj);
else
if(obj instanceof Integer)
A(((Integer)obj).intValue());
else
if(obj instanceof String)
A((String)obj);
else
if(obj instanceof Number)
A(((Number)obj).doubleValue());
else
if(obj instanceof B)
A((B)obj);
else
A(obj.toString());
}
public void A(E e)
{
C();
Map map = e.A();
for(Iterator iterator = map.keySet().iterator(); iterator.hasNext();)
{
String s = (String)iterator.next();
H h = (H)map.get(s);
if(com.jcumulus.server.rtmfp.e.H.Boolean == h)
A(s, e.A(s));
else
if(com.jcumulus.server.rtmfp.e.H.String == h)
A(s, e.H(s));
else
if(com.jcumulus.server.rtmfp.e.H.Number == h)
A(s, e.D(s));
else
if(com.jcumulus.server.rtmfp.e.H.Integer == h)
A(s, e.B(s));
else
if(com.jcumulus.server.rtmfp.e.H.Date == h)
A(s, e.C(s));
else
if(com.jcumulus.server.rtmfp.e.H.Null == h)
C(s);
else
if(com.jcumulus.server.rtmfp.e.H.Object == h)
A(s, e.E(s));
else
D.error((new StringBuilder()).append("Unknown AMFObject '").append(h).append("' type").toString());
}
B();
}
public boolean D()
{
return B;
}
public void B(boolean flag)
{
B = flag;
}
public A E()
{
return F;
}
private static final Logger D = Logger.getLogger(F.class);
A F;
Integer H;
boolean B;
Map C;
List A;
LinkedList G;
boolean E;
}
package com.jcumulus.server.rtmfp.e;
/**
* 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
{
public G()
{
}
public String A()
{
return A;
}
public void A(String s)
{
A = s;
}
public H B()
{
return B;
}
public void A(H h)
{
B = h;
}
private String A;
private H B;
}
package com.jcumulus.server.rtmfp.e;
/**
* 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 enum H
{
Null, Boolean, Integer, Number, String, Date, Array, Object, ByteArray, Dictionary, RawObjectContent, End;
public static final byte m = 5;
public static final byte n = 6;
public static final byte D = 13;
public static final byte b = 17;
public static final byte V = 0;
public static final byte F = 1;
public static final byte i = 2;
public static final byte X = 11;
public static final byte N = 3;
public static final byte M = 16;
public static final byte B = 9;
public static final byte Z = 7;
public static final byte K = 8;
public static final byte O = 10;
public static final byte W = 12;
public static final byte _ = 0;
public static final byte g = 1;
public static final byte h = 2;
public static final byte a = 3;
public static final byte S = 4;
public static final byte A = 5;
public static final byte L = 6;
public static final byte Q = 8;
public static final byte G = 9;
public static final byte f = 10;
public static final byte I = 12;
public static final byte P = 17;
public static final byte T = -1;
}
package com.jcumulus.server.rtmfp.g;
/**
* 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 java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.apache.log4j.Logger;
public class A
{
private static final Logger C = Logger.getLogger(A.class);
protected byte E[];
private int A;
protected int D;
protected int B;
public A(byte abyte0[])
{
E = abyte0;
A = 0;
D = 0;
B = abyte0.length;
}
private void A(byte byte0)
{
if(A < B)
{
E[A] = byte0;
A++;
if(A > D)
D = A;
} else
{
C.warn("Limit is exceeded");
try
{
throw new Exception();
}
catch(Exception exception)
{
C.error("Trace - ", exception);
}
}
}
public void B(int i)
{
A = i;
D = i;
}
public int D()
{
return B - A;
}
public void E(int i)
{
A += i;
if(A > B)
{
A = B;
D = B;
} else
if(A > D)
D = A;
}
public void F(int i)
{
if(i <= D)
A = i;
}
public int C()
{
return A;
}
public void C(int i)
{
if(i == 0)
B = E.length;
else
if(i > E.length)
{
C.warn((new StringBuilder()).append("Limit '").append(i).append("' more upper than buffer size '").append(E.length).append("' bytes").toString());
B = E.length;
} else
{
B = i;
}
}
public void G(int i)
{
D -= i;
byte abyte0[] = Arrays.copyOfRange(E, i, E.length);
E = new byte[E.length];
System.arraycopy(abyte0, 0, E, 0, abyte0.length);
}
private void A(int i, int j)
{
byte abyte0[] = BigInteger.valueOf(i).toByteArray();
for(int k = 0; k < j - abyte0.length; k++)
A((byte)0);
byte abyte1[] = abyte0;
int l = abyte1.length;
for(int i1 = 0; i1 < l; i1++)
{
byte byte0 = abyte1[i1];
A(byte0);
}
}
public void A(double d)
{
byte abyte0[] = new byte[8];
ByteBuffer.wrap(abyte0).putDouble(d);
B(abyte0);
}
public void B(byte byte0)
{
A(byte0);
}
public void A(byte abyte0[])
{
A((byte)abyte0.length);
B(abyte0);
}
public void A(short word0)
{
A(word0, 2);
}
public void A(int i)
{
A(i, 4);
}
public void C(byte abyte0[])
{
B((byte)abyte0.length);
byte abyte1[] = abyte0;
int i = abyte1.length;
for(int j = 0; j < i; j++)
{
byte byte0 = abyte1[j];
A(byte0);
}
}
public void D(byte abyte0[])
{
A((short)abyte0.length);
byte abyte1[] = abyte0;
int i = abyte1.length;
for(int j = 0; j < i; j++)
{
byte byte0 = abyte1[j];
A(byte0);
}
}
public void A(byte byte0, int i)
{
for(int j = 0; j < i; j++)
A(byte0);
}
public void A(byte abyte0[], int i)
{
for(int j = 0; j < i; j++)
A(abyte0[j]);
}
public void A(String s)
{
byte abyte0[] = s.getBytes();
int i = abyte0.length;
for(int j = 0; j < i; j++)
{
Byte byte1 = Byte.valueOf(abyte0[j]);
A(byte1.byteValue());
}
}
public void B(byte abyte0[])
{
byte abyte1[] = abyte0;
int i = abyte1.length;
for(int j = 0; j < i; j++)
{
byte byte0 = abyte1[j];
A(byte0);
}
}
public void D(int i)
{
byte byte0 = com.jcumulus.server.rtmfp.b.C.A(i);
switch(byte0)
{
case 4: // '\004'
B((byte)(0x80 | i >> 22 & 0x7f));
B((byte)(0x80 | i >> 15 & 0x7f));
B((byte)(0x80 | i >> 8 & 0x7f));
B((byte)(i & 0xff));
break;
case 3: // '\003'
B((byte)(0x80 | i >> 14 & 0x7f));
B((byte)(0x80 | i >> 7 & 0x7f));
B((byte)(i & 0x7f));
break;
case 2: // '\002'
B((byte)(0x80 | i >> 7 & 0x7f));
B((byte)(i & 0x7f));
break;
default:
B((byte)(i & 0x7f));
break;
}
}
public int A()
{
return D;
}
public byte[] B()
{
return Arrays.copyOfRange(E, 0, D);
}
}
package com.jcumulus.server.rtmfp.g;
/**
* 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.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
public class B extends com.jcumulus.server.rtmfp.g.A implements Cloneable
{
public static final int F = 1215;
public B(byte abyte0[])
{
super(abyte0);
}
public B(byte abyte0[], int i)
{
super(abyte0);
D = i;
}
public B()
{
super(new byte[1215]);
}
public B F()
{
B b = new B((byte[])E.clone(), D);
b.C(B);
return b;
}
public ChannelBuffer E()
{
ChannelBuffer channelbuffer = ChannelBuffers.buffer(A());
channelbuffer.writeBytes(E, 0, A());
return channelbuffer;
}
public AudioPacket G()
{
return new AudioPacket(E, A());
}
public Object clone()
throws CloneNotSupportedException
{
return F();
}
}
package com.jcumulus.server.rtmfp.packet;
/**
* 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 AudioPacket extends Packet
{
public AudioPacket(byte abyte0[], int i)
{
super(abyte0, i);
E = 0;
}
public void G(int i)
{
E = i;
}
public int M()
{
return E;
}
public static final int F = 2048;
private int E;
}
package com.jcumulus.server.rtmfp.packet;
/**
* 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.nio.ByteBuffer;
import java.util.Arrays;
import org.apache.log4j.Logger;
public class Packet
{
private static final Logger B = Logger.getLogger(Packet.class);
public byte D[];
private int A;
private int C;
public Packet(byte abyte0[], int i)
{
D = abyte0;
C = i;
A = 0;
}
public void A(byte abyte0[], int i)
{
D = abyte0;
C = i;
A = 0;
}
public int J()
{
byte byte0 = 0;
byte byte1 = L();
int i = 0;
for(; (byte1 & 0x80) > 0 && byte0 < 3; byte0++)
{
i <<= 7;
i |= byte1 & 0x7f;
byte1 = L();
}
i <<= byte0 >= 3 ? 8 : 7;
i |= byte1;
return i;
}
public byte L()
{
byte byte0 = 0;
for(int i = 0; i < 1; i++)
{
byte0 <<= 8;
byte0 |= F();
}
return byte0;
}
public short E()
{
short word0 = 0;
for(int i = 0; i < 2; i++)
{
word0 <<= 8;
word0 |= F();
}
return word0;
}
public int C()
{
int i = 0;
for(int j = 0; j < 4; j++)
{
i <<= 8;
i |= F();
}
return i;
}
public double B()
{
return ByteBuffer.wrap(F(8)).getDouble();
}
public byte[] A()
{
return F(E() & 0xffff);
}
public byte[] F(int i)
{
byte abyte0[] = Arrays.copyOfRange(D, A, A + i);
A += i;
return abyte0;
}
private int F()
{
byte byte0 = D[A];
A++;
return byte0 & 0xff;
}
public byte K()
{
return D[A];
}
public int H()
{
return A;
}
public void E(int i)
{
A = i;
}
public void C(int i)
{
A -= i;
}
public void D(int i)
{
A += i;
}
public int D()
{
return C;
}
public int I()
{
return C - A;
}
public byte[] G()
{
return Arrays.copyOfRange(D, A, C);
}
public byte[] B(int i)
{
return Arrays.copyOfRange(D, A, A + i);
}
public void A(int i)
{
if(i > I())
{
B.warn((new StringBuilder()).append("rest ").append(i).append(" more upper than available ").append(I()).append(" bytes").toString());
i = I();
}
D = Arrays.copyOfRange(D, 0, A + i);
C = A + i;
}
}
...@@ -108,7 +108,8 @@ public class CallParticipant { ...@@ -108,7 +108,8 @@ public class CallParticipant {
private int secondPartyTimeout = 0; private int secondPartyTimeout = 0;
private String secondPartyTreatment = null; private String secondPartyTreatment = null;
private boolean secondPartyVoiceDetection = false; private boolean secondPartyVoiceDetection = false;
private String rtmfpSendStream = null;
private String rtmfpRecieveStream = null;
/** /**
* Constructor * Constructor
...@@ -191,6 +192,20 @@ public class CallParticipant { ...@@ -191,6 +192,20 @@ public class CallParticipant {
this.headers = headers; this.headers = headers;
} }
/**
* Get RTMFP send stream name
*/
public String getRtmfpSendStream() {
return rtmfpSendStream;
}
/**
* Get RTMFP recieve stream name
*/
public String getRtmfpRecieveStream() {
return rtmfpRecieveStream;
}
/** /**
* Get call answer timeout * Get call answer timeout
*/ */
...@@ -212,6 +227,20 @@ public class CallParticipant { ...@@ -212,6 +227,20 @@ public class CallParticipant {
return callEndTreatment; return callEndTreatment;
} }
/**
* Set RTMFP send stream name
*/
public void setRtmfpSendStream(String rtmfpSendStream) {
this.rtmfpSendStream = rtmfpSendStream;
}
/**
* Set RTMFP recieve stream name
*/
public void setRtmfpRecieveStream(String rtmfpRecieveStream) {
this.rtmfpRecieveStream = rtmfpRecieveStream;
}
/** /**
* Get audio treatment string for call established * Get audio treatment string for call established
*/ */
......
...@@ -451,7 +451,7 @@ public class ConferenceMember implements TreatmentDoneListener, ...@@ -451,7 +451,7 @@ public class ConferenceMember implements TreatmentDoneListener,
this.callHandler = callHandler; 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) { if (rtcpAddress != null) {
this.rtcpAddress = rtcpAddress; this.rtcpAddress = rtcpAddress;
......
...@@ -376,7 +376,7 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener { ...@@ -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); conferenceManager.getConferenceReceiver().addMember(this);
...@@ -870,7 +870,7 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener { ...@@ -870,7 +870,7 @@ public class MemberReceiver implements MixDataSource, TreatmentDoneListener {
private boolean callIsDead() { 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; return false;
} }
......
...@@ -57,6 +57,8 @@ import org.ifsoft.rtp.*; ...@@ -57,6 +57,8 @@ import org.ifsoft.rtp.*;
import org.jitsi.impl.neomedia.codec.audio.opus.Opus; import org.jitsi.impl.neomedia.codec.audio.opus.Opus;
import com.jcumulus.server.rtmfp.packet.AudioPacket;
/** /**
* Send RTP data to this ConferenceMember, * Send RTP data to this ConferenceMember,
*/ */
...@@ -102,6 +104,7 @@ public class MemberSender { ...@@ -102,6 +104,7 @@ public class MemberSender {
private DatagramChannel datagramChannel; private DatagramChannel datagramChannel;
private boolean initializationDone = false; private boolean initializationDone = false;
private RelayChannel relayChannel; private RelayChannel relayChannel;
private long startTime = 0;
public MemberSender(CallParticipant cp, DatagramChannel datagramChannel) throws IOException public MemberSender(CallParticipant cp, DatagramChannel datagramChannel) throws IOException
{ {
...@@ -141,6 +144,8 @@ public class MemberSender { ...@@ -141,6 +144,8 @@ public class MemberSender {
+ e.getMessage()); + e.getMessage());
} }
} }
startTime = System.currentTimeMillis();
} }
...@@ -355,8 +360,10 @@ public class MemberSender { ...@@ -355,8 +360,10 @@ public class MemberSender {
} }
if (getWebRTCParticipant() == null) if (getWebRTCParticipant() == null)
sendComfortNoisePayload(); {
else getWebRTCParticipant().sendComfortNoisePayload(); if (cp.getRtmfpSendStream() == null) sendComfortNoisePayload();
} else getWebRTCParticipant().sendComfortNoisePayload();
} }
} }
...@@ -444,20 +451,23 @@ public class MemberSender { ...@@ -444,20 +451,23 @@ public class MemberSender {
/* /*
* Convert to ulaw * Convert to ulaw
*/ */
AudioConversion.linearToUlaw(dataToSend, rtpData, AudioConversion.linearToUlaw(dataToSend, rtpData, RtpPacket.HEADER_SIZE);
RtpPacket.HEADER_SIZE);
senderPacket.setLength(rtpData.length);
//Util.dump("Call " + cp + " sending ulaw data " + rtpData.length, //Util.dump("Call " + cp + " sending ulaw data " + rtpData.length,
// rtpData, 0, 16); // rtpData, 0, 16);
} else if (myMediaInfo.getEncoding() == RtpPacket.SPEEX_ENCODING) { } else if (myMediaInfo.getEncoding() == RtpPacket.SPEEX_ENCODING) {
try { try {
if (Logger.logLevel >= Logger.LOG_MOREDETAIL) { if (Logger.logLevel >= Logger.LOG_MOREDETAIL) {
Logger.writeFile("Call " + cp + " speex encoding data "); Logger.writeFile("Call " + cp + " speex encoding data ");
} }
int length = speexEncoder.encode(dataToSend, rtpData, int length = speexEncoder.encode(dataToSend, rtpData, RtpPacket.HEADER_SIZE);
RtpPacket.HEADER_SIZE);
senderPacket.setLength(length + RtpPacket.HEADER_SIZE);
senderPacket.setLength(length + RtpPacket.HEADER_SIZE);
} catch (SpeexException e) { } catch (SpeexException e) {
Logger.println("Call " + this + ": " + e.getMessage()); Logger.println("Call " + this + ": " + e.getMessage());
return false; return false;
...@@ -508,25 +518,41 @@ public class MemberSender { ...@@ -508,25 +518,41 @@ public class MemberSender {
if (getWebRTCParticipant() == null) if (getWebRTCParticipant() == null)
{ {
if (cp.getInputTreatment() == null) { if (cp.getRtmfpSendStream() != null) // RTMFP
try { {
senderPacket.setSocketAddress(memberAddress); if (RtmfpCallAgent.publishHandlers.containsKey(cp.getRtmfpSendStream()) )
{
int ts = (int)(System.currentTimeMillis() - startTime);
datagramChannel.send(ByteBuffer.wrap(senderPacket.getData(), 0, senderPacket.getLength()), memberAddress); byte[] rtmfp = new byte[rtpData.length + 1 - RtpPacket.HEADER_SIZE];
rtmfp[0] = (byte) 130;
System.arraycopy(rtpData, RtpPacket.HEADER_SIZE, rtmfp, 1, rtmfp.length - 1);
if (Logger.logLevel >= Logger.LOG_MOREDETAIL) { RtmfpCallAgent.publishHandlers.get(cp.getRtmfpSendStream()).B(ts, new AudioPacket(rtmfp, rtmfp.length), 0);
Logger.writeFile("Call " + cp + " back from sending data"); }
}
} catch (Exception e) { } else { // SIP
if (!done) {
Logger.error("Call " + cp + " sendData " + e.getMessage()); if (cp.getInputTreatment() == null) {
e.printStackTrace(); try {
senderPacket.setSocketAddress(memberAddress);
datagramChannel.send(ByteBuffer.wrap(senderPacket.getData(), 0, senderPacket.getLength()), memberAddress);
if (Logger.logLevel >= Logger.LOG_MOREDETAIL) {
Logger.writeFile("Call " + cp + " back from sending data");
}
} catch (Exception e) {
if (!done) {
Logger.error("Call " + cp + " sendData " + e.getMessage());
e.printStackTrace();
}
return false;
} }
return false;
} }
} }
} else { } else { // WebRTC
try { try {
...@@ -539,7 +565,6 @@ public class MemberSender { ...@@ -539,7 +565,6 @@ public class MemberSender {
} }
senderPacket.setBuffer(rtpData); senderPacket.setBuffer(rtpData);
senderPacket.setLength(rtpData.length);
if (Logger.logLevel >= Logger.LOG_DEBUG) { if (Logger.logLevel >= Logger.LOG_DEBUG) {
log(true); log(true);
...@@ -557,7 +582,7 @@ public class MemberSender { ...@@ -557,7 +582,7 @@ public class MemberSender {
return true; return true;
} }
private int[] normalize(int[] audio) public static int[] normalize(int[] audio)
{ {
int length = audio.length; int length = audio.length;
// Scan for max peak value here // Scan for max peak value here
......
...@@ -142,7 +142,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene ...@@ -142,7 +142,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene
placeCall(); // no gateway involved, direct SIP call placeCall(); // no gateway involved, direct SIP call
} else if (cp.getProtocol() != null && cp.getProtocol().equalsIgnoreCase("WebRtc")) { } else if (cp.getProtocol() != null && ("WebRtc".equals(cp.getProtocol()) || "Rtmfp".equals(cp.getProtocol()))) {
placeCall(); // WebRtc call placeCall(); // WebRtc call
...@@ -172,6 +172,8 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene ...@@ -172,6 +172,8 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene
csa = new NSOutgoingCallAgent(this); csa = new NSOutgoingCallAgent(this);
} else if (protocol.equalsIgnoreCase("WebRtc")) { } else if (protocol.equalsIgnoreCase("WebRtc")) {
csa = new WebRtcCallAgent(this); csa = new WebRtcCallAgent(this);
} else if (protocol.equalsIgnoreCase("Rtmfp")) {
csa = new RtmfpCallAgent(this);
} else { } else {
//csa = new H323TPCCallAgent(this); //csa = new H323TPCCallAgent(this);
reasonCallEnded = reasonCallEnded =
...@@ -478,7 +480,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene ...@@ -478,7 +480,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene
protocol = cp.getProtocol(); protocol = cp.getProtocol();
} }
if (protocol.equalsIgnoreCase("WebRtc")) { if (protocol.equalsIgnoreCase("WebRtc") || protocol.equalsIgnoreCase("Rtmfp")) {
return true; return true;
} }
...@@ -502,7 +504,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene ...@@ -502,7 +504,7 @@ public class OutgoingCallHandler extends CallHandler implements CallEventListene
public boolean waitForCallToBeEstablished() { public boolean waitForCallToBeEstablished() {
if (cp.getProtocol().equalsIgnoreCase("WebRtc")) { if (cp.getProtocol().equalsIgnoreCase("WebRtc") || cp.getProtocol().equalsIgnoreCase("Rtmfp")) {
return true; return true;
} }
......
/*
* Copyright 2007 Sun Microsystems, Inc.
*
* This file is part of jVoiceBridge.
*
* jVoiceBridge is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation and distributed hereunder
* to you.
*
* jVoiceBridge 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Sun designates this particular file as subject to the "Classpath"
* exception as provided by Sun in the License file that accompanied this
* code.
*/
package com.sun.voip.server;
import com.sun.voip.CallParticipant;
import com.sun.voip.CallState;
import com.sun.voip.Logger;
import com.sun.voip.MediaInfo;
import java.io.IOException;
import java.util.*;
import com.jcumulus.server.rtmfp.application.Publication;
import com.sun.voip.server.*;
import com.sun.voip.*;
public class RtmfpCallAgent extends CallSetupAgent
{
private CallParticipant cp;
private MemberReceiver memberReceiver;
private MemberSender memberSender;
private MediaInfo mixerMediaPreference;
public static Map<String, Publication> publishHandlers = Collections.synchronizedMap( new HashMap<String, Publication>());
public static Map<String, MemberReceiver> playHandlers = Collections.synchronizedMap( new HashMap<String, MemberReceiver>());
public RtmfpCallAgent(CallHandler callHandler)
{
super(callHandler);
cp = callHandler.getCallParticipant();
mixerMediaPreference = callHandler.getConferenceManager().getMediaInfo();
memberSender = callHandler.getMemberSender();
memberReceiver = callHandler.getMemberReceiver();
playHandlers.put(cp.getRtmfpRecieveStream(), memberReceiver); // we need later media arrives from flash
callHandler.setEndpointAddress(null, (byte) (0), (byte)0, (byte)0);
}
public void initiateCall() throws IOException
{
try {
setState(CallState.ESTABLISHED);
} catch (Exception e) {
Logger.println("Call " + cp + ": RtmfpCallAgent: initiateCall exception " + e);
e.printStackTrace();
}
}
public String getSdp()
{
return null;
}
public void setRemoteMediaInfo(String sdp)
{
return;
}
public void terminateCall()
{
playHandlers.remove(cp.getRtmfpRecieveStream());
}
}
...@@ -50,9 +50,9 @@ import org.xmpp.jnodes.nio.LocalIPResolver; ...@@ -50,9 +50,9 @@ import org.xmpp.jnodes.nio.LocalIPResolver;
import org.xmpp.packet.*; import org.xmpp.packet.*;
import java.util.*; import java.util.*;
import java.util.concurrent.*;
import java.text.ParseException; import java.text.ParseException;
import java.net.URI; import java.net.*;
import java.net.URISyntaxException;
import com.rayo.core.*; import com.rayo.core.*;
import com.rayo.core.verb.*; import com.rayo.core.verb.*;
...@@ -64,6 +64,14 @@ import com.sun.voip.*; ...@@ -64,6 +64,14 @@ import com.sun.voip.*;
import org.voicebridge.*; import org.voicebridge.*;
import com.jcumulus.server.rtmfp.ServerPipelineFactory;
import com.jcumulus.server.rtmfp.Sessions;
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.FixedReceiveBufferSizePredictorFactory;
import org.jboss.netty.channel.socket.nio.NioDatagramChannelFactory;
import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
public class RayoComponent extends AbstractComponent public class RayoComponent extends AbstractComponent
...@@ -93,6 +101,10 @@ public class RayoComponent extends AbstractComponent ...@@ -93,6 +101,10 @@ public class RayoComponent extends AbstractComponent
private SayProvider sayProvider = null; private SayProvider sayProvider = null;
private HandsetProvider handsetProvider = null; private HandsetProvider handsetProvider = null;
private static ConnectionlessBootstrap bootstrap = null;
public static Channel channel = null;
private static Sessions sessions;
public RayoComponent(final RayoPlugin plugin) public RayoComponent(final RayoPlugin plugin)
{ {
...@@ -130,6 +142,32 @@ public class RayoComponent extends AbstractComponent ...@@ -130,6 +142,32 @@ public class RayoComponent extends AbstractComponent
{ {
Log.info("RayoComponent found Fastpath"); Log.info("RayoComponent found Fastpath");
} }
try{
Log.info("Starting jCumulus.....");
sessions = new Sessions();
ExecutorService executorservice = Executors.newCachedThreadPool();
NioDatagramChannelFactory niodatagramchannelfactory = new NioDatagramChannelFactory(executorservice);
bootstrap = new ConnectionlessBootstrap(niodatagramchannelfactory);
OrderedMemoryAwareThreadPoolExecutor orderedmemoryawarethreadpoolexecutor = new OrderedMemoryAwareThreadPoolExecutor(10, 0x100000L, 0x40000000L, 100L, TimeUnit.MILLISECONDS, Executors.defaultThreadFactory());
bootstrap.setPipelineFactory(new ServerPipelineFactory(sessions, orderedmemoryawarethreadpoolexecutor));
bootstrap.setOption("reuseAddress", Boolean.valueOf(true));
bootstrap.setOption("sendBufferSize", Integer.valueOf(1215));
bootstrap.setOption("receiveBufferSize", Integer.valueOf(2048));
bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(2048));
InetSocketAddress inetsocketaddress = new InetSocketAddress(JiveGlobals.getIntProperty("voicebridge.rtmfp.port", 1935));
Log.info("Listening on " + inetsocketaddress.getPort() + " port");
channel = bootstrap.bind(inetsocketaddress);
} catch (Exception e) {
Log.error("jCumulus startup failure");
e.printStackTrace();
}
} }
public void doStop() public void doStop()
...@@ -144,6 +182,11 @@ public class RayoComponent extends AbstractComponent ...@@ -144,6 +182,11 @@ public class RayoComponent extends AbstractComponent
server.getIQDiscoInfoHandler().removeServerFeature(RAYO_HANDSET); server.getIQDiscoInfoHandler().removeServerFeature(RAYO_HANDSET);
destroyIQHandlers(); destroyIQHandlers();
Log.info("jCumulus stopping...");
channel.close();
bootstrap.releaseExternalResources();
} }
public String getName() { public String getName() {
...@@ -558,9 +601,32 @@ public class RayoComponent extends AbstractComponent ...@@ -558,9 +601,32 @@ public class RayoComponent extends AbstractComponent
{ {
if (channel == null) if (channel == null)
{ {
cp.setPhoneNumber(handset.sipuri); if (handset.sipuri.indexOf("sip:") == 0)
cp.setAutoAnswer(true); {
cp.setProtocol("SIP"); cp.setPhoneNumber(handset.sipuri);
cp.setAutoAnswer(true);
cp.setProtocol("SIP");
} else if (handset.sipuri.indexOf("rtmfp:") == 0) {
String[] tokens = handset.sipuri.split(":");
if (tokens.length == 3)
{
cp.setProtocol("Rtmfp");
cp.setRtmfpSendStream(tokens[1]);
cp.setRtmfpRecieveStream(tokens[2]);
cp.setAutoAnswer(true);
} else {
reply.setError(PacketError.Condition.not_allowed);
return;
}
} else {
reply.setError(PacketError.Condition.not_allowed);
return;
}
} else { } else {
cp.setMediaPreference(mediaPreference); cp.setMediaPreference(mediaPreference);
......
...@@ -1851,7 +1851,7 @@ public class Application implements CallEventListener { ...@@ -1851,7 +1851,7 @@ public class Application implements CallEventListener {
if ("protocol".equalsIgnoreCase(parameter)) 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); reportError("Invalid protocol: " + value);
return; 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