cleanup: webrtc-sys & fix RtcRuntime disposing crashes (#81)

This commit is contained in:
Théo Monnom
2023-06-04 01:02:00 +02:00
committed by GitHub
parent 05ad1c95af
commit 55bda13069
80 changed files with 2209 additions and 1954 deletions
@@ -21,30 +21,31 @@
#include "peer_connection.h"
#include "rtp_parameters.h"
#include "rust/cxx.h"
#include "webrtc-sys/src/peer_connection.rs.h"
#include "webrtc.h"
namespace livekit {
using NativeRTCConfiguration =
webrtc::PeerConnectionInterface::RTCConfiguration;
class PeerConnectionFactory;
} // namespace livekit
#include "webrtc-sys/src/peer_connection_factory.rs.h"
namespace livekit {
webrtc::PeerConnectionInterface::RTCConfiguration to_native_rtc_configuration(
RtcConfiguration config);
class PeerConnectionFactory {
public:
explicit PeerConnectionFactory(std::shared_ptr<RTCRuntime> rtc_runtime);
explicit PeerConnectionFactory(std::shared_ptr<RtcRuntime> rtc_runtime);
~PeerConnectionFactory();
std::shared_ptr<PeerConnection> create_peer_connection(
std::unique_ptr<NativeRTCConfiguration> config,
NativePeerConnectionObserver* observer) const;
RtcConfiguration config,
std::unique_ptr<NativePeerConnectionObserver> observer) const;
std::shared_ptr<VideoTrack> create_video_track(
rust::String label,
std::shared_ptr<AdaptedVideoTrackSource> source) const;
std::shared_ptr<VideoTrackSource> source) const;
std::shared_ptr<AudioTrack> create_audio_track(
rust::String label,
@@ -55,12 +56,9 @@ class PeerConnectionFactory {
RtpCapabilities get_rtp_receiver_capabilities(MediaType type) const;
private:
std::shared_ptr<RTCRuntime> rtc_runtime_;
std::shared_ptr<RtcRuntime> rtc_runtime_;
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> peer_factory_;
};
std::shared_ptr<PeerConnectionFactory> create_peer_connection_factory(
std::shared_ptr<RTCRuntime> rtc_runtime);
std::unique_ptr<NativeRTCConfiguration> create_rtc_configuration(
RTCConfiguration conf);
std::shared_ptr<PeerConnectionFactory> create_peer_connection_factory();
} // namespace livekit