udpsink blocking mode
Nicolas Dufresne
nicolas at ndufresne.ca
Thu Nov 7 00:39:31 UTC 2019
Le mardi 05 novembre 2019 à 07:44 -0600, Vavooon a écrit :
> Hello. I have faced with the following issue:
> One machine sends H264 stream captured directly from a USB camera using a such pipeline:
>
> gst-launch-1.0 v4l2src device=/dev/video2 ! h264parse ! rtph264pay ! udpsink host=172.16.42.153
>
> It works pretty fine until WiFi quality gets worse and actual throughput becomes lower than video bitrate (8Mbit/s).
> In this case I'm getting lot of messages like:
>
> v4l2src gstv4l2src.c:976:gst_v4l2src_create: lost frames detected: count = 2 - ts: 0:00:19.067878843
>
> I also can simulate such behavior by typing: (it sets WiFi TX rate to 6Mbit/s)
> sudo iw wlp1s0 set bitrates legacy-5 6 ht-mcs-5 vht-mcs-5
>
> I've made little investigation and at this place https://github.com/GStreamer/gst-plugins-good/blob/master/tests/check/elements/udpsink.c#L215
> GSocket is created in blocking mode (by default) so looks like entire thread becomes blocked until there is no available space in buffer.
>
> I believe that such behavior isn't optimal and it might be better to stream all data to network interface which should decide whether a packet should be sent or dropped.
>
> So my questions are:
> 1. Wouldn't it be better to set socket to non-blocking mode by using g_socket_set_blocking method?
Then the sender would get EAGAIN, dropping on EAGAIN is racy.
> 2. Is there any motivation behind current blocking behavior?
GStreamer works in pushback model, so blocking is what we usually
expect. Dropping packets can be a lot worst then dropping complete
images, but in this case the camera is producing H264, so it will be
broken any way.
Btw, did you try uvch264src ? I believe it implements keyframe request,
if you use a proper RTP pipeline, you'll get a key frame request to fix
it quickly.
>
>
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list