Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Disabled jee validators in eclipse. Refactored SO's to work in flex w…

…ith AMF3 encoding (see ByteArray).

git-svn-id: http://red5.googlecode.com/svn/java/server/trunk@4257 1b6495e4-3631-0410-8e05-8f51eee8b9cc
  • Loading branch information...
commit 3ae4b33124c7279902da317d98ff5deed3387cc6 1 parent 03b3318
mondain authored
View
13 .settings/org.eclipse.wst.validation.prefs
@@ -1,6 +1,9 @@
-#Tue Apr 15 14:43:33 PDT 2008
-DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator\=org.eclipse.wst.wsdl.validation.internal.eclipse.Validator;
-USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.jst.jsf.validation.internal.appconfig.AppConfigValidator;org.eclipse.jst.jsp.core.internal.validation.JSPContentValidator;org.eclipse.jst.jsp.core.internal.validation.JSPBatchValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.html.internal.validation.HTMLValidator\:org.eclipse.php.core.phpsource;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
-USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.html.internal.validation.HTMLValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;org.eclipse.jst.jsf.validation.internal.JSPSemanticsValidator;org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;org.eclipse.jst.jsf.validation.internal.appconfig.AppConfigValidator;org.eclipse.jst.jsp.core.internal.validation.JSPContentValidator;org.eclipse.jst.jsp.core.internal.validation.JSPBatchValidator;org.eclipse.wst.xml.core.internal.validation.eclipse.Validator;org.eclipse.wst.html.internal.validation.HTMLValidator\:org.eclipse.php.core.phpsource;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
-USER_PREFERENCE=overrideGlobalPreferencesfalse
+#Wed Jul 27 09:56:05 PDT 2011
+DELEGATES_PREFERENCE=delegateValidatorList
+USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
+USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
+USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationtrueversion1.2.202.v201103212041
eclipse.preferences.version=1
+override=true
+suspend=true
+vf.version=3
View
5 src/org/red5/io/amf3/AMF3.java
@@ -19,7 +19,6 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-import java.nio.charset.Charset;
/**
* AMF3 data type definitions.
@@ -35,10 +34,6 @@
* @author Paul Gregoire (mondain@gmail.com)
*/
public class AMF3 {
- /**
- * UTF-8 is used
- */
- public static final Charset CHARSET = Charset.forName("UTF-8");
/**
* Minimum possible value for integer number encoding.
View
3  src/org/red5/io/amf3/DataInput.java
@@ -24,6 +24,7 @@
import java.nio.charset.Charset;
import org.apache.mina.core.buffer.IoBuffer;
+import org.red5.io.amf.AMF;
import org.red5.io.object.Deserializer;
/**
@@ -154,7 +155,7 @@ public String readUTFBytes(int length) {
int limit = buffer.limit();
final ByteBuffer strBuf = buffer.buf();
strBuf.limit(strBuf.position() + length);
- final String string = AMF3.CHARSET.decode(strBuf).toString();
+ final String string = AMF.CHARSET.decode(strBuf).toString();
buffer.limit(limit); // Reset the limit
return string;
}
View
5 src/org/red5/io/amf3/DataOutput.java
@@ -25,6 +25,7 @@
import java.nio.charset.Charset;
import org.apache.mina.core.buffer.IoBuffer;
+import org.red5.io.amf.AMF;
import org.red5.io.object.Serializer;
/**
@@ -134,7 +135,7 @@ public void writeUnsignedInt(long value) {
public void writeUTF(String value) {
// fix from issue #97
try {
- byte[] strBuf = value.getBytes(AMF3.CHARSET.name());
+ byte[] strBuf = value.getBytes(AMF.CHARSET.name());
buffer.putShort((short) strBuf.length);
buffer.put(strBuf);
} catch (UnsupportedEncodingException e) {
@@ -144,7 +145,7 @@ public void writeUTF(String value) {
/** {@inheritDoc} */
public void writeUTFBytes(String value) {
- final java.nio.ByteBuffer strBuf = AMF3.CHARSET.encode(value);
+ final java.nio.ByteBuffer strBuf = AMF.CHARSET.encode(value);
buffer.put(strBuf);
}
View
6 src/org/red5/io/amf3/Input.java
@@ -374,7 +374,7 @@ public String readString(Type target) {
log.debug("readString - limit: {}", limit);
final ByteBuffer strBuf = buf.buf();
strBuf.limit(strBuf.position() + len);
- final String string = AMF3.CHARSET.decode(strBuf).toString();
+ final String string = AMF.CHARSET.decode(strBuf).toString();
log.debug("String: {}", string);
buf.limit(limit); // reset the limit
refStorage.stringReferences.add(string);
@@ -393,7 +393,7 @@ public String readString(int length) {
int limit = buf.limit();
final ByteBuffer strBuf = buf.buf();
strBuf.limit(strBuf.position() + length);
- final String string = AMF3.CHARSET.decode(strBuf).toString();
+ final String string = AMF.CHARSET.decode(strBuf).toString();
log.debug("String: {}", string);
buf.limit(limit);
//check for null termination
@@ -959,7 +959,7 @@ public Document readXML(Type target) {
int limit = buf.limit();
final ByteBuffer strBuf = buf.buf();
strBuf.limit(strBuf.position() + len);
- final String xmlString = AMF3.CHARSET.decode(strBuf).toString();
+ final String xmlString = AMF.CHARSET.decode(strBuf).toString();
buf.limit(limit); // Reset the limit
Document doc = null;
try {
View
8 src/org/red5/io/amf3/Output.java
@@ -149,7 +149,7 @@ protected void putInteger(long value) {
Element element = getStringCache().get(string);
byte[] encoded = (element == null ? null : (byte[]) element.getObjectValue());
if (encoded == null) {
- ByteBuffer buf = AMF3.CHARSET.encode(string);
+ ByteBuffer buf = AMF.CHARSET.encode(string);
encoded = new byte[buf.limit()];
buf.get(encoded);
getStringCache().put(new Element(string, encoded));
@@ -374,26 +374,22 @@ public void writeMap(Collection<?> array, Serializer serializer) {
@Override
protected void writeArbitraryObject(Object object, Serializer serializer) {
Class<?> objectClass = object.getClass();
-
// If we need to serialize class information...
if (!objectClass.isAnnotationPresent(Anonymous.class)) {
putString(serializer.getClassName(objectClass));
} else {
putString("");
}
-
// Store key/value pairs
amf3_mode += 1;
// Iterate thru fields of an object to build "name-value" map from it
for (Field field : objectClass.getFields()) {
String fieldName = field.getName();
-
log.debug("Field: {} class: {}", field, objectClass);
// Check if the Field corresponding to the getter/setter pair is transient
if (!serializeField(serializer, objectClass, fieldName, field, null)) {
continue;
}
-
Object value;
try {
// Get field value
@@ -402,7 +398,6 @@ protected void writeArbitraryObject(Object object, Serializer serializer) {
// Swallow on private and protected properties access exception
continue;
}
-
// Write out prop name
putString(fieldName);
// Write out
@@ -548,7 +543,6 @@ public void writeByteArray(ByteArray array) {
putInteger(getReferenceId(array) << 1);
return;
}
-
storeReference(array);
IoBuffer data = array.getData();
putInteger(data.limit() << 1 | 1);
View
2  src/org/red5/server/api/Red5.java
@@ -43,7 +43,7 @@
*
* @author The Red5 Project (red5@osflash.org)
* @author Luke Hubbard (luke@codegent.com)
- * @author Paul Gregoire (mondain@gmail.com)
+ * @author Paul Gregoire (mondain@gmail.com)
*/
public final class Red5 {
View
119 src/org/red5/server/net/remoting/message/RemotingPacket.java
@@ -31,86 +31,89 @@
* Packet of remote calls. Used by RemoteProtocolDecoder.
*/
public class RemotingPacket {
- /**
- * HTTP request object
- */
+ /**
+ * HTTP request object
+ */
protected HttpServletRequest request;
- /**
- * Byte buffer data
- */
+
+ /**
+ * Byte buffer data
+ */
protected ByteBuffer data;
+
/**
* Headers sent with request.
*/
protected Map<String, Object> headers;
- /**
- * List of calls
- */
+
+ /**
+ * List of calls
+ */
protected List<RemotingCall> calls;
- /**
- * Scope path
- */
+
+ /**
+ * Scope path
+ */
protected String scopePath;
- /**
- * Create remoting packet from list of pending calls
- * @param headers headers
- * @param calls List of call objects
- */
- public RemotingPacket(Map<String, Object> headers, List<RemotingCall> calls) {
- this.headers = headers;
+ /**
+ * Create remoting packet from list of pending calls
+ * @param headers headers
+ * @param calls List of call objects
+ */
+ public RemotingPacket(Map<String, Object> headers, List<RemotingCall> calls) {
+ this.headers = headers;
this.calls = calls;
}
- /**
- * Get the headers sent with the request.
- *
- * @return headers
- */
- public Map<String, Object> getHeaders() {
- return headers;
- }
-
/**
- * Getter for calls.
- *
- * @return List of remote calls
- */
- public List<RemotingCall> getCalls() {
+ * Get the headers sent with the request.
+ *
+ * @return headers
+ */
+ public Map<String, Object> getHeaders() {
+ return headers;
+ }
+
+ /**
+ * Getter for calls.
+ *
+ * @return List of remote calls
+ */
+ public List<RemotingCall> getCalls() {
return calls;
}
/**
- * Setter for scope path.
- *
- * @param path Value to set for property 'scopePath'.
- */
- public void setScopePath(String path) {
+ * Setter for scope path.
+ *
+ * @param path Value to set for property 'scopePath'.
+ */
+ public void setScopePath(String path) {
scopePath = path;
}
/**
- * Getter for property scope path.
- *
- * @return Scope path to set
- */
- public String getScopePath() {
+ * Getter for property scope path.
+ *
+ * @return Scope path to set
+ */
+ public String getScopePath() {
return scopePath;
}
- /**
- * Return the encoding of the included calls.
- *
- * @return encoding
- */
- public Encoding getEncoding() {
- List<RemotingCall> calls = getCalls();
- if (calls == null || calls.isEmpty()) {
- return Encoding.AMF0;
- }
-
- RemotingCall call = calls.get(0);
- return call.isAMF3 ? Encoding.AMF3 : Encoding.AMF0;
- }
-
+ /**
+ * Return the encoding of the included calls.
+ *
+ * @return encoding
+ */
+ public Encoding getEncoding() {
+ List<RemotingCall> calls = getCalls();
+ if (calls == null || calls.isEmpty()) {
+ return Encoding.AMF0;
+ }
+ RemotingCall call = calls.get(0);
+ return call.isAMF3 ? Encoding.AMF3 : Encoding.AMF0;
+ }
+
}
View
2  src/org/red5/server/net/rtmp/RTMPConnection.java
@@ -296,7 +296,7 @@ public void setup(String host, String path, String sessionId, Map<String, Object
this.path = path;
this.sessionId = sessionId;
this.params = params;
- if (params.get("objectEncoding") == Integer.valueOf(3)) {
+ if (Integer.valueOf(3).equals(params.get("objectEncoding"))) {
log.info("Setting object encoding to AMF3");
encoding = Encoding.AMF3;
}
View
34 src/org/red5/server/net/rtmp/RTMPHandler.java
@@ -341,21 +341,23 @@ protected void onInvoke(RTMPConnection conn, Channel channel, Header source, Not
disconnectOnReturn = true;
}
// Evaluate request for AMF3 encoding
- if (Integer.valueOf(3).equals(params.get("objectEncoding")) && call instanceof IPendingServiceCall) {
- Object pcResult = ((IPendingServiceCall) call).getResult();
- Map<String, Object> result;
- if (pcResult instanceof Map) {
- result = (Map<String, Object>) pcResult;
- result.put("objectEncoding", 3);
- } else if (pcResult instanceof StatusObject) {
- result = new HashMap<String, Object>();
- StatusObject status = (StatusObject) pcResult;
- result.put("code", status.getCode());
- result.put("description", status.getDescription());
- result.put("application", status.getApplication());
- result.put("level", status.getLevel());
- result.put("objectEncoding", 3);
- ((IPendingServiceCall) call).setResult(result);
+ if (Integer.valueOf(3).equals(params.get("objectEncoding"))) {
+ if (call instanceof IPendingServiceCall) {
+ Object pcResult = ((IPendingServiceCall) call).getResult();
+ Map<String, Object> result;
+ if (pcResult instanceof Map) {
+ result = (Map<String, Object>) pcResult;
+ result.put("objectEncoding", 3);
+ } else if (pcResult instanceof StatusObject) {
+ result = new HashMap<String, Object>();
+ StatusObject status = (StatusObject) pcResult;
+ result.put("code", status.getCode());
+ result.put("description", status.getDescription());
+ result.put("application", status.getApplication());
+ result.put("level", status.getLevel());
+ result.put("objectEncoding", 3);
+ ((IPendingServiceCall) call).setResult(result);
+ }
}
rtmp.setEncoding(Encoding.AMF3);
}
@@ -493,7 +495,7 @@ protected void onPing(RTMPConnection conn, Channel channel, Header source, Ping
* @param persistent
*/
private void sendSOCreationFailed(RTMPConnection conn, String name, boolean persistent) {
- log.warn("sendSOCreationFailed - name: {} persistent: {} conn: {}", new Object[]{name, persistent, conn});
+ log.warn("sendSOCreationFailed - name: {} persistent: {} conn: {}", new Object[] { name, persistent, conn });
SharedObjectMessage msg = new SharedObjectMessage(name, 0, persistent);
msg.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", SO_CREATION_FAILED));
conn.getChannel(3).write(msg);
View
27 src/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java
@@ -130,8 +130,7 @@ public void setDeserializer(Deserializer deserializer) {
}
}
} catch (HandshakeFailedException hfe) {
- // patched by Victor to clear buffer if something is wrong in
- // protocol decoding.
+ // patched by Victor to clear buffer if something is wrong in protocol decoding.
buffer.clear();
// get the connection and close it
IConnection conn = Red5.getConnectionLocal();
@@ -261,13 +260,11 @@ public IoBuffer decodeHandshake(RTMP rtmp, IoBuffer in) {
public Packet decodePacket(RTMP rtmp, IoBuffer in) {
log.debug("decodePacket - rtmp: {} buffer: {}", rtmp, in);
final int remaining = in.remaining();
-
// We need at least one byte
if (remaining < 1) {
rtmp.bufferDecoding(1);
return null;
}
-
final int position = in.position();
byte headerByte = in.get();
int headerValue;
@@ -299,18 +296,15 @@ public Packet decodePacket(RTMP rtmp, IoBuffer in) {
if (channelId < 0) {
throw new ProtocolException("Bad channel id: " + channelId);
}
-
// Get the header size and length
int headerLength = RTMPUtils.getHeaderLength(RTMPUtils.decodeHeaderSize(headerValue, byteCount));
headerLength += byteCount - 1;
-
if (headerLength + byteCount - 1 > remaining) {
log.debug("Header too small, buffering. remaining: {}", remaining);
in.position(position);
rtmp.bufferDecoding(headerLength + byteCount - 1);
return null;
}
-
// Move the position back to the start
in.position(position);
@@ -346,12 +340,10 @@ public Packet decodePacket(RTMP rtmp, IoBuffer in) {
rtmp.continueDecoding();
return null;
}
-
// Check workaround for SN-19 to find cause for BufferOverflowException
if (buf.position() > header.getSize()) {
log.warn("Packet size expanded from {} to {} ({})", new Object[] { (header.getSize()), buf.position(), header });
}
-
buf.flip();
try {
@@ -385,8 +377,7 @@ public Packet decodePacket(RTMP rtmp, IoBuffer in) {
packet = null;
}
if (packet != null && packet.getHeader().isGarbage()) {
- // discard this packet; this gets rid of the garbage
- // audio data FP inserts
+ // discard this packet; this gets rid of the garbage audio data FP inserts
log.trace("Dropping garbage packet: {}, {}", packet, packet.getHeader());
packet = null;
} else {
@@ -399,7 +390,6 @@ public Packet decodePacket(RTMP rtmp, IoBuffer in) {
rtmp.setLastReadPacket(channelId, null);
}
return packet;
-
}
/**
@@ -545,7 +535,7 @@ public IRTMPEvent decodeMessage(RTMP rtmp, Header header, IoBuffer in) {
message = decodeVideoData(in);
message.setSourceType(Constants.SOURCE_TYPE_LIVE);
break;
- case TYPE_FLEX_SHARED_OBJECT:
+ case TYPE_FLEX_SHARED_OBJECT: // represents an SO in an AMF3 container
message = decodeFlexSharedObject(in, rtmp);
break;
case TYPE_SHARED_OBJECT:
@@ -632,7 +622,7 @@ public ISharedObjectMessage decodeFlexSharedObject(IoBuffer in, RTMP rtmp) {
boolean persistent = in.getInt() == 2;
// Skip unknown bytes
in.skip(4);
-
+ // create our shared object message
final SharedObjectMessage so = new FlexSharedObjectMessage(null, name, version, persistent);
doDecodeSharedObject(so, in, input);
return so;
@@ -648,7 +638,7 @@ public ISharedObjectMessage decodeSharedObject(IoBuffer in, RTMP rtmp) {
boolean persistent = in.getInt() == 2;
// Skip unknown bytes
in.skip(4);
-
+ // create our shared object message
final SharedObjectMessage so = new FlexSharedObjectMessage(null, name, version, persistent);
doDecodeSharedObject(so, in, input);
return so;
@@ -697,7 +687,7 @@ protected void doDecodeSharedObject(SharedObjectMessage so, IoBuffer in, Input i
if (length > 0) {
key = input.getString();
if (length > key.length() + 2) {
- // FIXME workaround for player version >= 9.0.115.0
+ // determine if the object is encoded with amf3
byte objType = in.get();
in.position(in.position() - 1);
Input propertyInput;
@@ -716,14 +706,13 @@ protected void doDecodeSharedObject(SharedObjectMessage so, IoBuffer in, Input i
// the "send" event seems to encode the handler name
// as complete AMF string including the string type byte
key = deserializer.deserialize(input, String.class);
-
// read parameters
final List<Object> list = new LinkedList<Object>();
// while loop changed for JIRA CODECS-9
while (in.position() - start < length) {
byte objType = in.get();
in.position(in.position() - 1);
- // FIXME workaround for player version >= 9.0.115.0
+ // determine if the object is encoded with amf3
Input propertyInput;
if (objType == AMF.TYPE_AMF3_OBJECT && !(input instanceof org.red5.io.amf3.Input)) {
// The next parameter is encoded using AMF3
@@ -880,7 +869,6 @@ protected Notify decodeNotifyOrInvoke(Notify notify, IoBuffer in, Header header,
if (serviceMethod.startsWith("@") || serviceMethod.startsWith("|")) {
serviceMethod = serviceMethod.substring(1);
}
-
if (notify instanceof Invoke) {
PendingCall call = new PendingCall(serviceName, serviceMethod, params);
((Invoke) notify).setCall(call);
@@ -888,7 +876,6 @@ protected Notify decodeNotifyOrInvoke(Notify notify, IoBuffer in, Header header,
Call call = new Call(serviceName, serviceMethod, params);
notify.setCall(call);
}
-
return notify;
}
View
55 src/org/red5/server/net/rtmp/codec/RTMPProtocolEncoder.java
@@ -592,8 +592,14 @@ public IoBuffer encodeChunkSize(ChunkSize chunkSize) {
public IoBuffer encodeFlexSharedObject(ISharedObjectMessage so, RTMP rtmp) {
final IoBuffer out = IoBuffer.allocate(128);
out.setAutoExpand(true);
- // TODO: also support sending of AMF3 encoded data
- out.put((byte) 0x00);
+ // use the originators so.objectEncoding setting
+ if (rtmp.getEncoding() == Encoding.AMF3) {
+ log.debug("Setting encoding as AMF3");
+ out.put((byte) 0x03);
+ } else {
+ log.debug("Setting encoding as AMF0");
+ out.put((byte) 0x00);
+ }
doEncodeSharedObject(so, rtmp, out);
return out;
}
@@ -614,12 +620,8 @@ public IoBuffer encodeSharedObject(ISharedObjectMessage so, RTMP rtmp) {
* @param out output buffer
*/
public void doEncodeSharedObject(ISharedObjectMessage so, RTMP rtmp, IoBuffer out) {
- final Output output;
- if (rtmp.getEncoding() == Encoding.AMF3) {
- output = new org.red5.io.amf3.Output(out);
- } else {
- output = new org.red5.io.amf.Output(out);
- }
+ final Output output = new org.red5.io.amf.Output(out);
+ final Output amf3output = new org.red5.io.amf3.Output(out);
output.putString(so.getName());
// SO version
out.putInt(so.getVersion());
@@ -660,7 +662,11 @@ public void doEncodeSharedObject(ISharedObjectMessage so, RTMP rtmp, IoBuffer ou
out.skip(4); // we will be back
String key = (String) o;
output.putString(key);
- serializer.serialize(output, initialData.get(key));
+ if (rtmp.getEncoding() == Encoding.AMF3) {
+ serializer.serialize(amf3output, initialData.get(key));
+ } else {
+ serializer.serialize(output, initialData.get(key));
+ }
len = out.position() - mark - 4;
out.putInt(mark, len);
}
@@ -669,7 +675,11 @@ public void doEncodeSharedObject(ISharedObjectMessage so, RTMP rtmp, IoBuffer ou
mark = out.position();
out.skip(4); // we will be back
output.putString(event.getKey());
- serializer.serialize(output, event.getValue());
+ if (rtmp.getEncoding() == Encoding.AMF3) {
+ serializer.serialize(amf3output, event.getValue());
+ } else {
+ serializer.serialize(output, event.getValue());
+ }
len = out.position() - mark - 4;
out.putInt(mark, len);
}
@@ -683,9 +693,16 @@ public void doEncodeSharedObject(ISharedObjectMessage so, RTMP rtmp, IoBuffer ou
out.skip(4);
// Serialize name of the handler to call...
serializer.serialize(output, event.getKey());
- // ...and the arguments
- for (Object arg : (List<?>) event.getValue()) {
- serializer.serialize(output, arg);
+ if (rtmp.getEncoding() == Encoding.AMF3) {
+ // ...and the arguments
+ for (Object arg : (List<?>) event.getValue()) {
+ serializer.serialize(amf3output, arg);
+ }
+ } else {
+ // ...and the arguments
+ for (Object arg : (List<?>) event.getValue()) {
+ serializer.serialize(output, arg);
+ }
}
len = out.position() - mark - 4;
//log.debug(len);
@@ -703,15 +720,17 @@ public void doEncodeSharedObject(ISharedObjectMessage so, RTMP rtmp, IoBuffer ou
break;
default:
- //log.error("Unknown event " + event.getType());
- // XXX: come back here, need to make this work in server or client mode
- // talk to joachim about this part.
+ log.warn("Unknown event: {}", event.getType());
+ // XXX: need to make this work in server or client mode
out.put(type);
mark = out.position();
- //out.putInt(0);
out.skip(4); // we will be back
output.putString(event.getKey());
- serializer.serialize(output, event.getValue());
+ if (rtmp.getEncoding() == Encoding.AMF3) {
+ serializer.serialize(amf3output, event.getValue());
+ } else {
+ serializer.serialize(output, event.getValue());
+ }
len = out.position() - mark - 4;
out.putInt(mark, len);
break;
View
70 src/org/red5/server/net/rtmp/message/Header.java
@@ -62,10 +62,8 @@
private int streamId;
/**
- * Flash player occasionally sends garbage audio that
- * as far as I can tell exists only to make folks who
- * don't know about it slowly get out-of-sync audio
- * and video. We now detect that.
+ * Flash player occasionally sends garbage audio that as far as I can tell exists only to make folks who
+ * don't know about it slowly get out-of-sync audio and video. We now detect that.
*/
private boolean isGarbage = false;
@@ -160,6 +158,30 @@ public void setTimer(int timer) {
this.timerDelta = 0;
}
+ public void setTimerDelta(int timerDelta) {
+ this.timerDelta = timerDelta;
+ }
+
+ public int getTimerDelta() {
+ return timerDelta;
+ }
+
+ public void setTimerBase(int timerBase) {
+ this.timerBase = timerBase;
+ }
+
+ public int getTimerBase() {
+ return timerBase;
+ }
+
+ public void setIsGarbage(boolean isGarbage) {
+ this.isGarbage = isGarbage;
+ }
+
+ public boolean isGarbage() {
+ return isGarbage;
+ }
+
/** {@inheritDoc} */
@Override
public boolean equals(Object other) {
@@ -167,17 +189,7 @@ public boolean equals(Object other) {
return false;
}
final Header header = (Header) other;
- return (header.getChannelId() == channelId && header.getDataType() == dataType && header.getSize() == size
- && header.getTimer() == this.getTimer() && header.getStreamId() == streamId);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "Header [channelId=" + channelId + ", dataType=" + dataType + ", timerBase=" + timerBase + ", timerDelta=" + timerDelta + ", size=" + size + ", streamId="
- + streamId + ", isGarbage=" + isGarbage + "]";
+ return (header.getChannelId() == channelId && header.getDataType() == dataType && header.getSize() == size && header.getTimer() == this.getTimer() && header.getStreamId() == streamId);
}
/** {@inheritDoc} */
@@ -214,27 +226,13 @@ public void writeExternal(ObjectOutput out) throws IOException {
out.writeBoolean(isGarbage);
}
- public void setTimerDelta(int timerDelta) {
- this.timerDelta = timerDelta;
- }
-
- public int getTimerDelta() {
- return timerDelta;
- }
-
- public void setTimerBase(int timerBase) {
- this.timerBase = timerBase;
- }
-
- public int getTimerBase() {
- return timerBase;
- }
-
- public void setIsGarbage(boolean isGarbage) {
- this.isGarbage = isGarbage;
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "Header [channelId=" + channelId + ", dataType=" + dataType + ", timerBase=" + timerBase + ", timerDelta=" + timerDelta + ", size=" + size + ", streamId="
+ + streamId + ", isGarbage=" + isGarbage + "]";
}
- public boolean isGarbage() {
- return isGarbage;
- }
}
View
2  src/org/red5/server/so/ISharedObjectMessage.java
@@ -49,7 +49,7 @@
* false
*/
public boolean isPersistent();
-
+
/**
* Returns a set of ISharedObjectEvent objects containing informations what
* to change.
View
4 src/org/red5/server/so/SharedObjectMessage.java
@@ -56,7 +56,7 @@
* Whether SO persistent
*/
private boolean persistent;
-
+
public SharedObjectMessage() {
}
@@ -186,7 +186,6 @@ public Object getObject() {
/** {@inheritDoc} */
@Override
protected void releaseInternal() {
-
}
/** {@inheritDoc} */
@@ -226,4 +225,5 @@ public void writeExternal(ObjectOutput out) throws IOException {
out.writeBoolean(persistent);
out.writeObject(events);
}
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.