mohamadDev / aforge

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

Check for subscribers to VideoCaptureDevice.NewFrame event before copying bitmap data #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
CPU utilization can be greatly reduced when there are no subscribers to the
VideoCaptureDevice.NewFrame event by first checking for subscribers to the
event before copying the bitmap data.

VideoCaptureDevice.BufferCB should be altered as follows:

public int BufferCB( double sampleTime, IntPtr buffer, int bufferLen )
{
    if (parent.NewFrame != null)  // << Add this!
    {
        .
        .
        .
    }
    return 0;
}

Thanks!

Original issue reported on code.google.com by bemil...@gmail.com on 23 Mar 2009 at 7:09

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 4 Apr 2009 at 6:01

GoogleCodeExporter commented 9 years ago
Added check for existing subscribers for NewFrame event - if nobody is 
registered 
for the event, then video sources don't perform redundant bitmap 
creation/copying.

Committed in revision 954. Will be released in 2.0 version.

Original comment by andrew.k...@gmail.com on 4 Apr 2009 at 8:10

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 22 Jul 2009 at 3:50