Register with the resource management component to let the camera service know that your application is ready to process buffers.


#include <camera/camera_api.h>
camera_error_t camera_register_resource(camera_handle_t handle)



The handle returned by a call to the camera_open() function.




At any point in time, it is possible that resources in use by the camera viewfinder may be needed by a higher priority application. When this occurs, the viewfinder will be stopped by the camera service. If buffers are in use by your application when the viewfinder is stopped, this can cause it to crash when memory is unmapped. Your application can request that this unmapping be deferred by calling the camera_register_resource() function.

When resources are needed elsewhere, your application will receive a CAMERA_STATUS_RESOURCENOTAVAIL status event. The application should immediately cease processing all camera buffers and then call the camera_deregister_resource() function to let the camera service know that it can proceed with cleanup. A timeout limits the amount of time your application has before resources will be forcefully revoked, so it is important to clean up as soon as possible.

Note: You can call the camera_register_resource() function more than once if you wish to perform cleanup on multiple threads, but you must call the camera_deregister_resource() function the same number of times when cleaning up.


CAMERA_OK when the function successfully completes, otherwise another camera_error_t value that provides the reason that the call failed.