Use gst_buffer_new_memdup()

Update for function rename in core.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/827

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2281>
This commit is contained in:
Tim-Philipp Müller 2021-05-24 18:34:25 +01:00
parent a0b37e9d1a
commit 8e04651b8b
11 changed files with 34 additions and 25 deletions

View file

@ -754,7 +754,7 @@ gst_av1_enc_process (GstAV1Enc * encoder)
}
frame->output_buffer =
gst_buffer_new_copy (pkt->data.frame.buf, pkt->data.frame.sz);
gst_buffer_new_memdup (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);

View file

@ -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_copy (cp->value, pssi_len);
pssi = gst_buffer_new_memdup (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

View file

@ -433,7 +433,8 @@ on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
self->srtp_cipher = cipher;
self->srtp_auth = auth;
new_decoder_key = gst_buffer_new_copy (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
new_decoder_key =
gst_buffer_new_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
if (self->decoder_key)
gst_buffer_unref (self->decoder_key);

View file

@ -641,7 +641,8 @@ on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
self->srtp_cipher = cipher;
self->srtp_auth = auth;
new_encoder_key = gst_buffer_new_copy (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
new_encoder_key =
gst_buffer_new_memdup (key, GST_DTLS_SRTP_MASTER_KEY_LENGTH);
if (self->encoder_key)
gst_buffer_unref (self->encoder_key);
@ -665,7 +666,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_copy (data, length) : NULL;
buffer = data ? gst_buffer_new_memdup (data, length) : NULL;
GST_TRACE_OBJECT (self, "send data: acquiring lock");
g_mutex_lock (&self->queue_lock);

View file

@ -398,7 +398,7 @@ gst_fdkaacenc_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
/* raw */
if (transmux == 0) {
GstBuffer *codec_data =
gst_buffer_new_copy (enc_info.confBuf, enc_info.confSize);
gst_buffer_new_memdup (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);

View file

@ -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_copy (buf, length);
gstbuf = gst_buffer_new_memdup (buf, length);
item = g_new0 (GstDataQueueItem, 1);
item->object = GST_MINI_OBJECT (gstbuf);

View file

@ -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_copy (ptr, count);
GstBuffer *buffer = gst_buffer_new_memdup (ptr, count);
if (gst_pad_push (self->srcpad, buffer) == GST_FLOW_OK) {
return count;

View file

@ -802,7 +802,7 @@ gst_av1_parse_push_data (GstAV1Parse * self, GstBaseParseFrame * frame,
_write_leb128 (size_data, &size_len, len);
gst_adapter_push (self->cache_out,
gst_buffer_new_copy (size_data, size_len));
gst_buffer_new_memdup (size_data, size_len));
gst_adapter_push (self->cache_out, buf);
}
@ -814,7 +814,7 @@ gst_av1_parse_push_data (GstAV1Parse * self, GstBaseParseFrame * frame,
_write_leb128 (size_data, &size_len, len);
gst_adapter_push (self->cache_out,
gst_buffer_new_copy (size_data, size_len));
gst_buffer_new_memdup (size_data, size_len));
gst_adapter_push (self->cache_out, buf);
}
}
@ -915,7 +915,7 @@ gst_av1_parse_convert_to_annexb (GstAV1Parse * self, GstAV1OBU * obu,
/* frame_unit_size */
_write_leb128 (size_data, &size_len, len2);
gst_adapter_push (self->cache_out,
gst_buffer_new_copy (size_data, size_len));
gst_buffer_new_memdup (size_data, size_len));
gst_adapter_push (self->cache_out, buf2);
}
@ -1002,7 +1002,7 @@ gst_av1_parse_cache_one_obu (GstAV1Parse * self, GstAV1OBU * obu,
g_assert (self->in_align == GST_AV1_PARSE_ALIGN_TEMPORAL_UNIT_ANNEX_B);
gst_av1_parse_convert_to_annexb (self, obu, frame_complete);
} else {
buf = gst_buffer_new_copy (data, size);
buf = gst_buffer_new_memdup (data, size);
gst_adapter_push (self->cache_out, buf);
}
}

View file

