December 9th, 2012, 09:21 PM
C#.... Perplexed by video streaming latency
I am developing a windows GUI client app that accesses a Closed Circuit TV (CCTV) video stream from a Linux based open source back end server app called ZoneMinder. I am using a Web browser control in my Windows client. Specifically, I'm calling the following function:
The above function refreshes the image about once every five seconds. But if I use the native web page front end, the image is refreshed about once every second. That is, if I use Firefox or IE to access and display the video stream, the refresh rate is one second.
The backend ZM server is generating the video stream using a H.264 codec.
So, my questions; why is Navigate so sloooooow? And how can I reduce the time between image refreshes?
Net version is 4.030319 RtmRel.
Also, to avoid any cross posting issues. This issue has been previously posted on Code Guru
The remote network connection security issue brought up on that forum is a non issue. SSL is being used for remote connections.
December 12th, 2012, 11:44 PM
This is just a hunch but what browser identification is your control presenting to the site.
The User Agent information may change how the sever responds to the client.
The server may think the "browser" is not capable of receiving full speed transfers.
December 13th, 2012, 02:13 AM
Use this to spy on all the network traffic between you and the video server.
Focus on the initial protocol exchanges and compare differences between what you do in your code, and what a regular browser does.
December 13th, 2012, 11:19 AM
I did determine that the control was using the default IE webbrowser. Wireshark output is as follows:
Also, using the following code in my app
0090 73 65 72 2d 41 67 65 6e 74 3a 20 4d 69 63 72 6f ser-Agent: Micro
00a0 73 6f 66 74 2d 57 69 6e 64 6f 77 73 2f 36 2e 31 soft-Windows/6.1
produces the following output:
System.Windows.Forms.WebBrowser wb = new WebBrowser();
wb.Url = new Uri("about:blank");
string userAgent = wb.DocumentText.Substring(js.Length);
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MDDC)"
Previously, I had briefly checked both browsers (Firefox and IE) for any issues. Neither exhibited any slowness issues during my very brief test independent of using my control. So, I focused my attention on potential Webbrowser control issues. I revisited IE after wireshark etc. gave me the impression that it was the default browser used by the control and realized that initially it is very fast as in one second refresh rates but it eventually slows down to about 5 second refresh rates. The five second refresh rate become consistent with IE after a few minutes.
So, now I have to override the default bahavior of the control to use Firefox if it is installed. Otherwise, I'm stuck with IE.
Unfortunately, I developed "tunnel vision" on this issue and incorrectly made the assumption that the control was the source of the problem.
Thanx guys. I really appreciate the help getting me back on the right track!