#pragma once #include "api.h" #include #include "../common/comm.h" #include "../common/iobuffer.h" class IOverlayVideo; class SocketRemote; class CPeerConnection { public: CPeerConnection(SocketRemote * c); virtual ~CPeerConnection(); void Initialize(int32_t peer, int32_t index); //static void ConnectionCallBack(void* UserData); static void LocalSdpReadytoSendCallback(void* user_data, int32_t peer, int32_t view, const char* type, const char* sdp_data); static void IceCandidateReadytoSendCallback(void* user_data, int32_t peer, int32_t view, const char* sdp, int32_t sdp_mline_index, const char* sdp_mid); void AddLocalVideoFrameReady(PeerConnectionVideoFrameCallback fn, void* user_data); void AddLocalAudioTrack(); void RemoveLocalAudioTrack(); void AddRemoteVideoFrameReady(PeerConnectionVideoFrameCallback fn, void* user_data); void AddDataChannel(bool ordered, bool reliable); void RemoveDataChannel(); void SetRemoteDescription(const char* type, std::string sdp); bool CreateAnswer(); bool CreateOffer(); void AddIceCandidate(const char* sdp, int32_t sdp_mline_index, const char* sdp_mid); void Close(); IOverlayVideo* CreateOverlayVideo(); void AddLocalVideoTrack(IOverlayVideo* render); // void AddLocalVideoTrack(int32_t index,const std::string& label,const std::string &videourl,int32_t width,int32_t height); private: //void OnConnect(); void OnLocalSdpReadytoSend(int32_t peer, int32_t view, const char* type, const char* sdp); void OnIceCandidateReadytoSend(int32_t peer, int32_t view, const char* sdp, int32_t sdp_mline_index, const char* sdp_mid); private: PeerConnectionHandle _nativeHandle; ChannelType _type; SocketRemote* _client; };