1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_HANDLERS_STREAM_PEER_CONNECTION_HANDLER_H
2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_HANDLERS_STREAM_PEER_CONNECTION_HANDLER_H
4 #include <OpenteraWebrtcNativeClient/Handlers/PeerConnectionHandler.h>
5 #include <OpenteraWebrtcNativeClient/Sinks/VideoSink.h>
6 #include <OpenteraWebrtcNativeClient/Sinks/EncodedVideoSink.h>
7 #include <OpenteraWebrtcNativeClient/Sinks/AudioSink.h>
13 using VideoFrameReceivedCallback = std::function<void(
const Client&,
const cv::Mat&, uint64_t)>;
14 using EncodedVideoFrameReceivedCallback = std::function<void(
18 VideoCodecType codecType,
22 uint64_t timestampUs)>;
23 using AudioFrameReceivedCallback = std::function<void(
25 const void* audioData,
28 size_t numberOfChannels,
29 size_t numberOfFrames)>;
33 bool m_offerToReceiveVideo;
34 bool m_offerToReceiveAudio;
36 rtc::scoped_refptr<webrtc::VideoTrackInterface> m_videoTrack;
37 rtc::scoped_refptr<webrtc::AudioTrackInterface> m_audioTrack;
39 std::function<void(
const Client&)> m_onAddRemoteStream;
40 std::function<void(
const Client&)> m_onRemoveRemoteStream;
42 std::unique_ptr<VideoSink> m_videoSink;
43 std::unique_ptr<EncodedVideoSink> m_encodedVideoSink;
44 std::unique_ptr<AudioSink> m_audioSink;
46 std::set<rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>> m_tracks;
53 bool hasOnMixedAudioFrameReceivedCallback,
55 std::function<
void(
const std::string&)> onError,
56 std::function<
void(
const Client&)> onClientConnected,
57 std::function<
void(
const Client&)> onClientDisconnected,
58 std::function<
void(
const Client&)> onClientConnectionFailed,
59 rtc::scoped_refptr<webrtc::VideoTrackInterface> videoTrack,
60 rtc::scoped_refptr<webrtc::AudioTrackInterface> audioTrack,
61 std::function<
void(
const Client&)> onAddRemoteStream,
62 std::function<
void(
const Client&)> onRemoveRemoteStream,
63 const VideoFrameReceivedCallback& onVideoFrameReceived,
64 const EncodedVideoFrameReceivedCallback& onEncodedVideoFrameReceived,
65 const AudioFrameReceivedCallback& onAudioFrameReceived);
69 void setPeerConnection(
const rtc::scoped_refptr<webrtc::PeerConnectionInterface>& peerConnection)
override;
71 void setAllLocalAudioTracksEnabled(
bool enabled);
72 void setAllRemoteAudioTracksEnabled(
bool enabled);
73 void setAllVideoTracksEnabled(
bool enabled);
76 void OnTrack(rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver)
override;
77 void OnRemoveTrack(rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver)
override;
80 void createAnswer()
override;
84 cricket::MediaType type,
85 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track,
87 void updateTransceiver(
88 cricket::MediaType type,
89 rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> track,
92 void setAllLocalTracksEnabled(
const char* kind,
bool enabled);
93 void setAllRemoteTracksEnabled(
const char* kind,
bool enabled);
Represents a peer client.
Definition: Client.h:14
Definition: PeerConnectionHandler.h:36
Definition: SignalingClient.h:16
Definition: StreamPeerConnectionHandler.h:32