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 #include #include +#include #include #include #include #include +#include #include #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);