0

I have a simple mjpeg pipeline and I want to access the buffer on the sink to get the pts to calculate the latency.

Pipeline: souphttpsrc -> jpegparse -> imxvpudec -> imxipusink

What is the best way to do this? Some code examples would be great. The time things in gstreamer confusing me a little bit.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Christoph Acs
  • 68
  • 1
  • 10

1 Answers1

3

I'd add an identity element in your pipeline where you want to analyze the PTS:

souphttpsrc ! jpegparse ! identity ! imxvpudec ! imxipusink

Then connect to the "handoff" signal:

static void pts_analysis_cb(GstElement *identity, 
                            GstBuffer *buffer,
                            gpointer user_data) {
   GstClockTime pts = GST_BUFFER_PTS(buffer);
   //analysis
}

g_signal_connect_data(identity, "handoff", 
                      G_CALLBACK(pts_analysis_cb), 
                      NULL, NULL, GConnectFlags());

If you're seeing MJPEG related latency though you may just need to have sync=false on your tail element or set flags to drop buffers if it's falling behind.

mpr
  • 3,250
  • 26
  • 44