mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
Mitigate webrtc race condition
This commit is contained in:
parent
40a487109d
commit
9a8a584fa8
1 changed files with 5 additions and 0 deletions
|
@ -2,10 +2,12 @@
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <chrono>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
#include <thread>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
|
@ -855,6 +857,9 @@ WebRTCSession::acceptOffer(const std::string &sdp)
|
||||||
return false;
|
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
|
// set-remote-description first, then create-answer
|
||||||
GstPromise *promise = gst_promise_new_with_change_func(createAnswer, webrtc_, nullptr);
|
GstPromise *promise = gst_promise_new_with_change_func(createAnswer, webrtc_, nullptr);
|
||||||
g_signal_emit_by_name(webrtc_, "set-remote-description", offer, promise);
|
g_signal_emit_by_name(webrtc_, "set-remote-description", offer, promise);
|
||||||
|
|
Loading…
Reference in a new issue