prominenceai / deepstream-services-library

A shared library of on-demand DeepStream Pipeline Services for Python and C/C++
MIT License
288 stars 67 forks source link

Implement dsl_infer_gie_model_update_listener_add/remove services for async model update notifications #1297

Closed rjhowell44 closed 3 weeks ago

rjhowell44 commented 1 month ago

The nvinfer plugin implements a model-updated signal. Clients that initiate a model update by dsl_infer_config_file_set at runtime, should be able to add a listener function to to be notified when the update has completed.

New symbolic constants

#define DSL_RESULT_INFER_CALLBACK_ADD_FAILED                        0x0006000F
#define DSL_RESULT_INFER_CALLBACK_REMOVE_FAILED                     0x00060010

New callback typedef

/**
 * @brief Callback typedef for Primary or Secondary GIE to notify clients when a 
 * model engine has been successfully updated.
 * @param name name of the Primary or Secondary GIE calling this function.
 * @param model_engine_file path to the new model engine file in use.
 * @param[in] client_data opaque pointer to client's user data.
 */
typedef void (*dsl_infer_gie_model_update_listener_cb)(const wchar_t* name,
    const wchar_t* model_engine_file, void* client_data);

New listener add/remove services

/**
 * @brief Adds a model update listener callback to a named Primary or Secondary GIE.
 * @param name name of the Primary or Secondary GIE to update.
 * @param listener callback function to add.
 * @param client_data opaque pointer to client data passed to the listener function.
 * @return DSL_RESULT_SUCCESS on success, DSL_RESULT_INFER_RESULT otherwise.
 */
DslReturnType dsl_infer_gie_model_update_listener_add(const wchar_t* name,
    dsl_infer_gie_model_update_listener_cb listener, void* client_data);

/**
 * @brief Removes a model update listener callback to a named Primary or Secondary GIE.
 * @param name name of the Primary or Secondary GIE to update.
 * @param listener callback function to add.
 * @param client_data opaque pointer to client data passed to the listener function.
 * @return DSL_RESULT_SUCCESS on success, DSL_RESULT_INFER_RESULT otherwise.
 */
DslReturnType dsl_infer_gie_model_update_listener_remove(const wchar_t* name,
    dsl_infer_gie_model_update_listener_cb listener);