mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
e6f77948ac
Drop use of g_socket_get_available_bytes() which is not useful on all systems (where it returns the size of the entire buffer not that of the next pending packet), and is yet another syscall and apparently very inefficient on Windows in the UDP case. Instead, when reading UDP packets, use the more featureful g_socket_receive_message() call that allows to read into scattered memory, and allocate one memory chunk which is likely to be large enough for a packet, while also providing a larger allocated memory chunk just in case the packet is larger than expected. If the received data fits into the first chunk, we'll just add that to the buffer we return and re-use the fallback buffer for next time, otherwise we add both chunks to the buffer. This reduces memory waste more reliably on systems where get_available_bytes() doesn't work properly. In a multimedia streaming scenario, incoming UDP packets are almost never fragmented and thus almost always smaller than the MTU size, which is also why we don't try to do something smarter with more fallback memory chunks of different sizes. The fallback scenario is just for when someone built a broken sender pipeline (not using a payloader or somesuch) https://bugzilla.gnome.org/show_bug.cgi?id=610364 |
||
---|---|---|
.. | ||
gstdynudpsink.c | ||
gstdynudpsink.h | ||
gstmultiudpsink.c | ||
gstmultiudpsink.h | ||
gstudp.c | ||
gstudpnetutils.c | ||
gstudpnetutils.h | ||
gstudpsink.c | ||
gstudpsink.h | ||
gstudpsrc.c | ||
gstudpsrc.h | ||
Makefile.am | ||
README | ||
udp.vcproj |
* What is UDP src/sink? It is a set of element to transfer data using UDP, nothing more, nothing less. Its main purpose is to be used in conjunction with RTP but they are kept as separate elements because we can.