Added .clang-format + reformatted code
This commit is contained in:
@@ -6,23 +6,24 @@
|
||||
#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);
|
||||
class Candidate {
|
||||
public:
|
||||
explicit Candidate(const cricket::Candidate& candidate);
|
||||
|
||||
private:
|
||||
cricket::Candidate candidate_;
|
||||
};
|
||||
private:
|
||||
cricket::Candidate candidate_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<Candidate> _unique_candidate(){
|
||||
return nullptr;
|
||||
}
|
||||
static std::unique_ptr<Candidate> _unique_candidate() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // livekit
|
||||
} // namespace livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_CANDIDATE_H
|
||||
#endif // CLIENT_SDK_NATIVE_CANDIDATE_H
|
||||
|
||||
@@ -6,45 +6,52 @@
|
||||
#define CLIENT_SDK_NATIVE_DATA_CHANNEL_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "api/data_channel_interface.h"
|
||||
#include "rust_types.h"
|
||||
#include "rust/cxx.h"
|
||||
#include "rust_types.h"
|
||||
|
||||
namespace livekit {
|
||||
using NativeDataChannelInit = webrtc::DataChannelInit;
|
||||
class NativeDataChannelObserver;
|
||||
using NativeDataChannelInit = webrtc::DataChannelInit;
|
||||
class NativeDataChannelObserver;
|
||||
|
||||
class DataChannel {
|
||||
public:
|
||||
explicit DataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel);
|
||||
class DataChannel {
|
||||
public:
|
||||
explicit DataChannel(
|
||||
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel);
|
||||
|
||||
void register_observer(NativeDataChannelObserver &observer);
|
||||
void unregister_observer();
|
||||
bool send(const DataBuffer& buffer);
|
||||
rust::String label() const;
|
||||
void close();
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel_;
|
||||
};
|
||||
void register_observer(NativeDataChannelObserver& observer);
|
||||
void unregister_observer();
|
||||
bool send(const DataBuffer& buffer);
|
||||
rust::String label() const;
|
||||
void close();
|
||||
|
||||
std::unique_ptr<NativeDataChannelInit> create_data_channel_init(DataChannelInit init);
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<DataChannel> _unique_data_channel(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
std::unique_ptr<NativeDataChannelInit> create_data_channel_init(
|
||||
DataChannelInit init);
|
||||
|
||||
class NativeDataChannelObserver : public webrtc::DataChannelObserver {
|
||||
public:
|
||||
explicit NativeDataChannelObserver(rust::Box<DataChannelObserverWrapper> observer);
|
||||
static std::unique_ptr<DataChannel> _unique_data_channel() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
|
||||
void OnStateChange() override;
|
||||
void OnMessage(const webrtc::DataBuffer& buffer) override;
|
||||
void OnBufferedAmountChange(uint64_t sent_data_size) override;
|
||||
private:
|
||||
rust::Box<DataChannelObserverWrapper> observer_;
|
||||
};
|
||||
class NativeDataChannelObserver : public webrtc::DataChannelObserver {
|
||||
public:
|
||||
explicit NativeDataChannelObserver(
|
||||
rust::Box<DataChannelObserverWrapper> observer);
|
||||
|
||||
std::unique_ptr<NativeDataChannelObserver> create_native_data_channel_observer(rust::Box<DataChannelObserverWrapper> observer);
|
||||
} // livekit
|
||||
void OnStateChange() override;
|
||||
void OnMessage(const webrtc::DataBuffer& buffer) override;
|
||||
void OnBufferedAmountChange(uint64_t sent_data_size) override;
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_DATA_CHANNEL_H
|
||||
private:
|
||||
rust::Box<DataChannelObserverWrapper> observer_;
|
||||
};
|
||||
|
||||
std::unique_ptr<NativeDataChannelObserver> create_native_data_channel_observer(
|
||||
rust::Box<DataChannelObserverWrapper> observer);
|
||||
} // namespace livekit
|
||||
|
||||
#endif // CLIENT_SDK_NATIVE_DATA_CHANNEL_H
|
||||
|
||||
@@ -6,93 +6,111 @@
|
||||
#define CLIENT_SDK_NATIVE_JSEP_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "api/jsep.h"
|
||||
#include "api/ref_counted_base.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);
|
||||
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_;
|
||||
};
|
||||
std::unique_ptr<webrtc::IceCandidateInterface> release();
|
||||
|
||||
static std::unique_ptr<IceCandidate> _unique_ice_candidate(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<webrtc::IceCandidateInterface> ice_candidate_;
|
||||
};
|
||||
|
||||
class SessionDescription {
|
||||
public:
|
||||
explicit SessionDescription(std::unique_ptr<webrtc::SessionDescriptionInterface> session_description);
|
||||
static std::unique_ptr<IceCandidate> _unique_ice_candidate() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
|
||||
rust::String stringify() const;
|
||||
std::unique_ptr<SessionDescription> clone() const;
|
||||
std::unique_ptr<webrtc::SessionDescriptionInterface> release();
|
||||
class SessionDescription {
|
||||
public:
|
||||
explicit SessionDescription(
|
||||
std::unique_ptr<webrtc::SessionDescriptionInterface> session_description);
|
||||
|
||||
private:
|
||||
std::unique_ptr<webrtc::SessionDescriptionInterface> session_description_;
|
||||
};
|
||||
rust::String stringify() const;
|
||||
std::unique_ptr<SessionDescription> clone() const;
|
||||
std::unique_ptr<webrtc::SessionDescriptionInterface> release();
|
||||
|
||||
static std::unique_ptr<SessionDescription> _unique_session_description(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
private:
|
||||
std::unique_ptr<webrtc::SessionDescriptionInterface> session_description_;
|
||||
};
|
||||
|
||||
// SetCreateSdpObserver
|
||||
static std::unique_ptr<SessionDescription> _unique_session_description() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
|
||||
class NativeCreateSdpObserver : public webrtc::CreateSessionDescriptionObserver {
|
||||
public:
|
||||
explicit NativeCreateSdpObserver(rust::Box<CreateSdpObserverWrapper> observer);
|
||||
// SetCreateSdpObserver
|
||||
|
||||
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
|
||||
void OnFailure(webrtc::RTCError error) override;
|
||||
private:
|
||||
rust::Box<CreateSdpObserverWrapper> observer_;
|
||||
};
|
||||
class NativeCreateSdpObserver
|
||||
: public webrtc::CreateSessionDescriptionObserver {
|
||||
public:
|
||||
explicit NativeCreateSdpObserver(
|
||||
rust::Box<CreateSdpObserverWrapper> observer);
|
||||
|
||||
struct NativeCreateSdpObserverHandle {
|
||||
rtc::scoped_refptr<NativeCreateSdpObserver> observer;
|
||||
};
|
||||
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
|
||||
void OnFailure(webrtc::RTCError error) override;
|
||||
|
||||
std::unique_ptr<NativeCreateSdpObserverHandle> create_native_create_sdp_observer(rust::Box<CreateSdpObserverWrapper> observer);
|
||||
private:
|
||||
rust::Box<CreateSdpObserverWrapper> observer_;
|
||||
};
|
||||
|
||||
// SetLocalSdpObserver
|
||||
struct NativeCreateSdpObserverHandle {
|
||||
rtc::scoped_refptr<NativeCreateSdpObserver> observer;
|
||||
};
|
||||
|
||||
class NativeSetLocalSdpObserver : public webrtc::SetLocalDescriptionObserverInterface{
|
||||
public:
|
||||
explicit NativeSetLocalSdpObserver(rust::Box<SetLocalSdpObserverWrapper> observer);
|
||||
std::unique_ptr<NativeCreateSdpObserverHandle>
|
||||
create_native_create_sdp_observer(rust::Box<CreateSdpObserverWrapper> observer);
|
||||
|
||||
void OnSetLocalDescriptionComplete(webrtc::RTCError error) override;
|
||||
private:
|
||||
rust::Box<SetLocalSdpObserverWrapper> observer_;
|
||||
};
|
||||
// SetLocalSdpObserver
|
||||
|
||||
struct NativeSetLocalSdpObserverHandle {
|
||||
rtc::scoped_refptr<NativeSetLocalSdpObserver> observer;
|
||||
};
|
||||
class NativeSetLocalSdpObserver
|
||||
: public webrtc::SetLocalDescriptionObserverInterface {
|
||||
public:
|
||||
explicit NativeSetLocalSdpObserver(
|
||||
rust::Box<SetLocalSdpObserverWrapper> observer);
|
||||
|
||||
std::unique_ptr<NativeSetLocalSdpObserverHandle> create_native_set_local_sdp_observer(rust::Box<SetLocalSdpObserverWrapper> observer);
|
||||
void OnSetLocalDescriptionComplete(webrtc::RTCError error) override;
|
||||
|
||||
// SetRemoteSdpObserver
|
||||
private:
|
||||
rust::Box<SetLocalSdpObserverWrapper> observer_;
|
||||
};
|
||||
|
||||
class NativeSetRemoteSdpObserver : public webrtc::SetRemoteDescriptionObserverInterface{
|
||||
public:
|
||||
explicit NativeSetRemoteSdpObserver(rust::Box<SetRemoteSdpObserverWrapper> observer);
|
||||
struct NativeSetLocalSdpObserverHandle {
|
||||
rtc::scoped_refptr<NativeSetLocalSdpObserver> observer;
|
||||
};
|
||||
|
||||
void OnSetRemoteDescriptionComplete(webrtc::RTCError error) override;
|
||||
private:
|
||||
rust::Box<SetRemoteSdpObserverWrapper> observer_;
|
||||
};
|
||||
std::unique_ptr<NativeSetLocalSdpObserverHandle>
|
||||
create_native_set_local_sdp_observer(
|
||||
rust::Box<SetLocalSdpObserverWrapper> observer);
|
||||
|
||||
struct NativeSetRemoteSdpObserverHandle {
|
||||
rtc::scoped_refptr<NativeSetRemoteSdpObserver> observer;
|
||||
};
|
||||
// SetRemoteSdpObserver
|
||||
|
||||
std::unique_ptr<NativeSetRemoteSdpObserverHandle> create_native_set_remote_sdp_observer(rust::Box<SetRemoteSdpObserverWrapper> observer);
|
||||
} // livekit
|
||||
class NativeSetRemoteSdpObserver
|
||||
: public webrtc::SetRemoteDescriptionObserverInterface {
|
||||
public:
|
||||
explicit NativeSetRemoteSdpObserver(
|
||||
rust::Box<SetRemoteSdpObserverWrapper> observer);
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_JSEP_H
|
||||
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);
|
||||
} // namespace livekit
|
||||
|
||||
#endif // CLIENT_SDK_NATIVE_JSEP_H
|
||||
|
||||
@@ -6,21 +6,23 @@
|
||||
#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);
|
||||
class MediaStreamInterface {
|
||||
public:
|
||||
explicit MediaStreamInterface(
|
||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream);
|
||||
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> media_stream_;
|
||||
};
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> media_stream_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<MediaStreamInterface> _unique_media_stream(){
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // livekit
|
||||
static std::unique_ptr<MediaStreamInterface> _unique_media_stream() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // namespace livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_MEDIA_STREAM_INTERFACE_H
|
||||
#endif // CLIENT_SDK_NATIVE_MEDIA_STREAM_INTERFACE_H
|
||||
|
||||
@@ -6,76 +6,128 @@
|
||||
#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/cxx.h"
|
||||
#include "rust_types.h"
|
||||
|
||||
namespace livekit {
|
||||
class NativeAddIceCandidateObserver;
|
||||
class NativeAddIceCandidateObserver;
|
||||
|
||||
class PeerConnection {
|
||||
public:
|
||||
explicit PeerConnection(rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection);
|
||||
class PeerConnection {
|
||||
public:
|
||||
explicit PeerConnection(
|
||||
rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection);
|
||||
|
||||
void create_offer(NativeCreateSdpObserverHandle &observer, RTCOfferAnswerOptions options);
|
||||
void create_answer(NativeCreateSdpObserverHandle &observer, RTCOfferAnswerOptions options);
|
||||
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();
|
||||
void create_offer(NativeCreateSdpObserverHandle& observer,
|
||||
RTCOfferAnswerOptions options);
|
||||
void create_answer(NativeCreateSdpObserverHandle& observer,
|
||||
RTCOfferAnswerOptions options);
|
||||
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:
|
||||
rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
|
||||
};
|
||||
private:
|
||||
rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
|
||||
};
|
||||
|
||||
static std::unique_ptr<PeerConnection> _unique_peer_connection() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
static std::unique_ptr<PeerConnection> _unique_peer_connection() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
|
||||
class NativeAddIceCandidateObserver {
|
||||
public:
|
||||
explicit NativeAddIceCandidateObserver(rust::Box<AddIceCandidateObserverWrapper> observer);
|
||||
class NativeAddIceCandidateObserver {
|
||||
public:
|
||||
explicit NativeAddIceCandidateObserver(
|
||||
rust::Box<AddIceCandidateObserverWrapper> observer);
|
||||
|
||||
void OnComplete(const RTCError &error);
|
||||
private:
|
||||
rust::Box<AddIceCandidateObserverWrapper> observer_;
|
||||
};
|
||||
void OnComplete(const RTCError& error);
|
||||
|
||||
std::unique_ptr<NativeAddIceCandidateObserver> create_native_add_ice_candidate_observer(rust::Box<AddIceCandidateObserverWrapper> observer);
|
||||
private:
|
||||
rust::Box<AddIceCandidateObserverWrapper> observer_;
|
||||
};
|
||||
|
||||
class NativePeerConnectionObserver : public webrtc::PeerConnectionObserver {
|
||||
public:
|
||||
explicit NativePeerConnectionObserver(rust::Box<PeerConnectionObserverWrapper> observer);
|
||||
std::unique_ptr<NativeAddIceCandidateObserver>
|
||||
create_native_add_ice_candidate_observer(
|
||||
rust::Box<AddIceCandidateObserverWrapper> observer);
|
||||
|
||||
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;
|
||||
class NativePeerConnectionObserver : public webrtc::PeerConnectionObserver {
|
||||
public:
|
||||
explicit NativePeerConnectionObserver(
|
||||
rust::Box<PeerConnectionObserverWrapper> observer);
|
||||
|
||||
private:
|
||||
rust::Box<PeerConnectionObserverWrapper> observer_;
|
||||
};
|
||||
void OnSignalingChange(
|
||||
webrtc::PeerConnectionInterface::SignalingState new_state) override;
|
||||
|
||||
std::unique_ptr<NativePeerConnectionObserver> create_native_peer_connection_observer(rust::Box<PeerConnectionObserverWrapper> observer);
|
||||
} // livekit
|
||||
void OnAddStream(
|
||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override;
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_PEER_CONNECTION_H
|
||||
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);
|
||||
} // namespace livekit
|
||||
|
||||
#endif // CLIENT_SDK_NATIVE_PEER_CONNECTION_H
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// Created by Théo Monnom on 03/08/2022.
|
||||
//
|
||||
|
||||
|
||||
#ifndef PEER_CONNECTION_FACTORY_H
|
||||
#define PEER_CONNECTION_FACTORY_H
|
||||
|
||||
@@ -11,25 +10,28 @@
|
||||
#include "rust_types.h"
|
||||
|
||||
namespace livekit {
|
||||
using NativeRTCConfiguration = webrtc::PeerConnectionInterface::RTCConfiguration;
|
||||
using NativeRTCConfiguration =
|
||||
webrtc::PeerConnectionInterface::RTCConfiguration;
|
||||
|
||||
class PeerConnectionFactory {
|
||||
public:
|
||||
PeerConnectionFactory();
|
||||
class PeerConnectionFactory {
|
||||
public:
|
||||
PeerConnectionFactory();
|
||||
|
||||
std::unique_ptr<PeerConnection> create_peer_connection(std::unique_ptr<NativeRTCConfiguration> config, NativePeerConnectionObserver &observer) const;
|
||||
std::unique_ptr<PeerConnection> create_peer_connection(
|
||||
std::unique_ptr<NativeRTCConfiguration> config,
|
||||
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_;
|
||||
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_;
|
||||
};
|
||||
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
|
||||
std::unique_ptr<PeerConnectionFactory> create_peer_connection_factory();
|
||||
std::unique_ptr<NativeRTCConfiguration> create_rtc_configuration(
|
||||
RTCConfiguration conf);
|
||||
} // namespace livekit
|
||||
|
||||
|
||||
#endif //PEER_CONNECTION_FACTORY_H
|
||||
#endif // PEER_CONNECTION_FACTORY_H
|
||||
|
||||
@@ -7,19 +7,20 @@
|
||||
|
||||
#include "api/rtc_error.h"
|
||||
#include "libwebrtc-sys/src/rtc_error.rs.h"
|
||||
#include "rust_types.h"
|
||||
#include "rust/cxx.h"
|
||||
#include "rust_types.h"
|
||||
|
||||
namespace livekit {
|
||||
|
||||
RTCError to_error(const webrtc::RTCError &error);
|
||||
std::string serialize_error(const RTCError &error); // to be used inside cxx::Exception msg
|
||||
RTCError to_error(const webrtc::RTCError& error);
|
||||
std::string serialize_error(
|
||||
const RTCError& error); // to be used inside cxx::Exception msg
|
||||
|
||||
#ifdef LIVEKIT_TEST
|
||||
rust::String serialize_deserialize();
|
||||
void throw_error();
|
||||
rust::String serialize_deserialize();
|
||||
void throw_error();
|
||||
#endif
|
||||
|
||||
} // livekit
|
||||
} // namespace livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_RTC_ERROR_H
|
||||
#endif // CLIENT_SDK_NATIVE_RTC_ERROR_H
|
||||
|
||||
@@ -6,21 +6,23 @@
|
||||
#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);
|
||||
class RtpReceiver {
|
||||
public:
|
||||
explicit RtpReceiver(
|
||||
rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver);
|
||||
|
||||
private:
|
||||
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
|
||||
static std::unique_ptr<RtpReceiver> _unique_rtp_receiver() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // namespace livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_RTP_RECEIVER_H
|
||||
#endif // CLIENT_SDK_NATIVE_RTP_RECEIVER_H
|
||||
|
||||
@@ -6,21 +6,23 @@
|
||||
#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);
|
||||
class RtpTransceiver {
|
||||
public:
|
||||
explicit RtpTransceiver(
|
||||
rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver);
|
||||
|
||||
private:
|
||||
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
|
||||
static std::unique_ptr<RtpTransceiver> _unique_rtp_transceiver() {
|
||||
return nullptr; // Ignore
|
||||
}
|
||||
} // namespace livekit
|
||||
|
||||
#endif //CLIENT_SDK_NATIVE_RTP_TRANSCEIVER_H
|
||||
#endif // CLIENT_SDK_NATIVE_RTP_TRANSCEIVER_H
|
||||
|
||||
@@ -2,26 +2,25 @@
|
||||
// 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;
|
||||
struct DataChannelObserverWrapper;
|
||||
struct AddIceCandidateObserverWrapper;
|
||||
struct RTCConfiguration;
|
||||
struct PeerConnectionObserverWrapper;
|
||||
struct CreateSdpObserverWrapper;
|
||||
struct SetLocalSdpObserverWrapper;
|
||||
struct SetRemoteSdpObserverWrapper;
|
||||
struct DataChannelObserverWrapper;
|
||||
struct AddIceCandidateObserverWrapper;
|
||||
|
||||
// Shared types
|
||||
struct RTCOfferAnswerOptions;
|
||||
struct RTCError;
|
||||
struct DataChannelInit;
|
||||
struct DataBuffer;
|
||||
}
|
||||
// Shared types
|
||||
struct RTCOfferAnswerOptions;
|
||||
struct RTCError;
|
||||
struct DataChannelInit;
|
||||
struct DataBuffer;
|
||||
} // namespace livekit
|
||||
|
||||
#endif //RUST_TYPES_H
|
||||
#endif // RUST_TYPES_H
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#ifndef LIVEKIT_WEBRTC_WEBRTC_H
|
||||
#define LIVEKIT_WEBRTC_WEBRTC_H
|
||||
|
||||
#include "rtc_base/ssl_adapter.h"
|
||||
#include "rtc_base/physical_socket_server.h"
|
||||
#include "rtc_base/ssl_adapter.h"
|
||||
|
||||
#ifdef WEBRTC_WIN
|
||||
#include "rtc_base/win32_socket_init.h"
|
||||
@@ -14,21 +14,22 @@
|
||||
|
||||
namespace livekit {
|
||||
|
||||
class RTCRuntime {
|
||||
public:
|
||||
RTCRuntime();
|
||||
~RTCRuntime();
|
||||
class RTCRuntime {
|
||||
public:
|
||||
RTCRuntime();
|
||||
~RTCRuntime();
|
||||
|
||||
RTCRuntime(const RTCRuntime&) = delete;
|
||||
RTCRuntime& operator=(const RTCRuntime&) = delete;
|
||||
private:
|
||||
#ifdef WEBRTC_WIN
|
||||
rtc::WinsockInitializer winsock_;
|
||||
#endif
|
||||
};
|
||||
RTCRuntime(const RTCRuntime&) = delete;
|
||||
RTCRuntime& operator=(const RTCRuntime&) = delete;
|
||||
|
||||
std::unique_ptr<RTCRuntime> create_rtc_runtime();
|
||||
private:
|
||||
#ifdef WEBRTC_WIN
|
||||
rtc::WinsockInitializer winsock_;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // livekit
|
||||
std::unique_ptr<RTCRuntime> create_rtc_runtime();
|
||||
|
||||
#endif //LIVEKIT_WEBRTC_WEBRTC_H
|
||||
} // namespace livekit
|
||||
|
||||
#endif // LIVEKIT_WEBRTC_WEBRTC_H
|
||||
|
||||
Reference in New Issue
Block a user