multiudpsink: optimisation: avoid unnecessary memory ref/unrefs

We know the buffer will stay valid and we will also not
modify the buffer, we just want to send out the data.
This commit is contained in:
Tim-Philipp Müller 2014-06-20 12:21:05 +01:00
parent 3512ad3be0
commit 41c895de4d

View file

@ -539,7 +539,7 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
size = 0;
for (i = 0; i < n_mem; i++) {
mem = gst_buffer_get_memory (buffer, i);
mem = gst_buffer_peek_memory (buffer, i);
gst_memory_map (mem, &map[i], GST_MAP_READ);
vec[i].buffer = map[i].data;
@ -613,10 +613,8 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
g_mutex_unlock (&sink->client_lock);
/* unmap all memory again */
for (i = 0; i < n_mem; i++) {
for (i = 0; i < n_mem; i++)
gst_memory_unmap (map[i].memory, &map[i]);
gst_memory_unref (map[i].memory);
}
GST_LOG_OBJECT (sink, "sent %" G_GSIZE_FORMAT " bytes to %d (of %d) clients",
size, num, no_clients);
@ -634,10 +632,8 @@ flushing:
g_clear_error (&err);
/* unmap all memory */
for (i = 0; i < n_mem; i++) {
for (i = 0; i < n_mem; i++)
gst_memory_unmap (map[i].memory, &map[i]);
gst_memory_unref (map[i].memory);
}
return GST_FLOW_FLUSHING;
}