Hi NVIDIA team,
I’m looking for the recommended way to gracefully stop an nvarguscamerasrc pipeline and ensure that all Argus resources are released.
My pipeline is simply:
gst-launch-1.0 nvarguscamerasrc ! \
'video/x-raw(memory:NVMM), width=4000, height=3000, format=NV12, framerate=30/1' ! \
fakesink
In my application, I try to stop the pipeline by sending an EOS event and waiting for the EOS message from the bus before setting the pipeline to GST_STATE_NULL.
void gst_message_handler(GstElement* pipeline, int gst_msg) {
GstBusPtr bus(gst_element_get_bus(pipeline));
GstMessagePtr msg(
gst_bus_timed_pop_filtered(
bus.get(),
GST_CLOCK_TIME_NONE,
static_cast<GstMessageType>(gst_msg)));
if (msg != nullptr) {
if (GST_MESSAGE_TYPE(msg.get()) == GST_MESSAGE_EOS) {
logging("Receive EOS");
gst_element_set_state(pipeline, GST_STATE_NULL);
} else if (GST_MESSAGE_TYPE(msg.get()) == GST_MESSAGE_ERROR) {
GError* err = nullptr;
gchar* debug_info = nullptr;
gst_message_parse_error(msg.get(), &err, &debug_info);
logging("Gst Message Error: {}", err->message);
g_clear_error(&err);
g_free(debug_info);
}
}
}
auto StopGstThread = std::thread(
[pipeline = _main_pipeline.get()]() {
gst_message_handler(pipeline, GST_MESSAGE_EOS);
});
gst_element_send_event(_main_pipeline.get(), gst_event_new_eos());
if (StopGstThread.joinable()) {
StopGstThread.join();
}
g_main_loop_quit(_main_loop.get());
However, the EOS message never arrives. The thread blocks forever in:
gst_bus_timed_pop_filtered(..., GST_CLOCK_TIME_NONE, GST_MESSAGE_EOS);
As a result, the pipeline never transitions to GST_STATE_NULL.
My questions are:
- Is sending an EOS event the correct way to stop a pipeline using
nvarguscamerasrc? - Does
nvarguscamerasrcsupport propagating EOS, or is there a different recommended shutdown sequence? - What is the proper procedure to ensure all camera/Argus resources are released before restarting the pipeline?
Any guidance or example code would be greatly appreciated. Thanks!