Permalink
Browse files

NetStream::setBufferTime suppport, and few middle mode fix

  • Loading branch information...
1 parent a935664 commit 3e378e756cf9d1312cde7eaf12f9c83c9a69efbc @cumulusdev cumulusdev committed Feb 4, 2013
@@ -34,6 +34,7 @@ class FlowConnection : public Flow {
private:
static std::string _Name;
void messageHandler(const std::string& name,AMFReader& message);
+ void rawHandler(Poco::UInt8 type,PacketReader& data);
std::set<Poco::UInt32> _streamIndex;
};
@@ -21,7 +21,7 @@
#include "MemoryStream.h"
#include "BinaryWriter.h"
-#define PACKETSEND_SIZE 1215
+#define PACKETSEND_SIZE 1300
namespace Cumulus {
@@ -104,6 +104,22 @@ void FlowConnection::messageHandler(const std::string& name,AMFReader& message)
}
}
+void FlowConnection::rawHandler(UInt8 type,PacketReader& data) {
+ UInt16 flag = data.read16();
+ if(flag!=0x03) {
+ Flow::rawHandler(type,data);
+ return;
+ }
+ // setBufferTime
+ UInt32 streamId = data.read32();
+ if(streamId>0) {
+ INFO("setBufferTime %u on stream %u",data.read32(),streamId)
+ BinaryWriter& raw = writer.writeRawMessage();
+ raw.write16(0);
+ raw.write32(streamId);
+ }
+}
+
} // namespace Cumulus
@@ -374,16 +374,15 @@ void Middle::targetPacketHandler(PacketReader& packet) {
UInt16 size = packet.read16();
PacketReader content(packet.current(),size);packetOut.write16(size);
-
+
if(type==0x10 || type==0x11) {
UInt8 flag = content.read8();packetOut.write8(flag);
if(type==0x10) {
idFlow = content.read7BitLongValue();packetOut.write7BitLongValue(idFlow);
stage = content.read7BitLongValue();packetOut.write7BitLongValue(stage);
+ packetOut.write7BitLongValue(content.read7BitLongValue());
} else
++stage;
-
- packetOut.write7BitLongValue(content.read7BitLongValue());
if(!(flag&MESSAGE_WITH_BEFOREPART)) {
@@ -399,16 +398,28 @@ void Middle::targetPacketHandler(PacketReader& packet) {
UInt8 flagType = content.read8(); packetOut.write8(flagType);
if(flagType==0x09) {
UInt32 time = content.read32(); packetOut.write32(time);
- //TRACE("Timestamp/Flag video : %u/%2x",time,*content.current());
+ TRACE("Timestamp/Flag video : %u/%2x",time,*content.current());
} else if(flagType==0x08) {
UInt32 time = content.read32(); packetOut.write32(time);
- //TRACE("Timestamp/Flag audio : %u/%2x",time,*content.current());
+ TRACE("Timestamp/Flag audio : %u/%2x",time,*content.current());
} else if(flagType==0x04) {
packetOut.write32(content.read32());
- UInt16 a = content.read16(); packetOut.write16(a);
+ UInt16 a = content.read16();packetOut.write16(a);
UInt32 b = content.read32(); packetOut.write32(b);
- UInt32 c = content.read32(); packetOut.write32(c);
- //TRACE("Bound %u : %u %u %u",idFlow,a,b,c);
+ if(content.available()>0) {
+ UInt32 c = content.read32(); packetOut.write32(c);
+ if(a!=0x22) {
+ DEBUG("Raw %llu : %.2x %u %u",idFlow,a,b,c)
+ } else {
+ TRACE("Bound %llu : %.2x %u %u",idFlow,a,b,c);
+ }
+ } else
+ DEBUG("Raw %llu : %.2x %u",idFlow,a,b)
+
+ /* if(a==0x1F) {
+ packetOut.reset(posType);
+ content.next(content.available());
+ }*/
}
if(flagType==0x0b && stage==0x01 && ((marker==0x4e && idFlow==0x03) || (marker==0x8e && idFlow==0x05))) {
@@ -446,7 +457,6 @@ void Middle::targetPacketHandler(PacketReader& packet) {
}
}
-
} else if(type == 0x0F) {
packetOut.writeRaw(content.current(),3);content.next(3);
UInt8 peerId[ID_SIZE];

0 comments on commit 3e378e7

Please sign in to comment.