mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
videoencoder: Simplify header buffer metadata updating
Instead of doing a shallow copy of the list just to call make_writable() on each buffer, do that inline in the same loop and modify the list contents. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/683>
This commit is contained in:
parent
caaa5ac864
commit
fb7ab33e03
1 changed files with 2 additions and 8 deletions
|
@ -2198,7 +2198,7 @@ gst_video_encoder_send_header_unlocked (GstVideoEncoder * encoder,
|
|||
GstVideoEncoderPrivate *priv = encoder->priv;
|
||||
|
||||
if (G_UNLIKELY (priv->new_headers)) {
|
||||
GList *tmp, *copy = NULL;
|
||||
GList *tmp;
|
||||
|
||||
GST_DEBUG_OBJECT (encoder, "Sending headers");
|
||||
|
||||
|
@ -2206,13 +2206,7 @@ gst_video_encoder_send_header_unlocked (GstVideoEncoder * encoder,
|
|||
for (tmp = priv->headers; tmp; tmp = tmp->next) {
|
||||
GstBuffer *tmpbuf = GST_BUFFER (tmp->data);
|
||||
|
||||
copy = g_list_append (copy, gst_buffer_make_writable (tmpbuf));
|
||||
}
|
||||
g_list_free (priv->headers);
|
||||
priv->headers = copy;
|
||||
|
||||
for (tmp = priv->headers; tmp; tmp = tmp->next) {
|
||||
GstBuffer *tmpbuf = GST_BUFFER (tmp->data);
|
||||
tmp->data = tmpbuf = gst_buffer_make_writable (tmpbuf);
|
||||
|
||||
GST_OBJECT_LOCK (encoder);
|
||||
priv->bytes += gst_buffer_get_size (tmpbuf);
|
||||
|
|
Loading…
Reference in a new issue