DataChannel progress

This commit is contained in:
Théo Monnom
2022-09-19 01:11:18 +02:00
parent dca8cf7796
commit 8380ffadef
21 changed files with 389 additions and 87 deletions
@@ -16,6 +16,8 @@ namespace livekit {
class IceCandidate {
public:
explicit IceCandidate(std::unique_ptr<webrtc::IceCandidateInterface> ice_candidate);
std::unique_ptr<webrtc::IceCandidateInterface> release();
private:
std::unique_ptr<webrtc::IceCandidateInterface> ice_candidate_;
};
@@ -13,7 +13,7 @@
#include "rust_types.h"
namespace livekit {
class NativePeerConnectionObserver;
class NativeAddIceCandidateObserver;
class PeerConnection {
public:
@@ -24,6 +24,7 @@ namespace livekit {
void set_local_description(std::unique_ptr<SessionDescription> desc, NativeSetLocalSdpObserverHandle &observer);
void set_remote_description(std::unique_ptr<SessionDescription> desc, NativeSetRemoteSdpObserverHandle &observer);
std::unique_ptr<DataChannel> create_data_channel(rust::String label, std::unique_ptr<NativeDataChannelInit> init);
void add_ice_candidate(std::unique_ptr<IceCandidate> candidate, NativeAddIceCandidateObserver &observer);
void close();
private:
@@ -34,6 +35,17 @@ namespace livekit {
return nullptr; // Ignore
}
class NativeAddIceCandidateObserver {
public:
explicit NativeAddIceCandidateObserver(rust::Box<AddIceCandidateObserverWrapper> observer);
void OnComplete(const RTCError &error);
private:
rust::Box<AddIceCandidateObserverWrapper> observer_;
};
std::unique_ptr<NativeAddIceCandidateObserver> create_native_add_ice_candidate_observer(rust::Box<AddIceCandidateObserverWrapper> observer);
class NativePeerConnectionObserver : public webrtc::PeerConnectionObserver {
public:
explicit NativePeerConnectionObserver(rust::Box<PeerConnectionObserverWrapper> observer);
@@ -15,6 +15,7 @@ namespace livekit {
struct SetLocalSdpObserverWrapper;
struct SetRemoteSdpObserverWrapper;
struct DataChannelObserverWrapper;
struct AddIceCandidateObserverWrapper;
// Shared types
struct RTCOfferAnswerOptions;
@@ -0,0 +1,32 @@
//
// Created by theom on 18/09/2022.
//
#ifndef LIVEKIT_WEBRTC_WEBRTC_H
#define LIVEKIT_WEBRTC_WEBRTC_H
#include "rtc_base/ssl_adapter.h"
#include "rtc_base/physical_socket_server.h"
#ifdef WEBRTC_WIN
#include "rtc_base/win32_socket_init.h"
#endif
namespace livekit {
class RTCRuntime {
public:
RTCRuntime();
~RTCRuntime();
RTCRuntime(const RTCRuntime&) = delete;
RTCRuntime& operator=(const RTCRuntime&) = delete;
private:
rtc::WinsockInitializer winsock_;
};
std::unique_ptr<RTCRuntime> create_rtc_runtime();
} // livekit
#endif //LIVEKIT_WEBRTC_WEBRTC_H