Change gst-nvinferserver "interval" value after pipeline is running

Noted. I’ve made a few changes to use gst_nvevent_infer_interval_update from
opt\nvidia\deepstream\deepstream\sources\libs\gstnvdscustomhelper\gst-nvdscustomevent.c
Following this link I created a function that is callable from Python and within the binding function it creates a custom event followed by which it tries to send the event to the sink element of nvinferserver. However, I’m getting a segmentation fault while trying to send the event.

In my python code, I invoke the bindings function like

def callback():
    interval = 10
    pyds.gst_element_send_nvevent_interval_update(sys.getsizeof(pgie), '0', interval)

def main():
    global pgie
    pgie = Gst.ElementFactory.make("nvinferserver", "primary-inference")
    if not pgie:
        sys.stderr.write(" Unable to create pgie \n")

    pgie.set_property('config-file-path', 'config.txt')

In bindfunctions.cpp, I’ve created

        m.def("gst_element_send_nvevent_interval_update",
              [](size_t gst_element, char* stream_id, int interval) {
                  auto *element = reinterpret_cast<GstElement *>(gst_element);
                  std::cout << "Reached gst_element_send_nvevent_interval_update\n";
                  //Code below seg-faults
                  return gst_element_send_event(element, gst_nvevent_infer_interval_update(stream_id, interval));
              },
              pydsdoc::methodsDoc::gst_element_send_nvevent_interval_update);

I’ve made a few other changes, but the overall compilation works fine and I’m able to reach the binding function. However it results in a seg fault when trying to send the event (I’m guessing due to improper casting). Any thoughts on this?

If the casting works fine then I’m hoping to reach gst_nvinfer_server_sink_event() in opt\nvidia\deepstream\deepstream\sources\gst-plugins\gst-nvinferserver\gstnvinferserver.cpp. Am I correct in assuming this?

BTW I have to also pass stream_id to gst_nvevent_infer_interval_update. How can I get this value in the python workflow?