What is the method for distinguishing whether a frame is a GoodFrame or a BadFrame in a callback?

The determination is made based on the lBufferSize parameter passed to the callback function.

 

long CALLBACK CallbackFunc(BYTE * pBuffer, long lBufferSize,PVOID pContext )

 

When lBufferSize == 0, it indicates a BadFrame.

When lBufferSize != 0, it indicates a GoodFrame.

 

Judgment should not rely on pBuffer.

 

pBuffer == NULL signifies that memory for the frame is not allocated. While it will not be NULL during a GoodFrame, its value during a BadFrame is indeterminate.

 

To ensure that the callback is invoked even during BadFrame occurrences, the following code must be executed at the appropriate initialization stage:

 

ICubeSDK_SetCamParameter( n, REG_CALLBACK_BR_FRAMES, ON );  //n is Camera code

 

The ON parameter in the last argument enables invoking the callback during BadFrame occurrences. When set to OFF, the callback is only triggered during GoodFrame occurrences.