summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2021-05-23 16:10:53 +0100
committerTim-Philipp Müller <tim@centricular.com>2021-05-23 17:20:16 +0100
commit0151276d7f89cfe84050c67823966d2579dbc13a (patch)
treea7a06f3ef30ba35055e2cd1fe7b1e5d7b5f4b3e3 /ext
parent87d97f01f59e73a906a488308bfff8b872c93c1a (diff)
downloadgstreamer-plugins-bad-0151276d7f89cfe84050c67823966d2579dbc13a.tar.gz
Use new gst_buffer_new_copy()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2279>
Diffstat (limited to 'ext')
-rw-r--r--ext/aom/gstav1enc.c3
-rw-r--r--ext/dash/gstdashdemux.c2
-rw-r--r--ext/dtls/gstdtlsdec.c11
-rw-r--r--ext/dtls/gstdtlsenc.c14
-rw-r--r--ext/fdkaac/gstfdkaacenc.c3
-rw-r--r--ext/sctp/gstsctpenc.c2
-rw-r--r--ext/sndfile/gstsfdec.c2
7 files changed, 14 insertions, 23 deletions
diff --git a/ext/aom/gstav1enc.c b/ext/aom/gstav1enc.c
index 3bae5f87d..5ced11852 100644
--- a/ext/aom/gstav1enc.c
+++ b/ext/aom/gstav1enc.c
@@ -754,8 +754,7 @@ gst_av1_enc_process (GstAV1Enc * encoder)
}
frame->output_buffer =
- gst_buffer_new_wrapped (g_memdup (pkt->data.frame.buf,
- pkt->data.frame.sz), pkt->data.frame.sz);
+ gst_buffer_new_copy (pkt->data.frame.buf, pkt->data.frame.sz);
if ((pkt->data.frame.flags & AOM_FRAME_IS_DROPPABLE) != 0)
GST_BUFFER_FLAG_SET (frame->output_buffer, GST_BUFFER_FLAG_DROPPABLE);
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c
index e38240800..cf2581bed 100644
--- a/ext/dash/gstdashdemux.c
+++ b/ext/dash/gstdashdemux.c
@@ -897,7 +897,7 @@ gst_dash_demux_send_content_protection_event (gpointer data, gpointer userdata)
schemeIdUri = g_ascii_strdown (cp->schemeIdUri, -1);
if (g_str_has_prefix (schemeIdUri, "urn:uuid:")) {
pssi_len = strlen (cp->value);
- pssi = gst_buffer_new_wrapped (g_memdup (cp->value, pssi_len), pssi_len);
+ pssi = gst_buffer_new_copy (cp->value, pssi_len);
GST_LOG_OBJECT (stream, "Queuing Protection event on source pad");
/* RFC 4122 states that the hex part of a UUID is in lower case,
* but some streams seem to ignore this and use upper case for the
diff --git a/ext/dtls/gstdtlsdec.c b/ext/dtls/gstdtlsdec.c
index f96dd753e..8efcac44d 100644
--- a/ext/dtls/gstdtlsdec.c
+++ b/ext/dtls/gstdtlsdec.c
@@ -425,7 +425,7 @@ static void
on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
guint auth, GstDtlsDec * self)
{
- gpointer key_dup;
+ GstBuffer *new_decoder_key;
gchar *key_str;
g_return_if_fail (GST_IS_DTLS_DEC (self));
@@ -433,15 +433,12 @@ on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
self->srtp_cipher = cipher;
self->srtp_auth = auth;
- key_dup = g_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+ new_decoder_key = gst_buffer_new_copy (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
- if (self->decoder_key) {
+ if (self->decoder_key)
gst_buffer_unref (self->decoder_key);
- self->decoder_key = NULL;
- }
- self->decoder_key =
- gst_buffer_new_wrapped (key_dup, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+ self->decoder_key = new_decoder_key;
key_str = g_base64_encode (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
GST_INFO_OBJECT (self, "received key: %s", key_str);
diff --git a/ext/dtls/gstdtlsenc.c b/ext/dtls/gstdtlsenc.c
index 860671c8d..4761b39e2 100644
--- a/ext/dtls/gstdtlsenc.c
+++ b/ext/dtls/gstdtlsenc.c
@@ -632,7 +632,7 @@ static void
on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
guint auth, GstDtlsEnc * self)
{
- gpointer key_dup;
+ GstBuffer *new_encoder_key;
gchar *key_str;
g_return_if_fail (GST_IS_DTLS_ENC (self));
@@ -641,15 +641,12 @@ on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
self->srtp_cipher = cipher;
self->srtp_auth = auth;
- key_dup = g_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+ new_encoder_key = gst_buffer_new_copy (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
- if (self->encoder_key) {
+ if (self->encoder_key)
gst_buffer_unref (self->encoder_key);
- self->encoder_key = NULL;
- }
- self->encoder_key =
- gst_buffer_new_wrapped (key_dup, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
+ self->encoder_key = new_encoder_key;
key_str = g_base64_encode (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
GST_INFO_OBJECT (self, "received key: %s", key_str);
@@ -668,8 +665,7 @@ on_send_data (GstDtlsConnection * connection, gconstpointer data, gsize length,
GST_DEBUG_OBJECT (self, "sending data from %s with length %" G_GSIZE_FORMAT,
self->connection_id, length);
- buffer =
- data ? gst_buffer_new_wrapped (g_memdup (data, length), length) : NULL;
+ buffer = data ? gst_buffer_new_copy (data, length) : NULL;
GST_TRACE_OBJECT (self, "send data: acquiring lock");
g_mutex_lock (&self->queue_lock);
diff --git a/ext/fdkaac/gstfdkaacenc.c b/ext/fdkaac/gstfdkaacenc.c
index ad405f1f4..498a44adf 100644
--- a/ext/fdkaac/gstfdkaacenc.c
+++ b/ext/fdkaac/gstfdkaacenc.c
@@ -398,8 +398,7 @@ gst_fdkaacenc_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
/* raw */
if (transmux == 0) {
GstBuffer *codec_data =
- gst_buffer_new_wrapped (g_memdup (enc_info.confBuf, enc_info.confSize),
- enc_info.confSize);
+ gst_buffer_new_copy (enc_info.confBuf, enc_info.confSize);
gst_caps_set_simple (src_caps, "codec_data", GST_TYPE_BUFFER, codec_data,
"stream-format", G_TYPE_STRING, "raw", NULL);
gst_buffer_unref (codec_data);
diff --git a/ext/sctp/gstsctpenc.c b/ext/sctp/gstsctpenc.c
index e420fe0c8..71b0f08b0 100644
--- a/ext/sctp/gstsctpenc.c
+++ b/ext/sctp/gstsctpenc.c
@@ -896,7 +896,7 @@ on_sctp_packet_out (GstSctpAssociation * _association, const guint8 * buf,
GST_DEBUG_OBJECT (self, "Received output packet of size %" G_GSIZE_FORMAT,
length);
- gstbuf = gst_buffer_new_wrapped (g_memdup (buf, length), length);
+ gstbuf = gst_buffer_new_copy (buf, length);
item = g_new0 (GstDataQueueItem, 1);
item->object = GST_MINI_OBJECT (gstbuf);
diff --git a/ext/sndfile/gstsfdec.c b/ext/sndfile/gstsfdec.c
index 646f9535c..59d14cd7a 100644
--- a/ext/sndfile/gstsfdec.c
+++ b/ext/sndfile/gstsfdec.c
@@ -128,7 +128,7 @@ static sf_count_t
gst_sf_vio_write (const void *ptr, sf_count_t count, void *user_data)
{
GstSFDec *self = GST_SF_DEC (user_data);
- GstBuffer *buffer = gst_buffer_new_wrapped (g_memdup (ptr, count), count);
+ GstBuffer *buffer = gst_buffer_new_copy (ptr, count);
if (gst_pad_push (self->srcpad, buffer) == GST_FLOW_OK) {
return count;