mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 06:01:04 +00:00
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:
parent
3512ad3be0
commit
41c895de4d
1 changed files with 3 additions and 7 deletions
|
@ -539,7 +539,7 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
for (i = 0; i < n_mem; i++) {
|
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);
|
gst_memory_map (mem, &map[i], GST_MAP_READ);
|
||||||
|
|
||||||
vec[i].buffer = map[i].data;
|
vec[i].buffer = map[i].data;
|
||||||
|
@ -613,10 +613,8 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
g_mutex_unlock (&sink->client_lock);
|
g_mutex_unlock (&sink->client_lock);
|
||||||
|
|
||||||
/* unmap all memory again */
|
/* 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_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",
|
GST_LOG_OBJECT (sink, "sent %" G_GSIZE_FORMAT " bytes to %d (of %d) clients",
|
||||||
size, num, no_clients);
|
size, num, no_clients);
|
||||||
|
@ -634,10 +632,8 @@ flushing:
|
||||||
g_clear_error (&err);
|
g_clear_error (&err);
|
||||||
|
|
||||||
/* unmap all memory */
|
/* 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_unmap (map[i].memory, &map[i]);
|
||||||
gst_memory_unref (map[i].memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
return GST_FLOW_FLUSHING;
|
return GST_FLOW_FLUSHING;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue