Avoid data copying for appsink and tee

Nicolas Dufresne nicolas at ndufresne.ca
Wed May 8 13:05:17 UTC 2019


Le mer. 8 mai 2019 06 h 56, Stefan Persson <johli392 at student.liu.se> a
écrit :

> 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);
>

Check your return value here if you are fan of memory safe code.

For video frames, it's recommended to use GstVideoFrame wrapper to
map/unmap.

  int offset = 0;
>   while (offset < map.size && offset < 20000) {
>     /* Data is in map.data? */
>     /* *(map.data + offset) /*
>     /* This is random (and often just 0).


0 could be valid, and a video image can look random.

*/
>   }
> }
>
> 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
> Stefan
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190508/d62ec408/attachment.html>


More information about the gstreamer-devel mailing list