diff options
author | DeepBlueV7.X <nicolas.werner@hotmail.de> | 2020-11-25 02:40:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 02:40:31 +0100 |
commit | b9dcdbcb812248539363ae5f41f8e82337902881 (patch) | |
tree | 25b6ba5643697b49e2e1e0a20b155c398e0f077c | |
parent | Merge pull request #334 from Kirillpt/issue_292 (diff) | |
parent | Mitigate webrtc race condition (diff) | |
download | nheko-b9dcdbcb812248539363ae5f41f8e82337902881.tar.xz |
Merge pull request #337 from trilene/master
Mitigate webrtc race condition
-rw-r--r-- | src/WebRTCSession.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/WebRTCSession.cpp b/src/WebRTCSession.cpp index 778a97d8..2ab83d9a 100644 --- a/src/WebRTCSession.cpp +++ b/src/WebRTCSession.cpp @@ -2,10 +2,12 @@ #include <QQuickItem> #include <algorithm> #include <cctype> +#include <chrono> #include <cstdlib> #include <cstring> #include <optional> #include <string_view> +#include <thread> #include <utility> #include "ChatPage.h" @@ -855,6 +857,9 @@ WebRTCSession::acceptOffer(const std::string &sdp) return false; } + // avoid a race that sometimes leaves the generated answer without media tracks (a=ssrc lines) + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + // set-remote-description first, then create-answer GstPromise *promise = gst_promise_new_with_change_func(createAnswer, webrtc_, nullptr); g_signal_emit_by_name(webrtc_, "set-remote-description", offer, promise); |