summaryrefslogtreecommitdiff
path: root/ext/webrtc
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2021-06-26 14:25:39 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2021-06-29 00:42:20 -0400
commita07e52528c7e56113e980d34f0639dbee86f4dd0 (patch)
tree2e16d0bc86e985bad9cf429cdea20c9118d6e06a /ext/webrtc
parent0e559fc2f394114d4ef884f375f470125e28bc89 (diff)
downloadgstreamer-plugins-bad-a07e52528c7e56113e980d34f0639dbee86f4dd0.tar.gz
webrtc receivebin: Don't unblock pad until sender is unblocked
As ther OpenSSL session is created when the receiver goes into playing, we have to wait for the ICE session to be connected before we can start delivering packets to the DTLS element. Fixes #1599 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2363>
Diffstat (limited to 'ext/webrtc')
-rw-r--r--ext/webrtc/transportreceivebin.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/ext/webrtc/transportreceivebin.c b/ext/webrtc/transportreceivebin.c
index 786b0c2ba..6f826030b 100644
--- a/ext/webrtc/transportreceivebin.c
+++ b/ext/webrtc/transportreceivebin.c
@@ -112,13 +112,29 @@ void
transport_receive_bin_set_receive_state (TransportReceiveBin * receive,
ReceiveState state)
{
+ GstWebRTCICEConnectionState icestate;
g_mutex_lock (&receive->pad_block_lock);
if (receive->receive_state != state) {
- GST_DEBUG_OBJECT (receive, "changing receive state to %s",
+ GST_DEBUG_OBJECT (receive, "Requested change of receive state to %s",
_receive_state_to_string (state));
}
+ receive->receive_state = state;
+
+ g_object_get (receive->stream->transport->transport, "state", &icestate,
+ NULL);
+ if (state == RECEIVE_STATE_PASS) {
+ if (icestate == GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED ||
+ icestate == GST_WEBRTC_ICE_CONNECTION_STATE_COMPLETED) {
+ GST_LOG_OBJECT (receive, "Unblocking nicesrc because ICE is connected.");
+ } else {
+ GST_LOG_OBJECT (receive, "Can't unblock nicesrc yet because ICE "
+ "is not connected, it is %d", icestate);
+ state = RECEIVE_STATE_BLOCK;
+ }
+ }
+
if (state == RECEIVE_STATE_PASS) {
if (receive->rtp_block)
_free_pad_block (receive->rtp_block);
@@ -151,11 +167,17 @@ transport_receive_bin_set_receive_state (TransportReceiveBin * receive,
}
}
}
- receive->receive_state = state;
g_mutex_unlock (&receive->pad_block_lock);
}
static void
+_on_notify_ice_connection_state (GstWebRTCICETransport * transport,
+ GParamSpec * pspec, TransportReceiveBin * receive)
+{
+ transport_receive_bin_set_receive_state (receive, receive->receive_state);
+}
+
+static void
transport_receive_bin_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
@@ -331,6 +353,9 @@ transport_receive_bin_constructed (GObject * object)
gst_element_add_pad (GST_ELEMENT (receive), ghost);
gst_object_unref (pad);
+ g_signal_connect_after (receive->stream->transport->transport,
+ "notify::state", G_CALLBACK (_on_notify_ice_connection_state), receive);
+
G_OBJECT_CLASS (parent_class)->constructed (object);
}