From: Jakub Adam Date: Mon, 23 Nov 2020 15:12:39 +0000 (+0100) Subject: srtobject: obey "wait-for-connection" in caller mode X-Git-Tag: 1.19.3~507^2~912 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d540012091554d269ed66a7822537314f7296407;p=platform%2Fupstream%2Fgstreamer.git 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: --- diff --git a/ext/srt/gstsrtobject.c b/ext/srt/gstsrtobject.c index 3439f31..ed411ed 100644 --- a/ext/srt/gstsrtobject.c +++ b/ext/srt/gstsrtobject.c @@ -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;