コード例 #1
0
ファイル: RTMPMessage.cs プロジェクト: beameio/RTMPLib-1
 public RTMPMessage(RTMPConnection connection, RTMPMessageHeader header, RTMPMessageBody body)
 {
     Connection = connection;
     Header = header;
     header.ParentMessage = this;
     Body = body;
     body.ParentMessage = this;
 }
コード例 #2
0
        public RTMPMessageBody(RTMPConnection connection, RTMPMessageHeader header, RTMPLib.Internal.BinaryReader br)
        {
            Connection = connection;

            byte[] buffer = null;
            if (header.MessageLength < 0)             //this is a follow up message
            {
                RTMPChunkStream csinfo = Connection.GetChunkStream((int)header.ChunkStreamID);
                buffer = br.ReadBytes(Math.Min(csinfo.RemainingBytes, Connection.IncomingChunkSize));
            }
            else
            {
                buffer = br.ReadBytes(Math.Min(header.MessageLength, Connection.IncomingChunkSize));
            }
            ms.Write(buffer, 0, buffer.Length);

            /*int remaining = connection.IncomingChunkSize;
             *
             * while (remaining > 0)
             * {
             *      byte[] buffer = br.ReadBytes(remaining);
             *      ms.Write(buffer, 0, buffer.Length);
             *      remaining -= ParentMessage.Connection.IncomingChunkSize;
             * }
             *
             * int remaining = ParentMessage.Header.MessageLength;
             * while (remaining > 0)
             * {
             *      byte[] buffer = br.ReadBytes(Math.Min(ParentMessage.Connection.IncomingChunkSize,remaining));
             *      ms.Write(buffer,0,buffer.Length);
             *      remaining -= ParentMessage.Connection.IncomingChunkSize;
             *      if (remaining > 0)
             *      {
             *              new RTMPMessageHeader(ParentMessage, br); // read the header for the next message piece
             *      }
             * }*/
            ms.Position  = 0;
            MemoryReader = new RTMPLib.Internal.BinaryReader(ms);
        }
コード例 #3
0
ファイル: RTMPMessageBody.cs プロジェクト: beameio/RTMPLib-1
        public RTMPMessageBody(RTMPConnection connection, RTMPMessageHeader header, RTMPLib.Internal.BinaryReader br)
        {
            Connection = connection;

            byte[] buffer = null;
            if (header.MessageLength < 0) //this is a follow up message
            {
                RTMPChunkStream csinfo = Connection.GetChunkStream((int)header.ChunkStreamID);
                buffer = br.ReadBytes(Math.Min(csinfo.RemainingBytes, Connection.IncomingChunkSize));
            }
            else
            {
                buffer = br.ReadBytes(Math.Min(header.MessageLength, Connection.IncomingChunkSize));
            }
            ms.Write(buffer, 0, buffer.Length);
            /*int remaining = connection.IncomingChunkSize;

            while (remaining > 0)
            {
                byte[] buffer = br.ReadBytes(remaining);
                ms.Write(buffer, 0, buffer.Length);
                remaining -= ParentMessage.Connection.IncomingChunkSize;
            }

            int remaining = ParentMessage.Header.MessageLength;
            while (remaining > 0)
            {
                byte[] buffer = br.ReadBytes(Math.Min(ParentMessage.Connection.IncomingChunkSize,remaining));
                ms.Write(buffer,0,buffer.Length);
                remaining -= ParentMessage.Connection.IncomingChunkSize;
                if (remaining > 0)
                {
                    new RTMPMessageHeader(ParentMessage, br); // read the header for the next message piece
                }
            }*/
            ms.Position = 0;
            MemoryReader = new RTMPLib.Internal.BinaryReader(ms);
        }
コード例 #4
0
ファイル: RTMPConnection.cs プロジェクト: beameio/RTMPLib-1
        private RTMPMessage ReceiveNextMessage()
        {
            RTMPMessageHeader header = new RTMPMessageHeader(this, br);

            RTMPMessageBody body = new RTMPMessageBody(this, header, br);

            RTMPMessage newmessage = new RTMPMessage(this, header, body);

            RTMPChunkStream csinfo = GetChunkStream((int)header.ChunkStreamID);
            return csinfo.AddFragment(newmessage);
        }
コード例 #5
0
ファイル: RTMPMessage.cs プロジェクト: beameio/RTMPLib-1
 public RTMPMessage(RTMPConnection connection)
 {
     Connection = connection;
     Header = new RTMPMessageHeader(this);
     Body = new RTMPMessageBody(this);
 }