Created
August 28, 2014 14:37
-
-
Save shvyrev/0f28d7b8ed87532f888b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void SendFlv(FlvTag[] flvs) | |
{ | |
var memory = new MemoryStream(); | |
var writer = new EndianBinaryWriter(EndianBitConverter.Big, memory); | |
const byte chunkHeaderType = 0x03; | |
var chunkCount = 0; | |
for (var i = 0; i < flvs.Length; i++) | |
{ | |
var flv = flvs[i]; | |
chunkCount += flv.Data.Length; | |
writer.Write(chunkHeaderType); | |
writer.Write(flv.TimeStamp, 0, 3); | |
writer.Write(flv.Length, 0, 3); | |
writer.Write((byte) flv.TagType); | |
//writer.Write(new byte[] {0x00, flv.StreamId[0], flv.StreamId[1], flv.StreamId[2]}); | |
var streamIdBytes = converter.GetBytes(StreamId); | |
for (int id = streamIdBytes.Length - 1; id >= 0; id--) | |
{ | |
writer.Write(streamIdBytes[id]); | |
} | |
writer.Write(flv.Data); | |
} | |
if(chunkCount > CurrentChunkSize) | |
SendChunkSize((uint)chunkCount); | |
tcpClient.GetStream().Write(memory.ToArray(), 0, memory.ToArray().Length); | |
} |
donotfeedaslender
commented
Jul 18, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment