[Red5commits] [2039] added initial code to support decoding of AMF3 remoting calls

jbauch luke at codegent.com
Tue May 15 20:00:07 EDT 2007


added initial code to support decoding of AMF3 remoting calls


Timestamp: 05/15/07 18:52:30 EST (less than one hour ago) 
Change: 2039 
Author: jbauch

Files (see diff or trac for details): 
java/server/trunk/src/org/red5/server/net/remoting/codec/RemotingProtocolDecoder.java


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/2039

Index: /java/server/trunk/src/org/red5/server/net/remoting/codec/RemotingProtocolDecoder.java
===================================================================
--- /java/server/trunk/src/org/red5/server/net/remoting/codec/RemotingProtocolDecoder.java (revision 2038)
+++ /java/server/trunk/src/org/red5/server/net/remoting/codec/RemotingProtocolDecoder.java (revision 2039)
@@ -28,4 +28,5 @@
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
+import org.red5.io.amf.AMF;
 import org.red5.io.amf.Input;
 import org.red5.io.object.Deserializer;
@@ -149,4 +150,19 @@
 			 * if (length != -1) in.limit(in.position()+length);
 			 */
+			byte type = in.get();
+			if (type != AMF.TYPE_ARRAY) {
+				throw new RuntimeException("AMF0 array type expected but found " + type);
+			}
+			int elements = in.getInt();
+			if (elements != 1) {
+				throw new RuntimeException("Array containing one element expected but found " + elements + " elements");
+			}
+			
+			byte amf3Check = in.get();
+			in.position(in.position()-1);
+			if (amf3Check == AMF.TYPE_AMF3_OBJECT) {
+				input = new org.red5.io.amf3.Input(in);
+			}
+			
 			Object value = deserializer.deserialize(input);
 


Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.



More information about the Red5commits mailing list