Reputation: 3713
I'm writing a program that will get video stream from IP Camera and display its video.
I request MJPEG stream, parse data and display frame by frame on WPF control for making video.
I have compared my program with the other programs, and I saw that my program displayed video less smooth than others although the FRAME RATE DISPLAY is same.
I displayed video on a WPF control by updating control's image sequentially.
Someone can tell me why my program is not smooth? and how to improve it.
UPDATE:
@LearnedfromMistake: There are 2 threads. Thread #1 will request, parse data from Camera stream and Append frames into Queue. Thread #2 will get frame from Queue and display it.
Here is my Pseudo code.
Thread #1
{
while(true)
{
JpegFrame = ReadAFrameFromStream();
QUEUE.Append(JpegFrame);
}
}
Thread #2
{
while(true)
{
JpegFrame = QUEUE.GetFrame();
WPFControl.UpdateImage(JpegFrame); //Making video here
}
}
Upvotes: 0
Views: 564
Reputation: 69734
The best would be facilitate multimedia streaming APIs where images are decoded into YUV frames and presented accurately according to attached time stamps.
Upvotes: 1