srtobject: obey "wait-for-connection" in caller mode

The pipeline now gets stuck in gst_srt_object_write_one() until the
receiver comes online, which may or may not be desired based on the use
case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1836>
This commit is contained in:
Jakub Adam 2020-11-23 16:12:39 +01:00 committed by GStreamer Merge Bot
parent 4625ac92b6
commit d540012091

View file

@ -1602,8 +1602,10 @@ gst_srt_object_write_one (GstSRTObject * srtobject,
gint poll_timeout;
const guint8 *msg = mapinfo->data;
gint payload_size, optlen = 1;
gboolean wait_for_connection;
GST_OBJECT_LOCK (srtobject->element);
wait_for_connection = srtobject->wait_for_connection;
if (!gst_structure_get_int (srtobject->parameters, "poll-timeout",
&poll_timeout)) {
poll_timeout = GST_SRT_DEFAULT_POLL_TIMEOUT;
@ -1629,6 +1631,13 @@ gst_srt_object_write_one (GstSRTObject * srtobject,
break;
}
if (!wait_for_connection &&
srt_getsockstate (srtobject->sock) == SRTS_CONNECTING) {
GST_LOG_OBJECT (srtobject->element,
"Not connected yet. Dropping the buffer.");
break;
}
if (srt_epoll_wait (srtobject->poll_id, 0, 0, &wsock,
&wsocklen, poll_timeout, NULL, 0, NULL, 0) < 0) {
continue;