I have an application that processes video with additional graphics and displays the output in a Windows Form. I had to separate the video processing into a background process/service and displaying the video/frames to a frontend UI. The images are sent via named pipes as soon as they are ready.
Everything works, but the issue is that sending the video through the named pipe is very slow. Here's the relevant code:
Background process:
if (serverPipe.isConnected()) {
ImageConverter converter = new ImageConverter();
erverPipe.WriteBytes((byte[])converter.ConvertTo(_currentImage.ToBitmap(), typeof(byte[])));
serverPipe.Flush();
}
Foreground UI app:
clientPipe.DataReceived += (sndr, args) =>
{
form.updatePictureBox(args.Data);
};
The named pipe code is from this post: c# Full Duplex Asynchronous Named Pipes .NET
Github link: https://github.com/cliftonm/clifton/tree/master/Clifton.Core/Clifton.Core.Pipes
The FPS that I get through the named pipe is close to 1 or 2 frames per second. I'm not sure if I'm dealing with a limitation in the way named pipes work or an inefficiency in my code.