Home > Back-end >  Ask: what about the UDP server receives TStream to Byte array
Ask: what about the UDP server receives TStream to Byte array

Time:10-01

Recently doing online UDP transmission, video captured picture on the client side, after the compression generated data is stored in the
FrameBuf: array [0.. 704 * 576 * 3] of Byte; Such an array of
Through IdUDPClient1. SendBuffer (FrameBuf, Ret); Sends the data to the server, and now I want how to be in the service side of TStream converted into FrameBuf and decompression,

Or who have the most simple point-to-point video, including collection, compression and decompression, shows that 100 k of the requirements of the network video BuKa in 100 r

CodePudding user response:

To the array, the first into a record type to send again, received to record and handle,

CodePudding user response:

First of all, the UDP packet number of bytes sent not too big, you how much is the 704 * 576 * 3 bytes,
Each UDP packet not more than 1024 bytes,

You first create a buffer, will generate the data in the buffer, then loop every time send 1024 bytes, add packages before each packet sequence number,
When receiving order processing,
To improve the speed, is a network, is to compress the source data processing,
As for how to compress the don't know, this can each video chat voice transmission of core technology,

CodePudding user response:

TStream TMemoryStream derived classes have a Memory properties, is a pointer type, always point to the first byte Stream, you can visit
 type 
PFrameBuf=^ TFrameBuf;
TFrameBuf=array [0.. 704 * 576 * 3] of Byte;

PFrameBuf (stream. The Memory) [0]

CodePudding user response:

Setlength (buffer size);
Stream. Position:=0;
Stream. Read (buffer [0], size);
  • Related