Hello everyone,
I would like to write an element that adds gst_rtp_buffer_add_extension_onebyte_header to GstRtpBuffer. I am able to add a 4 byte data in a GstBaseTransform element and receive it over RTSP using the following pipelines ------------------------------------------------------------------------------------------------------------ ./test-launch "( audiotestsrc ! audioconvert ! opusenc ! mywriteelement ! rtpopuspay name=pay0 )" gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test ! rtpopusdepay ! myreadelement ! fakesink ------------------------------------------------------------------------------------------------------------- For this, I am using the following in the transform function: static GstFlowReturn gst_youraydio_identity_transform (GstBaseTransform * trans, GstBuffer * in, GstBuffer *out) { GstMyWriteElement *filter = ... GstMapInfo map; if (gst_buffer_map (in, &map, GST_MAP_READ) == FALSE) { g_print ("gst_buffer_map failed\n"); return GST_BASE_TRANSFORM_FLOW_DROPPED; } gst_buffer_fill(out, 0, map.data, map.size); gst_buffer_unmap (in, &map); gst_rtp_buffer_allocate_data (out, 4, 0, 0); guint8 misc_data[4] = { 1, 2, 3, 4 }; GstRTPBuffer rtp = { NULL, }; guint16 bits; guint size; gpointer pointer; gst_rtp_buffer_map (out, GST_MAP_READWRITE, &rtp); gst_rtp_buffer_add_extension_onebyte_header (&rtp, 5, misc_data, 4); gst_rtp_buffer_get_extension_onebyte_header (&rtp, 5, 0, &pointer, &size); guint8 *data = (guint8 *) pointer; printf ("Size: %d Data: %d %d %d %d\n", size, data[0], data[1], data[2], data[3]); gst_rtp_buffer_unmap (&rtp); return GST_FLOW_OK; } ------------------------------------------------------------------------------------------------------------ With the above code, I am able to receive the data added using onbyte_header but the audio doesn't go through. I guess the problem lies in my usage of gst_rtp_buffer_allocate_data which according to the docs [1] says "all previous memory in buffer will be freed". So, if this is the case, how do I preserve data in the GstBuffer and add custom data to GstRtpBuffer. ---------------------------------------------------------------------------------------------------------- I read ndufresne's post here http://gstreamer-devel.966125.n4.nabble.com/streaming-video-metadata-td4669761.html where he has used a pad probe. I can't use that approach because I want to use a gst-rtsp-server factory to stream data. So, I would like to write an element.gst Any possible solutions? Regards Mandar Joshi [1] https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstRTPBuffer.html#gst-rtp-buffer-allocate-data _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thank You ndufresne for your inputs on IRC
I tried using gst_pad_add_probe (..) on the src pad of the payloader in gst-rtsp-server's factory bin but for some reason the pad probe callback never gets called. This is what I have so far https://gist.github.com/mndar/267478e5b102bd1730a2ceb2631332b9 What I am trying to do in the program above is send a onebyte rtp header every second after a rtsp client connects. Could someone please have a look. Thanks Mandar Joshi _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thank you slomo and ndufresne.
Got it working with just one modification to the code above. Connected to the media-constructed signal of the factory and got the pay0 element there. Pad probe now works. Posted the updated code in a comment to the above gist. Thanks Again Mandar Joshi _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |