I have frames of a Video with 30FPS in my C# code and I want to broadcast it in local host so all other applications can use it. I though because it is a video and there is no concern if any packet lost and no need to connect/accept from clients, UDP is a good choose.
But there are number of problems here.
- If I use UDP Unicast speed is enough, about 25FPS (CPU Usage is 25% that mean 100% on one thread in my 4 core CPU which is not ideal. But at least it send enough set of data). But unicast cant deliver data to all clients.
- If I use broadcast speed is very low. About 10FPS with same CPU usage.
What can I do?! Data are in same computer so there is no need to remote access from LAN or etc. I just want a way to transfer about 30MBytes of data per second between different applications of same machine. (640x480 is fixed size of Image x 30fps x 3byte per pixel is about 27000KByte per second)
- Is UDP Multicast has better performance?!
- Is TCP can give me better performance even if I accept each client and send to them independently?!
- Is there any better way than Socket?! Memory sharing or something?!
- Why UDP broadcast is that much slow?! Only about 10MBytes per second?!
- Is there a fast way to compress frames with high performance (to encode 30fps in a sec and decode on other part)? Client apps are in C++ so this must be a cross platform way.
I just want to know other developers experiences and ideas here so please write what you think.
Edit:
More info about data: Data are in Bitmap RGB24 format and they are streaming from a device to my application with 30FPS. I want to broadcast this data to other applications and they need to have this images in RGB24 format again. There is no header or any thing, only bitmap data with fixed size. All operations must perform on the fly. No matter of using a lossy compression algorithm or any thing.