@ -304,7 +304,7 @@ gst_mpeg4vparse_process_config (GstMpeg4VParse * mp4vparse,
if (mp4vparse->config != NULL)
gst_buffer_unref (mp4vparse->config);
mp4vparse->config = gst_buffer_new_copy (data, size);
mp4vparse->config = gst_buffer_new_memdup (data, size);
/* trigger src caps update */
mp4vparse->update_caps = TRUE;

View file

@ -271,7 +271,7 @@ GST_START_TEST (test_kate_typefind)
GstBuffer *buf;
GstCaps *caps = NULL;
buf = gst_buffer_new_copy (kate_header_0x80, sizeof (kate_header_0x80));
buf = gst_buffer_new_memdup (kate_header_0x80, sizeof (kate_header_0x80));
GST_BUFFER_OFFSET (buf) = 0;
caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
@ -343,7 +343,8 @@ GST_START_TEST (test_kate_identification_header)
gst_check_setup_events (mydecsrcpad, katedec, caps, GST_FORMAT_TIME);
gst_caps_unref (caps);
inbuffer = gst_buffer_new_copy (kate_header_0x80, sizeof (kate_header_0x80));
inbuffer =
gst_buffer_new_memdup (kate_header_0x80, sizeof (kate_header_0x80));
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
gst_buffer_ref (inbuffer);
@ -355,7 +356,8 @@ GST_START_TEST (test_kate_identification_header)
gst_buffer_unref (inbuffer);
fail_unless (g_list_length (buffers) == 0);
inbuffer = gst_buffer_new_copy (kate_header_0x81, sizeof (kate_header_0x81));
inbuffer =
gst_buffer_new_memdup (kate_header_0x81, sizeof (kate_header_0x81));
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
gst_buffer_ref (inbuffer);
@ -487,7 +489,7 @@ GST_START_TEST (test_kate_encode_simple)
"could not set to playing");
bus = gst_bus_new ();
inbuffer = gst_buffer_new_copy (test_string, strlen (test_string) + 1);
inbuffer = gst_buffer_new_memdup (test_string, strlen (test_string) + 1);
GST_BUFFER_TIMESTAMP (inbuffer) = GST_BUFFER_OFFSET (inbuffer) =
1 * GST_SECOND;
@ -540,7 +542,7 @@ GST_START_TEST (test_kate_encode_spu)
"could not set to playing");
bus = gst_bus_new ();
inbuffer = gst_buffer_new_copy (kate_spu, sizeof (kate_spu));
inbuffer = gst_buffer_new_memdup (kate_spu, sizeof (kate_spu));
GST_BUFFER_TIMESTAMP (inbuffer) = GST_BUFFER_OFFSET (inbuffer) =
1 * GST_SECOND;
@ -657,17 +659,19 @@ test_kate_send_headers (GstElement * element, GstPad * pad)
gst_caps_unref (caps);
/* push headers */
inbuffer = gst_buffer_new_copy (kate_header_0x80, sizeof (kate_header_0x80));
inbuffer =
gst_buffer_new_memdup (kate_header_0x80, sizeof (kate_header_0x80));
GST_BUFFER_OFFSET (inbuffer) = GST_BUFFER_OFFSET_END (inbuffer) = 0;
fail_unless_equals_int (gst_pad_push (pad, inbuffer), GST_FLOW_OK);
inbuffer = gst_buffer_new_copy (kate_header_0x81, sizeof (kate_header_0x81));
inbuffer =
gst_buffer_new_memdup (kate_header_0x81, sizeof (kate_header_0x81));
GST_BUFFER_OFFSET (inbuffer) = GST_BUFFER_OFFSET_END (inbuffer) = 0;
fail_unless_equals_int (gst_pad_push (pad, inbuffer), GST_FLOW_OK);
for (i = 2; i < 8; ++i) {
inbuffer =
gst_buffer_new_copy (kate_header_0x8x, sizeof (kate_header_0x8x));
gst_buffer_new_memdup (kate_header_0x8x, sizeof (kate_header_0x8x));
fail_if (gst_buffer_map (inbuffer, &info, GST_MAP_WRITE) != TRUE);
info.data[0] = 0x80 | i;
gst_buffer_unmap (inbuffer, &info);
@ -675,7 +679,8 @@ test_kate_send_headers (GstElement * element, GstPad * pad)
fail_unless_equals_int (gst_pad_push (pad, inbuffer), GST_FLOW_OK);
}
inbuffer = gst_buffer_new_copy (kate_header_0x88, sizeof (kate_header_0x88));
inbuffer =
gst_buffer_new_memdup (kate_header_0x88, sizeof (kate_header_0x88));
GST_BUFFER_OFFSET (inbuffer) = GST_BUFFER_OFFSET_END (inbuffer) = 0;
fail_unless_equals_int (gst_pad_push (pad, inbuffer), GST_FLOW_OK);
}
@ -697,7 +702,8 @@ GST_START_TEST (test_kate_parse)
test_kate_send_headers (kateparse, myparsesrcpad);
/* push a text packet */
inbuffer = gst_buffer_new_copy (kate_header_0x00, sizeof (kate_header_0x00));
inbuffer =
gst_buffer_new_memdup (kate_header_0x00, sizeof (kate_header_0x00));
GST_BUFFER_TIMESTAMP (inbuffer) = GST_BUFFER_OFFSET (inbuffer) =
1 * GST_SECOND;
GST_BUFFER_DURATION (inbuffer) = 5 * GST_SECOND;
@ -705,7 +711,8 @@ GST_START_TEST (test_kate_parse)
fail_unless_equals_int (gst_pad_push (myparsesrcpad, inbuffer), GST_FLOW_OK);
/* push a eos packet */
inbuffer = gst_buffer_new_copy (kate_header_0x7f, sizeof (kate_header_0x7f));
inbuffer =
gst_buffer_new_memdup (kate_header_0x7f, sizeof (kate_header_0x7f));
GST_BUFFER_TIMESTAMP (inbuffer) = GST_BUFFER_OFFSET (inbuffer) =
6 * GST_SECOND;
GST_BUFFER_DURATION (inbuffer) = 0;

View file

@ -97,7 +97,7 @@ GST_START_TEST (test_parse_zerosize_frames)
data_size = sizeof (zerosize_data);
in_buf = gst_buffer_new_copy (zerosize_data, data_size);
in_buf = gst_buffer_new_memdup (zerosize_data, data_size);
gst_harness_push (h, in_buf);
gst_harness_play (h);