Avoid data copying for appsink and tee

Stefan Persson johli392 at student.liu.se
Tue May 7 19:20:56 UTC 2019

Thanks for the help!

>You can then implement allocation query to advertise video meta, or replace
the tee/appsink with a pad probe. Just ping again if you need more details
about this alternative.

I'm investigating the pad probe but got stuck trying to read the raw pixel
data from the video buffer.

My pipeline is the following:
tcpserversrc ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !
autovideosink name=sink

I attach the pad probe with:
GstPad *pad = gst_element_get_static_pad(ctx->sink, "sink");
gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, (GstPadProbeCallback)
gst_probe_callback, ctx, NULL);

The callback is:
static GstPadProbeReturn gst_probe_callback(GstPad *pad, GstPadProbeInfo
*info, GstContext *ctx) {
  GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
  GstMapInfo map;
  gst_buffer_map(buffer, &map, GST_MAP_READ);
  int offset = 0;
  while (offset < map.size && offset < 20000) {
    /* Data is in map.data? */
    /* *(map.data + offset) /*
    /* This is random (and often just 0). */

Since the platform is Android the autovideosink surface is an Android
Surface object received from the Java side via JNI/NDK and configured with 
gst_video_overlay_set_window_handle. Video playback works fine. It's just
the pixel data that is strange (or undefined?)

What step am I missing or doing wrong?

Best Regards

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

More information about the gstreamer-devel mailing list