Passing pts through gst pipeline c++

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
AMD
• DeepStream Version
deepstream-6.1
• TensorRT Version
tensorrt 8.6.1.6-1+cuda12.0
• NVIDIA GPU Driver Version (valid for GPU only)
Driver Version: 530.30.02
• Issue Type( questions, new requirements, bugs)
bug
• 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)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I have a C++ code where I’m inserting images from a camera into a pipeline and receiving them at the end with detections. I want to manually modify the timestamp (PTS). The issue arises because I initially read the PTS as a constant at the insertion point, and when I change it, it doesn’t seem to reflect on the other end. The PTS timestamp that I read at the end of the pipeline consistently increases. How can I effectively change the PTS so that I can observe the modifications at the end of the pipeline? Here’s a snippet of the code:
SINK:

        if (sample) {
            /* Obtain GstBuffer from sample and then extract metadata from it. */
            buf = gst_sample_get_buffer (sample);
            
            NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
            std::cout << "pts is " <<  GST_BUFFER_PTS(buf) << std::endl;
            for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
            l_frame = l_frame->next) {
                NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
                // int offset = 0;
                for (l_obj = frame_meta->obj_meta_list; l_obj != NULL;
                        l_obj = l_obj->next) {
                    obj_meta = (NvDsObjectMeta *) (l_obj->data);
                    
                    if (obj_meta->class_id == PGIE_CLASS_ID_ORANGE) {
                        orange_count++;
                        num_rects++;
                    }

SOURCE:

                buffer = create_gst_buffer_from_opencv_image(img);
                if (buffer) {
                    GST_BUFFER_TIMESTAMP(buffer) = 100;
                    std::cout << "pts beforeeee is " <<  GST_BUFFER_PTS(buffer) << std::endl;

                    GstFlowReturn gstret = gst_app_src_push_buffer((GstAppSrc *) data->app_source, buffer);
                    if (gstret != GST_FLOW_OK) {
                        g_print("gst_app_src_push_buffer returned %d \n", gstret);
                    }
                }

i get:
pts beforeeee is 100
pts is 5699999943
Top Left: (272.6, 247.9)
Width: 145.0, Height: 146.3
FPS: 30.06
Frame Number = 172 Number of objects = 1 Count = 1

pts beforeeee is 100
pts is 5733333276
Top Left: (272.6, 247.9)
Width: 145.0, Height: 146.3
FPS: 30.07
Frame Number = 173 Number of objects = 1 Count = 1

pts beforeeee is 100
pts is 5766666609
Top Left: (272.6, 247.9)
Width: 145.0, Height: 146.3
FPS: 30.06
Frame Number = 174 Number of objects = 1 Count = 1

pts beforeeee is 100
pts is 5799999942
Top Left: (272.6, 247.9)
Width: 145.0, Height: 146.3
FPS: 30.06
Frame Number = 175 Number of objects = 1 Count = 1

pts beforeeee is 100
pts is 5833333275
Top Left: (272.6, 247.9)
Width: 145.0, Height: 146.3
FPS: 30.06
Frame Number = 176 Number of objects = 1 Count = 1

pts beforeeee is 100
pts is 5866666608
Top Left: (272.6, 247.9)
Width: 145.0, Height: 146.3
FPS: 30.06
Frame Number = 177 Number of objects = 1 Count = 1

pts beforeeee is 100
pts is 5899999941
Top Left: (272.6, 247.9)
Width: 145.0, Height: 146.3
FPS: 30.06
Frame Number = 178 Number of objects = 1 Count = 1

1 Like

There is no update from you for a period, assuming this is not an issue any more. Hence we are closing this topic. If need further support, please open a new one. Thanks.
which sample are you referring to? what is the whole media pipeline? why do you need to change PTS? to narrow down this issue, you can add more probe function to find which element set a new PTS.

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