RTP MEMO ````
class Rtp { void startReceive() { Socket udpSocket = new Socket(AddressFamily.InterNetwrok, SocketType.Dgram, ProtocolType.Udp);
IPEndPoint localhostIpEnd = new IPEndPoint(IPAddress.Any, targetPort);
udpSocket.Bind(localhostIPEnd);
MulticastOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, mcastOpt);
byte[] recvBuf = new byte[65535]; int byteRecevied = udpSocket.ReceiveFrom(recvByte, ref, localEndPoint);
} }
class RtpHeader { private byte[] header; public RtpHeader(byte[] data) { header = data; }
public int getVersion() { // [0] [7|6|5|4|3|2|1|0] // ~~~ return (header[0] >> 6) & 0x03; }
public int getPadding() { // [0] [7|6|5|4|3|2|1|0] // ~ return (header[0] >> 6) & 0x01; }
static int getExtention() { // [0] [7|6|5|4|3|2|1|0] // ~ return (header[0] >> 5) & 0x01; }
public int getCsrcCount() { // [0] [7|6|5|4|3|2|1|0] // ~~~~~~~ return (header[0] & 0x0F); }
public int getMarker() { // [1] [7|6|5|4|3|2|1|0] // ~ return (header[1] >> 7) & 0x01; }
public int getPayloadType() { // [1] [7|6|5|4|3|2|1|0] // ~~~~~~~~~~~~~ return (header[1] & 0x7F); }
public int getSequenceNumber() { // [2][3] int val = ((header[2] << 8) & 0xFF00); val |= (header[3] & 0xFF); return val; }
public int getTimestamp() { // [4][5] int val = ((header[4] << 8) & 0xFF00); val |= (header[5] & 0xFF); return val; }
public int getSsrc() { // [6][7][8][9] int val = header[6] & 0xFF; val <<= 8; val |= header[7] & 0xFF; val <<= 8; val |= header[8] & 0xFF; val <<= 8; val |= header[9] & 0xFF; return val; }
}
class JpegHeader { // [0] Type-specific // [1]-[3] Fragment Offset // [4] Type // [5] Q // [6] Width // [7] Height
// RestartMerker // }
````