How to modify the initial value of the timestamp(GstBuffer PTS appsrc)

songxiaogang sai19930819 at 163.com
Sat Jun 16 14:08:26 UTC 2018


Hi all,

Recently I have encountered a problem about PTS。

Here is a part of my code:

static void need_data (GstElement * appsrc, guint unused,
MoveSenseWrapperNodelet * pCNodelet)
{
    guint size;
    GstFlowReturn ret;
    GstBuffer *buffer;   
    static GstClockTime timestamp = 3000000000;
    // static GstClockTime timestamp = 0;

    size   = 1280*800*3;
    buffer = gst_buffer_new_allocate (NULL, size, NULL);

    GstMapInfo map;
    gst_buffer_map(buffer,&map,GST_MAP_READ);

    static bool white = true;
    gst_buffer_memset (buffer, 0, white ? 0xff : 0x0, size);
    white = !white;
		
    GST_BUFFER_PTS (buffer)= pCNodelet->timestamp; 
		
    GST_BUFFER_DURATION (buffer)  = gst_util_uint64_scale_int (1,
GST_SECOND, 30);

    pCNodelet->timestamp += GST_BUFFER_DURATION (buffer);
    g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);
    gst_buffer_unmap(buffer,&map);
    gst_buffer_unref(buffer);
    return;
}

When I write : static GstClockTime timestamp = 3000000000; My pipe does not
work until after 3 seconds。

I don't want the initial value of the timestamp to be 0. I want to use
system time as the timestamp。
Can someone tell me how to modify the code? I will be very grateful




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list