mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
Use new gst_buffer_new_copy()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2279>
This commit is contained in:
parent
87d97f01f5
commit
0151276d7f
11 changed files with 32 additions and 52 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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_wrapped (g_memdup (size_data, size_len), size_len));
|
||||
gst_buffer_new_copy (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_wrapped (g_memdup (size_data, size_len), size_len));
|
||||
gst_buffer_new_copy (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_wrapped (g_memdup (size_data, size_len), size_len));
|
||||
gst_buffer_new_copy (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_wrapped (g_memdup (data, size), size);
|
||||
buf = gst_buffer_new_copy (data, size);
|
||||
gst_adapter_push (self->cache_out, buf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,7 +304,7 @@ gst_mpeg4vparse_process_config (GstMpeg4VParse * mp4vparse,
|
|||
if (mp4vparse->config != NULL)
|
||||
gst_buffer_unref (mp4vparse->config);
|
||||
|
||||
mp4vparse->config = gst_buffer_new_wrapped (g_memdup (data, size), size);
|
||||
mp4vparse->config = gst_buffer_new_copy (data, size);
|
||||
|
||||
/* trigger src caps update */
|
||||
mp4vparse->update_caps = TRUE;
|
||||
|
|
|
@ -271,8 +271,7 @@ GST_START_TEST (test_kate_typefind)
|
|||
GstBuffer *buf;
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
buf = gst_buffer_new_wrapped (g_memdup (kate_header_0x80,
|
||||
sizeof (kate_header_0x80)), sizeof (kate_header_0x80));
|
||||
buf = gst_buffer_new_copy (kate_header_0x80, sizeof (kate_header_0x80));
|
||||
GST_BUFFER_OFFSET (buf) = 0;
|
||||
|
||||
caps = gst_type_find_helper_for_buffer (NULL, buf, &prob);
|
||||
|
@ -344,8 +343,7 @@ 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_wrapped (g_memdup (kate_header_0x80,
|
||||
sizeof (kate_header_0x80)), sizeof (kate_header_0x80));
|
||||
inbuffer = gst_buffer_new_copy (kate_header_0x80, sizeof (kate_header_0x80));
|
||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||
gst_buffer_ref (inbuffer);
|
||||
|
||||
|
@ -357,8 +355,7 @@ GST_START_TEST (test_kate_identification_header)
|
|||
gst_buffer_unref (inbuffer);
|
||||
fail_unless (g_list_length (buffers) == 0);
|
||||
|
||||
inbuffer = gst_buffer_new_wrapped (g_memdup (kate_header_0x81,
|
||||
sizeof (kate_header_0x81)), sizeof (kate_header_0x81));
|
||||
inbuffer = gst_buffer_new_copy (kate_header_0x81, sizeof (kate_header_0x81));
|
||||
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
||||
gst_buffer_ref (inbuffer);
|
||||
|
||||
|
@ -490,8 +487,7 @@ GST_START_TEST (test_kate_encode_simple)
|
|||
"could not set to playing");
|
||||
bus = gst_bus_new ();
|
||||
|
||||
inbuffer = gst_buffer_new_wrapped (g_memdup (test_string,
|
||||
strlen (test_string) + 1), strlen (test_string) + 1);
|
||||
inbuffer = gst_buffer_new_copy (test_string, strlen (test_string) + 1);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (inbuffer) = GST_BUFFER_OFFSET (inbuffer) =
|
||||
1 * GST_SECOND;
|
||||
|
@ -544,8 +540,7 @@ GST_START_TEST (test_kate_encode_spu)
|
|||
"could not set to playing");
|
||||
bus = gst_bus_new ();
|
||||
|
||||
inbuffer = gst_buffer_new_wrapped (g_memdup (kate_spu, sizeof (kate_spu)),
|
||||
sizeof (kate_spu));
|
||||
inbuffer = gst_buffer_new_copy (kate_spu, sizeof (kate_spu));
|
||||
|
||||
GST_BUFFER_TIMESTAMP (inbuffer) = GST_BUFFER_OFFSET (inbuffer) =
|
||||
1 * GST_SECOND;
|
||||
|
@ -662,19 +657,17 @@ test_kate_send_headers (GstElement * element, GstPad * pad)
|
|||
gst_caps_unref (caps);
|
||||
|
||||
/* push headers */
|
||||
inbuffer = gst_buffer_new_wrapped (g_memdup (kate_header_0x80,
|
||||
sizeof (kate_header_0x80)), sizeof (kate_header_0x80));
|
||||
inbuffer = gst_buffer_new_copy (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_wrapped (g_memdup (kate_header_0x81,
|
||||
sizeof (kate_header_0x81)), sizeof (kate_header_0x81));
|
||||
inbuffer = gst_buffer_new_copy (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_wrapped (g_memdup (kate_header_0x8x,
|
||||
sizeof (kate_header_0x8x)), sizeof (kate_header_0x8x));
|
||||
inbuffer =
|
||||
gst_buffer_new_copy (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);
|
||||
|
@ -682,8 +675,7 @@ test_kate_send_headers (GstElement * element, GstPad * pad)
|
|||
fail_unless_equals_int (gst_pad_push (pad, inbuffer), GST_FLOW_OK);
|
||||
}
|
||||
|
||||
inbuffer = gst_buffer_new_wrapped (g_memdup (kate_header_0x88,
|
||||
sizeof (kate_header_0x88)), sizeof (kate_header_0x88));
|
||||
inbuffer = gst_buffer_new_copy (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);
|
||||
}
|
||||
|
@ -705,8 +697,7 @@ GST_START_TEST (test_kate_parse)
|
|||
test_kate_send_headers (kateparse, myparsesrcpad);
|
||||
|
||||
/* push a text packet */
|
||||
inbuffer = gst_buffer_new_wrapped (g_memdup (kate_header_0x00,
|
||||
sizeof (kate_header_0x00)), sizeof (kate_header_0x00));
|
||||
inbuffer = gst_buffer_new_copy (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;
|
||||
|
@ -714,8 +705,7 @@ 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_wrapped (g_memdup (kate_header_0x7f,
|
||||
sizeof (kate_header_0x7f)), sizeof (kate_header_0x7f));
|
||||
inbuffer = gst_buffer_new_copy (kate_header_0x7f, sizeof (kate_header_0x7f));
|
||||
GST_BUFFER_TIMESTAMP (inbuffer) = GST_BUFFER_OFFSET (inbuffer) =
|
||||
6 * GST_SECOND;
|
||||
GST_BUFFER_DURATION (inbuffer) = 0;
|
||||
|
|
|
@ -97,8 +97,7 @@ GST_START_TEST (test_parse_zerosize_frames)
|
|||
|
||||
data_size = sizeof (zerosize_data);
|
||||
|
||||
in_buf = gst_buffer_new_wrapped (g_memdup (zerosize_data, data_size),
|
||||
data_size);
|
||||
in_buf = gst_buffer_new_copy (zerosize_data, data_size);
|
||||
|
||||
gst_harness_push (h, in_buf);
|
||||
gst_harness_play (h);
|
||||
|
|
Loading…
Reference in a new issue