Dekryptor / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

MJPEGStream.cs enhancements #197

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello, if whilst running an mjpeg stream the network is interrupted, the 
default value for the stream readtimeout is used (300000 ms) - 5 minutes. This 
is too long to wait before retry, it should be set to the same value as the 
request timeout.

Suggest add to MJPEGStream.cs

...
// get response stream
stream = response.GetResponseStream( );
stream.ReadTimeout = requestTimeout; //<-- new line

Also, is there a reason you're ignoring ApplicationException and Exception 
events in this class? Wouldn't it be better to throw all exceptions at the 
VideoSourceError handler?

...
catch ( Exception exception)
{
   if (VideoSourceError != null)
   {
      VideoSourceError(this, new VideoSourceErrorEventArgs(exception.Message));
   }
   Thread.Sleep( 250 );
}

Original issue reported on code.google.com by ad...@activeunlimited.com on 7 Apr 2011 at 6:13

GoogleCodeExporter commented 8 years ago
... if the stream read fails because the network is lost and it times out then 
the exception is caught after 5 minutes in the empty catch block and no error 
is returned to the parent

Original comment by ad...@activeunlimited.com on 7 Apr 2011 at 6:18

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 8 Apr 2011 at 8:07

GoogleCodeExporter commented 8 years ago
Setting stream's read time-out to the same value as request's time-out in 
MJPEGStream and JPEGStream.

Committed in revision 1413. Will be released in version 2.1.6.

>> Also, is there a reason you're ignoring ApplicationException and Exception
>> events in this class? Wouldn't it be better to throw all exceptions at the
>> VideoSourceError handler?
The idea was to notify user about network/connection related issues and keep 
any other issues "hidden". Initial idea was to make the class robust, so if 
something happens, then it will continue trying to reconnect and get video 
again. Do you want to get notifications for any possible exception?

Original comment by andrew.k...@gmail.com on 8 Apr 2011 at 8:19

GoogleCodeExporter commented 8 years ago
if someone adds a camera with an incorrect pixel format the class just cycles 
trying to connect and doesn't tell the parent what the problem is. I'd rather 
have a notification that the pixel format is incorrect than no response.

Original comment by ad...@activeunlimited.com on 9 Apr 2011 at 6:43

GoogleCodeExporter commented 8 years ago
Report to clients about every exception occurred in JPEGStream and MJPEGStream 
classes. Only ApplicationException is hidden in MJPEGStream class, which is 
thrown internally only in one case. All the rest will be sent to user for 
notification.

Committed in revision 1416. Will be released in version 2.1.6.

Original comment by andrew.k...@gmail.com on 11 Apr 2011 at 8:30

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 28 Jul 2011 at 9:46

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 10 Aug 2011 at 9:32