static gboolean configure_association (GstSctpDec * self);
static void on_gst_sctp_association_stream_reset (GstSctpAssociation *
gst_sctp_association, guint16 stream_id, GstSctpDec * self);
-static void on_receive (GstSctpAssociation * gst_sctp_association, guint8 * buf,
- gsize length, guint16 stream_id, guint ppid, gpointer user_data);
+static void on_receive (GstSctpAssociation * gst_sctp_association,
+ guint8 * buf, gsize length, guint16 stream_id, guint ppid,
+ gpointer user_data);
static void stop_srcpad_task (GstPad * pad);
static void stop_all_srcpad_tasks (GstSctpDec * self);
static void sctpdec_cleanup (GstSctpDec * self);
}
gst_sctp_association_incoming_packet (self->sctp_association,
- (guint8 *) map.data, (guint32) map.size);
+ (const guint8 *) map.data, (guint32) map.size);
gst_buffer_unmap (buf, &map);
gst_buffer_unref (buf);
}
static void
-on_receive (GstSctpAssociation * sctp_association, guint8 * buf, gsize length,
- guint16 stream_id, guint ppid, gpointer user_data)
+on_receive (GstSctpAssociation * sctp_association, guint8 * buf,
+ gsize length, guint16 stream_id, guint ppid, gpointer user_data)
{
GstSctpDec *self = user_data;
GstSctpDecPad *sctpdec_pad;
g_assert (src_pad);
sctpdec_pad = GST_SCTP_DEC_PAD (src_pad);
- gstbuf = gst_buffer_new_wrapped (buf, length);
+ gstbuf =
+ gst_buffer_new_wrapped_full (0, buf, length, 0, length, buf,
+ (GDestroyNotify) usrsctp_freedumpbuffer);
gst_sctp_buffer_add_receive_meta (gstbuf, ppid);
item = g_new0 (GstDataQueueItem, 1);
}
void
-gst_sctp_association_incoming_packet (GstSctpAssociation * self, guint8 * buf,
- guint32 length)
+gst_sctp_association_incoming_packet (GstSctpAssociation * self,
+ const guint8 * buf, guint32 length)
{
usrsctp_conninput ((void *) self, (const void *) buf, (size_t) length, 0);
}
gboolean
-gst_sctp_association_send_data (GstSctpAssociation * self, guint8 * buf,
+gst_sctp_association_send_data (GstSctpAssociation * self, const guint8 * buf,
guint32 length, guint16 stream_id, guint32 ppid, gboolean ordered,
GstSctpAssociationPartialReliability pr, guint32 reliability_param)
{
if (flags & MSG_NOTIFICATION) {
handle_notification (self, (const union sctp_notification *) data,
datalen);
+
/* We use this instead of a bare `free()` so that we use the `free` from
* the C runtime that usrsctp was built with. This makes a difference on
* Windows where libusrstcp and GStreamer can be linked to two different
{
g_rec_mutex_lock (&self->association_mutex);
if (self->packet_received_cb) {
+ /* It's the callbacks job to free the data correctly */
self->packet_received_cb (self, data, datalen, stream_id, ppid,
self->packet_received_user_data);
+ } else {
+ /* We use this instead of a bare `free()` so that we use the `free` from
+ * the C runtime that usrsctp was built with. This makes a difference on
+ * Windows where libusrstcp and GStreamer can be linked to two different
+ * CRTs. */
+ usrsctp_freedumpbuffer ((gchar *) data);
}
g_rec_mutex_unlock (&self->association_mutex);
}
void gst_sctp_association_set_on_packet_received (GstSctpAssociation * self,
GstSctpAssociationPacketReceivedCb packet_received_cb, gpointer user_data, GDestroyNotify destroy_notify);
void gst_sctp_association_incoming_packet (GstSctpAssociation * self,
- guint8 * buf, guint32 length);
-gboolean gst_sctp_association_send_data (GstSctpAssociation * self,
- guint8 * buf, guint32 length, guint16 stream_id, guint32 ppid,
+ const guint8 * buf, guint32 length);
+gint32 gst_sctp_association_send_data (GstSctpAssociation * self,
+ const guint8 * buf, guint32 length, guint16 stream_id, guint32 ppid,
gboolean ordered, GstSctpAssociationPartialReliability pr,
guint32 reliability_param);
void gst_sctp_association_reset_stream (GstSctpAssociation * self,