End of stream during smart record throwing error: RunUserCallback:199

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) DGPU
• DeepStream Version 6.0
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only) 470.57.02
• Issue Type( questions, new requirements, bugs) question / bug
**• How to reproduce the issue ? **
First, I want to say that smart_record is a great feature and we’ve made very good use of it. I’d like to share that we found that it’s important to join the recordCtx->resetThread in order to reliably stop smart record and complete the process of writing the new video to disk. We need to rename the video file after it’s complete since we can’t customize the file name (would be a very helpful feature, btw) and we struggled for weeks not understanding why the smart_record_callback function we set in recordCtx wasn’t always being called. For anyone else that’s looking around for answers, this snippet might help if it’s placed right after calling NvDsSRStop (please correct me if I’m wrong):

while (!recordCtx->resetThread) {
  NVGSTDS_INFO_MSG_V("recordCtx->resetThread is NULL");
  NVGSTDS_INFO_MSG_V("Joining recordCtx->resetThread");
while (!recordCtx->resetDone) {

After that, you can safely call NvDsSRDestroy. The above works great for RTSP feeds, however, we’ve found that if an EOS event occurs on a video file while smart record is running, we get the RunUserCallback:199 error and the above snippet is of no help; the thread seems to have already been joined (maybe by the RunUserCallback?), but our callback function never gets called and the video file is either corrupted or incomplete. Is there a way to handle the above callback error and finish writing to file gracefully? We tried looping the video file in the hopes that new frames would let the smart_record routine finish, but the RunUserCallback error still gums things up. Any suggestions?

@Fiona.Chen Can I ask for your input on this?

Update: we found that the failure only happens with small cache sizes. For example, if smart-rec-video-cache=2 and smart-rec-start-time=2. The error occurs if the EOS event happens shortly after starting smart record with these values. Must be that it hasn’t had time to fill the buffer, which is understandable. However, we still need a way to handle this error.

Having the same issue: NvDsSRDestroy(context) causes a lockup if any recording is in progress…1 camera, 5 cameras, 9 cameras, 12 cameras, …doesn’t matter. We’ve also tried the code snippet above right after the NvDsSRStop, but this doesn’t seem to fix anything.

We are also DGPU, DS 6.0, Nvidia Driver 470.63.01.

@Fiona.Chen any thoughts? We still need a way to handle this error.

any thoughts?