Possible GstSharp Bug
Jon Lovewell
jon at csoftware.co.uk
Thu Nov 21 14:29:11 UTC 2019
Hello everyone
I am trying to add a one byte header extension to RTP packets using GstSharp without any success.
Platform: Windows
GStreamer: V1.16.0
GstSharp: V1.16.0
I am adding the header extension using a DataProbe on the source pad of the RTP Payloader
Using native c code as below everything works fine and I can see the extension on the Access-Delimiter packets in Wireshark
static GstPadProbeReturn cb_have_data(GstPad* pad, GstPadProbeInfo* info, gpointer user_data)
{
GstBuffer* buffer;
buffer = GST_PAD_PROBE_INFO_BUFFER(info);
buffer = gst_buffer_make_writable(buffer);
/* Making a buffer writable can fail (for example if it
* cannot be copied and is used more than once)
*/
if (buffer == NULL)
return GST_PAD_PROBE_OK;
/* Calling gst_rtp_buffer_map fails unless we use GST_RTP_BUFFER_INIT
* Asserts that rtp->buffer == NULL is false
*/
GstRTPBuffer rtp_buffer = GST_RTP_BUFFER_INIT;
if (gst_rtp_buffer_map(buffer, GST_MAP_READWRITE, &rtp_buffer))
{
const gchar* data = "Test";
gboolean added = gst_rtp_buffer_add_extension_onebyte_header(&rtp_buffer, 1, data, sizeof(data));
gst_rtp_buffer_unmap(&rtp_buffer);
}
return GST_PAD_PROBE_OK;
}
Using the C# wrapper the underlying code asserts that rtp->buffer == NULL is false.
Looking at the Wrapper code it would appear that it passes in an uninitialized chunk of memory as below
public static bool Map(Gst.Buffer buffer, Gst.MapFlags flags, out Gst.Rtp.RTPBuffer rtp) {
IntPtr native_rtp = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (Gst.Rtp.RTPBuffer)));
bool raw_ret = gst_rtp_buffer_map(buffer == null ? IntPtr.Zero : buffer.Handle, (int) flags, native_rtp);
bool ret = raw_ret;
rtp = Gst.Rtp.RTPBuffer.New (native_rtp);
Marshal.FreeHGlobal (native_rtp);
return ret;
}
I am unsure if this is a bug in the GstSharp Code or whether it would be in the core code, ie the GstRTPBuffer code should do the initialization
Kind Regards
Jon L
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20191121/77b7e6c4/attachment.html>
More information about the gstreamer-devel
mailing list