fix: datachannel deadlocks & dispose crashes (#87)

- Fix datachannel deadlock on dispose
- Fix audio device being disposed on the wrong thread
- Allow multiple RtcRuntime to be created (Useful for unit tests where we use multiple PeerConnectionFactory)
This commit is contained in:
Théo Monnom
2023-06-10 18:49:00 +02:00
committed by GitHub
parent ebbd93b2d8
commit 33dfcb27b0
9 changed files with 90 additions and 39 deletions
+5 -3
View File
@@ -80,6 +80,8 @@ class RtcRuntime : public std::enable_shared_from_this<RtcRuntime> {
// have one livekit::VideoTrack associated with it).
// The only reason we to do that is to allow to add states inside our
// wrappers (e.g: the sinks_ member inside AudioTrack)
// DataChannel and the PeerConnectionFactory don't need to do this (There's no
// way to retrieve them after creation)
webrtc::Mutex mutex_;
std::vector<std::weak_ptr<MediaStreamTrack>> media_stream_tracks_;
// We don't have additonal state in RtpReceiver and RtpSender atm..
@@ -87,9 +89,9 @@ class RtcRuntime : public std::enable_shared_from_this<RtcRuntime> {
// std::vector<std::weak_ptr<RtpSender>> rtp_senders_;
#ifdef WEBRTC_WIN
rtc::WinsockInitializer winsock_;
rtc::PhysicalSocketServer ss_;
rtc::AutoSocketServerThread main_thread_{&ss_};
// rtc::WinsockInitializer winsock_;
// rtc::PhysicalSocketServer ss_;
// rtc::AutoSocketServerThread main_thread_{&ss_};
#endif
};