Windows + Initial WebRTC sys & Safe WebRTC + Initial livekit-core
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Created by Théo Monnom on 01/09/2022.
|
||||
//
|
||||
|
||||
#ifndef CLIENT_SDK_NATIVE_CANDIDATE_H
|
||||
#define CLIENT_SDK_NATIVE_CANDIDATE_H
|
||||
|
||||
#include <memory>
|
||||
#include "api/candidate.h"
|
||||
|
||||
// cricket::Candidate
|
||||
namespace livekit {
|
||||
|
||||
class Candidate {
|
||||
public:
|
||||
explicit Candidate(const cricket::Candidate &candidate);
|
||||
|
||||
private:
|
||||
cricket::Candidate candidate_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<Candidate> _unique_candidate(){
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_CANDIDATE_H
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Created by Théo Monnom on 01/09/2022.
|
||||
//
|
||||
|
||||
#ifndef CLIENT_SDK_NATIVE_DATA_CHANNEL_H
|
||||
#define CLIENT_SDK_NATIVE_DATA_CHANNEL_H
|
||||
|
||||
#include <memory>
|
||||
#include "api/data_channel_interface.h"
|
||||
|
||||
namespace livekit {
|
||||
|
||||
class DataChannel {
|
||||
public:
|
||||
explicit DataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel);
|
||||
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<DataChannel> _unique_data_channel(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_DATA_CHANNEL_H
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// Created by Théo Monnom on 01/09/2022.
|
||||
//
|
||||
|
||||
#ifndef CLIENT_SDK_NATIVE_JSEP_H
|
||||
#define CLIENT_SDK_NATIVE_JSEP_H
|
||||
|
||||
#include <memory>
|
||||
#include "api/jsep.h"
|
||||
#include "rust/cxx.h"
|
||||
#include "rust_types.h"
|
||||
#include "api/ref_counted_base.h"
|
||||
|
||||
namespace livekit {
|
||||
|
||||
class IceCandidate {
|
||||
public:
|
||||
explicit IceCandidate(std::unique_ptr<webrtc::IceCandidateInterface> ice_candidate);
|
||||
|
||||
private:
|
||||
std::unique_ptr<webrtc::IceCandidateInterface> ice_candidate_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<IceCandidate> _unique_ice_candidate(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
|
||||
class SessionDescription {
|
||||
public:
|
||||
explicit SessionDescription(std::unique_ptr<webrtc::SessionDescriptionInterface> session_description);
|
||||
|
||||
std::unique_ptr<SessionDescription> clone() const;
|
||||
std::unique_ptr<webrtc::SessionDescriptionInterface> release();
|
||||
|
||||
private:
|
||||
std::unique_ptr<webrtc::SessionDescriptionInterface> session_description_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<SessionDescription> _unique_session_description(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
|
||||
// SetCreateSdpObserver
|
||||
|
||||
class NativeCreateSdpObserver : public webrtc::CreateSessionDescriptionObserver {
|
||||
public:
|
||||
explicit NativeCreateSdpObserver(rust::Box<CreateSdpObserverWrapper> observer);
|
||||
|
||||
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
|
||||
void OnFailure(webrtc::RTCError error) override;
|
||||
private:
|
||||
rust::Box<CreateSdpObserverWrapper> observer_;
|
||||
};
|
||||
|
||||
struct NativeCreateSdpObserverHandle {
|
||||
rtc::scoped_refptr<NativeCreateSdpObserver> observer;
|
||||
};
|
||||
|
||||
std::unique_ptr<NativeCreateSdpObserverHandle> create_native_create_sdp_observer(rust::Box<CreateSdpObserverWrapper> observer);
|
||||
|
||||
// SetLocalSdpObserver
|
||||
|
||||
class NativeSetLocalSdpObserver : public webrtc::SetLocalDescriptionObserverInterface{
|
||||
public:
|
||||
explicit NativeSetLocalSdpObserver(rust::Box<SetLocalSdpObserverWrapper> observer);
|
||||
|
||||
void OnSetLocalDescriptionComplete(webrtc::RTCError error) override;
|
||||
private:
|
||||
rust::Box<SetLocalSdpObserverWrapper> observer_;
|
||||
};
|
||||
|
||||
struct NativeSetLocalSdpObserverHandle {
|
||||
rtc::scoped_refptr<NativeSetLocalSdpObserver> observer;
|
||||
};
|
||||
|
||||
std::unique_ptr<NativeSetLocalSdpObserverHandle> create_native_set_local_sdp_observer(rust::Box<SetLocalSdpObserverWrapper> observer);
|
||||
|
||||
// SetRemoteSdpObserver
|
||||
|
||||
class NativeSetRemoteSdpObserver : public webrtc::SetRemoteDescriptionObserverInterface{
|
||||
public:
|
||||
explicit NativeSetRemoteSdpObserver(rust::Box<SetRemoteSdpObserverWrapper> observer);
|
||||
|
||||
void OnSetRemoteDescriptionComplete(webrtc::RTCError error) override;
|
||||
private:
|
||||
rust::Box<SetRemoteSdpObserverWrapper> observer_;
|
||||
};
|
||||
|
||||
struct NativeSetRemoteSdpObserverHandle {
|
||||
rtc::scoped_refptr<NativeSetRemoteSdpObserver> observer;
|
||||
};
|
||||
|
||||
std::unique_ptr<NativeSetRemoteSdpObserverHandle> create_native_set_remote_sdp_observer(rust::Box<SetRemoteSdpObserverWrapper> observer);
|
||||
} // livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_JSEP_H
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Created by Théo Monnom on 31/08/2022.
|
||||
//
|
||||
|
||||
#ifndef CLIENT_SDK_NATIVE_MEDIA_STREAM_INTERFACE_H
|
||||
#define CLIENT_SDK_NATIVE_MEDIA_STREAM_INTERFACE_H
|
||||
|
||||
#include <memory>
|
||||
#include "api/media_stream_interface.h"
|
||||
|
||||
namespace livekit {
|
||||
|
||||
class MediaStreamInterface {
|
||||
public:
|
||||
explicit MediaStreamInterface(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream);
|
||||
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> media_stream_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<MediaStreamInterface> _unique_media_stream(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_MEDIA_STREAM_INTERFACE_H
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// Created by Théo Monnom on 30/08/2022.
|
||||
//
|
||||
|
||||
#ifndef CLIENT_SDK_NATIVE_PEER_CONNECTION_H
|
||||
#define CLIENT_SDK_NATIVE_PEER_CONNECTION_H
|
||||
|
||||
#include <memory>
|
||||
#include "api/peer_connection_interface.h"
|
||||
#include "rust/cxx.h"
|
||||
#include "data_channel.h"
|
||||
#include "jsep.h"
|
||||
#include "rust_types.h"
|
||||
|
||||
namespace livekit {
|
||||
class NativePeerConnectionObserver;
|
||||
|
||||
class PeerConnection {
|
||||
public:
|
||||
explicit PeerConnection(rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection, std::unique_ptr<NativePeerConnectionObserver> observer);
|
||||
|
||||
void close();
|
||||
void create_offer(std::unique_ptr<NativeCreateSdpObserverHandle> observer, RTCOfferAnswerOptions options);
|
||||
void create_answer(std::unique_ptr<NativeCreateSdpObserverHandle> observer, RTCOfferAnswerOptions options);
|
||||
void set_local_description(std::unique_ptr<SessionDescription> desc, std::unique_ptr<NativeSetLocalSdpObserverHandle> observer);
|
||||
void set_remote_description(std::unique_ptr<SessionDescription> desc, std::unique_ptr<NativeSetRemoteSdpObserverHandle> observer);
|
||||
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
|
||||
std::unique_ptr<NativePeerConnectionObserver> observer_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<PeerConnection> _unique_peer_connection() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
|
||||
class NativePeerConnectionObserver : public webrtc::PeerConnectionObserver {
|
||||
public:
|
||||
explicit NativePeerConnectionObserver(rust::Box<PeerConnectionObserverWrapper> observer);
|
||||
|
||||
~NativePeerConnectionObserver() override = default;
|
||||
|
||||
void OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) override;
|
||||
void OnAddStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override;
|
||||
void OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override;
|
||||
void OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override;
|
||||
void OnRenegotiationNeeded() override;
|
||||
void OnNegotiationNeededEvent(uint32_t event_id) override;
|
||||
void OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) override;
|
||||
void OnStandardizedIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) override;
|
||||
void OnConnectionChange(webrtc::PeerConnectionInterface::PeerConnectionState new_state) override;
|
||||
void OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) override;
|
||||
void OnIceCandidate(const webrtc::IceCandidateInterface *candidate) override;
|
||||
void OnIceCandidateError(const std::string &address, int port, const std::string &url, int error_code, const std::string &error_text) override;
|
||||
void OnIceCandidatesRemoved(const std::vector<cricket::Candidate> &candidates) override;
|
||||
void OnIceConnectionReceivingChange(bool receiving) override;
|
||||
void OnIceSelectedCandidatePairChanged(const cricket::CandidatePairChangeEvent &event) override;
|
||||
void OnAddTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver, const std::vector<rtc::scoped_refptr<webrtc::MediaStreamInterface>> &streams) override;
|
||||
void OnTrack(rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) override;
|
||||
void OnRemoveTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver) override;
|
||||
void OnInterestingUsage(int usage_pattern) override;
|
||||
|
||||
private:
|
||||
rust::Box<PeerConnectionObserverWrapper> observer_;
|
||||
};
|
||||
|
||||
std::unique_ptr<NativePeerConnectionObserver> create_native_peer_connection_observer(rust::Box<PeerConnectionObserverWrapper> observer);
|
||||
} // livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_PEER_CONNECTION_H
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Created by Théo Monnom on 03/08/2022.
|
||||
//
|
||||
|
||||
|
||||
#ifndef PEER_CONNECTION_FACTORY_H
|
||||
#define PEER_CONNECTION_FACTORY_H
|
||||
|
||||
#include "api/peer_connection_interface.h"
|
||||
#include "peer_connection.h"
|
||||
#include "rust_types.h"
|
||||
|
||||
namespace livekit {
|
||||
using NativeRTCConfiguration = webrtc::PeerConnectionInterface::RTCConfiguration;
|
||||
|
||||
class PeerConnectionFactory {
|
||||
public:
|
||||
PeerConnectionFactory();
|
||||
|
||||
std::unique_ptr<PeerConnection> create_peer_connection(std::unique_ptr<NativeRTCConfiguration> config, std::unique_ptr<NativePeerConnectionObserver> observer) const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<rtc::Thread> network_thread_;
|
||||
std::unique_ptr<rtc::Thread> worker_thread_;
|
||||
std::unique_ptr<rtc::Thread> signaling_thread_;
|
||||
|
||||
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> peer_factory_;
|
||||
};
|
||||
|
||||
std::unique_ptr<PeerConnectionFactory> create_peer_connection_factory();
|
||||
std::unique_ptr<NativeRTCConfiguration> create_rtc_configuration(RTCConfiguration conf);
|
||||
} // livekit
|
||||
|
||||
|
||||
#endif //PEER_CONNECTION_FACTORY_H
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by theom on 04/09/2022.
|
||||
//
|
||||
|
||||
#ifndef CLIENT_SDK_NATIVE_RTC_ERROR_H
|
||||
#define CLIENT_SDK_NATIVE_RTC_ERROR_H
|
||||
|
||||
#include "api/rtc_error.h"
|
||||
|
||||
namespace livekit {
|
||||
|
||||
class RTCError {
|
||||
public:
|
||||
explicit RTCError(webrtc::RTCError error);
|
||||
|
||||
private:
|
||||
webrtc::RTCError rtc_error_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<RTCError> _unique_rtc_error(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_RTC_ERROR_H
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Created by Théo Monnom on 01/09/2022.
|
||||
//
|
||||
|
||||
#ifndef CLIENT_SDK_NATIVE_RTP_RECEIVER_H
|
||||
#define CLIENT_SDK_NATIVE_RTP_RECEIVER_H
|
||||
|
||||
#include <memory>
|
||||
#include "api/rtp_receiver_interface.h"
|
||||
|
||||
namespace livekit {
|
||||
|
||||
class RtpReceiver {
|
||||
public:
|
||||
explicit RtpReceiver(rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver);
|
||||
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<RtpReceiver> _unique_rtp_receiver(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_RTP_RECEIVER_H
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Created by Théo Monnom on 02/09/2022.
|
||||
//
|
||||
|
||||
#ifndef CLIENT_SDK_NATIVE_RTP_TRANSCEIVER_H
|
||||
#define CLIENT_SDK_NATIVE_RTP_TRANSCEIVER_H
|
||||
|
||||
#include <memory>
|
||||
#include "api/rtp_transceiver_interface.h"
|
||||
|
||||
namespace livekit {
|
||||
|
||||
class RtpTransceiver {
|
||||
public:
|
||||
explicit RtpTransceiver(rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver);
|
||||
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<RtpTransceiver> _unique_rtp_transceiver(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_RTP_TRANSCEIVER_H
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Created by Théo Monnom on 30/08/2022.
|
||||
//
|
||||
|
||||
|
||||
#ifndef RUST_TYPES_H
|
||||
#define RUST_TYPES_H
|
||||
|
||||
#include "api/peer_connection_interface.h"
|
||||
|
||||
namespace livekit {
|
||||
struct RTCConfiguration;
|
||||
struct PeerConnectionObserverWrapper;
|
||||
struct CreateSdpObserverWrapper;
|
||||
struct SetLocalSdpObserverWrapper;
|
||||
struct SetRemoteSdpObserverWrapper;
|
||||
|
||||
// Shared types
|
||||
struct RTCOfferAnswerOptions;
|
||||
}
|
||||
|
||||
#endif //RUST_TYPES_H
|
||||
Reference in New Issue
Block a user