Clarification needed for nvds_acquire_meta_lock/unlock

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU): GPU
• DeepStream Version: 6.4
• JetPack Version (valid for Jetson only): NA
• TensorRT Version: 8.6
• NVIDIA GPU Driver Version (valid for GPU only): 535
• Issue Type( questions, new requirements, bugs): questions
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing): na
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description): na

What operations must absolutely be done inside the the critical section between nvds_acquire_meta_lock & nvds_acquire_meta_unlock?

I’ve looked into multiple examples & plugin source code that has attach_metadata function and I can’t find the common denominator among them to answer the above question.

For example:

  • osd_sink_pad_buffer_probe() in deepstream_test1_app.c has no critical section
  • attach_metadata_object() in gstdsexample_optimized.cpp put nvds_acquire_classifier_meta_from_pool() outside the critical section
  • attach_metadata_classifier() in gstnvinfer_meta_utils.cpp put everything (acquire, modify, attach) inside the critical section
  • attachMetadata() in post_processor_classify.cpp put everything (acquire, modify, attach) inside the critical section

I infer from example code the following:

  • Acquire metadata: can be outside critical section
  • Modify acquired metadata before attachment: can be outside critical section
  • Attach metadata: can be outside critical section
  • Modify existing metadata: must be inside critical section

I’m not sure if the rules above are correct and complete. So what operations must absolutely be done inside the the critical section between nvds_acquire_meta_lock & nvds_acquire_meta_unlock?

You can check meta_mutex in the NvDsBatchMeta structure. Theoretically, it should be used when multiple components are modifying the NvDsBatchMeta at the same time.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.