1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_UTILS_FUNCTIONAL_PEER_CONNECTION_OBSERVER_H
2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_UTILS_FUNCTIONAL_PEER_CONNECTION_OBSERVER_H
4 #include <OpenteraWebrtcNativeClient/Signaling/SignalingClient.h>
5 #include <OpenteraWebrtcNativeClient/Utils/Client.h>
7 #include <api/peer_connection_interface.h>
16 void OnSuccess(webrtc::SessionDescriptionInterface* desc)
final;
17 void OnFailure(webrtc::RTCError error)
final;
19 virtual void OnCreateSessionDescriptionObserverSuccess(webrtc::SessionDescriptionInterface* desc) = 0;
20 virtual void OnCreateSessionDescriptionObserverFailure(webrtc::RTCError error) = 0;
26 void OnSuccess()
final;
27 void OnFailure(webrtc::RTCError error)
final;
29 virtual void OnSetSessionDescriptionObserverSuccess() = 0;
30 virtual void OnSetSessionDescriptionObserverFailure(webrtc::RTCError error) = 0;
42 std::function<void(
const std::string&)> m_onError;
43 std::function<void(
const Client&)> m_onClientConnected;
44 std::function<void(
const Client&)> m_onClientDisconnected;
45 std::function<void(
const Client&)> m_onClientConnectionFailed;
47 rtc::scoped_refptr<webrtc::PeerConnectionInterface> m_peerConnection;
49 bool m_onClientDisconnectedCalled;
57 std::function<
void(
const std::string&)>&& onError,
58 std::function<
void(
const Client&)>&& onClientConnected,
59 std::function<
void(
const Client&)>&& onClientDisconnected,
60 std::function<
void(
const Client&)>&& onClientConnectionFailed);
63 virtual void setPeerConnection(
const rtc::scoped_refptr<webrtc::PeerConnectionInterface>& peerConnection);
66 void receivePeerCall(
const std::string& sdp);
67 void receivePeerCallAnswer(
const std::string& sdp);
68 void receiveIceCandidate(
const std::string& sdpMid,
int sdpMLineIndex,
const std::string& sdp);
71 void OnConnectionChange(webrtc::PeerConnectionInterface::PeerConnectionState newState)
override;
72 void OnIceCandidate(
const webrtc::IceCandidateInterface* candidate)
override;
74 void OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> dataChannel)
override;
76 void OnTrack(rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver)
override;
77 void OnRemoveTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver)
override;
79 void OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState newState)
override;
80 void OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState newState)
override;
82 void OnCreateSessionDescriptionObserverSuccess(webrtc::SessionDescriptionInterface* desc)
override;
83 void OnCreateSessionDescriptionObserverFailure(webrtc::RTCError error)
override;
85 void OnSetSessionDescriptionObserverSuccess()
override;
86 void OnSetSessionDescriptionObserverFailure(webrtc::RTCError error)
override;
88 void AddRef()
const override;
89 [[nodiscard]] rtc::RefCountReleaseStatus Release()
const override;
92 virtual void createAnswer();
95 void setTransceiverDirection(
96 const rtc::scoped_refptr<webrtc::RtpTransceiverInterface>& transceiver,
97 webrtc::RtpTransceiverDirection direction);
Represents a peer client.
Definition: Client.h:14
Definition: PeerConnectionHandler.h:14
Definition: PeerConnectionHandler.h:36
Definition: PeerConnectionHandler.h:24
Definition: SignalingClient.h:16