1 #ifndef OPENTERA_WEBRTC_NATIVE_CLIENT_STREAM_CLIENT_H
2 #define OPENTERA_WEBRTC_NATIVE_CLIENT_STREAM_CLIENT_H
4 #include <OpenteraWebrtcNativeClient/Sources/AudioSource.h>
5 #include <OpenteraWebrtcNativeClient/Sources/VideoSource.h>
6 #include <OpenteraWebrtcNativeClient/Handlers/StreamPeerConnectionHandler.h>
8 #include <OpenteraWebrtcNativeClient/WebrtcClient.h>
19 std::shared_ptr<VideoSource> m_videoSource;
20 std::shared_ptr<AudioSource> m_audioSource;
22 bool m_hasOnMixedAudioFrameReceivedCallback;
23 std::function<void(
const Client&)> m_onAddRemoteStream;
24 std::function<void(
const Client&)> m_onRemoveRemoteStream;
25 VideoFrameReceivedCallback m_onVideoFrameReceived;
26 EncodedVideoFrameReceivedCallback m_onEncodedVideoFrameReceived;
27 AudioFrameReceivedCallback m_onAudioFrameReceived;
29 bool m_isLocalAudioMuted;
30 bool m_isRemoteAudioMuted;
31 bool m_isLocalVideoMuted;
42 std::shared_ptr<VideoSource> videoSource);
47 std::shared_ptr<AudioSource> audioSource);
52 std::shared_ptr<VideoSource> videoSource,
53 std::shared_ptr<AudioSource> audioSource);
82 std::unique_ptr<PeerConnectionHandler>
92 return callSync(getInternalClientThread(), [
this]() {
return m_isLocalAudioMuted; });
112 return callSync(getInternalClientThread(), [
this]() {
return m_isRemoteAudioMuted; });
131 return callSync(getInternalClientThread(), [
this]() {
return m_isLocalVideoMuted; });
158 callSync(getInternalClientThread(), [
this, &callback]() { m_onAddRemoteStream = callback; });
175 callSync(getInternalClientThread(), [
this, &callback]() { m_onRemoveRemoteStream = callback; });
194 callSync(getInternalClientThread(), [
this, &callback]() { m_onVideoFrameReceived = callback; });
218 callSync(getInternalClientThread(), [
this, &callback]() { m_onEncodedVideoFrameReceived = callback; });
240 callSync(getInternalClientThread(), [
this, &callback]() { m_onAudioFrameReceived = callback; });
261 bool hasOnMixedAudioFrameReceivedCallback(callback);
263 getInternalClientThread(),
264 [
this, hasOnMixedAudioFrameReceivedCallback]()
265 { m_hasOnMixedAudioFrameReceivedCallback = hasOnMixedAudioFrameReceivedCallback; });
267 m_audioDeviceModule->setOnMixedAudioFrameReceived(callback);
Represents a peer client.
Definition: Client.h:14
Represents a signaling server configuration.
Definition: SignalingServerConfiguration.h:14
A signaling client to join a WebRTC room and stream a video source.
Definition: StreamClient.h:18
void unmuteLocalVideo()
Unmutes the local video.
Definition: StreamClient.h:142
void setRemoteAudioMuted(bool muted)
Mutes or unmutes the remote audio.
Definition: StreamClient.cpp:141
void setOnVideoFrameReceived(const VideoFrameReceivedCallback &callback)
Sets the callback that is called when a video stream frame is received.
Definition: StreamClient.h:192
bool isLocalAudioMuted()
Indicates if the local audio is muted.
Definition: StreamClient.h:90
void muteLocalAudio()
Mutes the local audio.
Definition: StreamClient.h:99
void unmuteRemoteAudio()
Unmutes the remote audio.
Definition: StreamClient.h:123
StreamClient(SignalingServerConfiguration signalingServerConfiguration, WebrtcConfiguration webrtcConfiguration, VideoStreamConfiguration videoStreamConfiguration)
Creates a stream client.
Definition: StreamClient.cpp:14
void setOnMixedAudioFrameReceived(const AudioSinkCallback &callback)
Sets the callback that is called when a mixed audio stream frame is received.
Definition: StreamClient.h:259
void unmuteLocalAudio()
Unmutes the local audio.
Definition: StreamClient.h:104
std::unique_ptr< PeerConnectionHandler > createPeerConnectionHandler(const std::string &id, const Client &peerClient, bool isCaller) override
Creates the peer connection handler for this client.
Definition: StreamClient.cpp:182
void setLocalAudioMuted(bool muted)
Mutes or unmutes the local audio.
Definition: StreamClient.cpp:123
void setOnRemoveRemoteStream(const std::function< void(const Client &)> &callback)
Sets the callback that is called when a stream is removed.
Definition: StreamClient.h:173
bool isRemoteAudioMuted()
Indicates if the remote audio is muted.
Definition: StreamClient.h:110
void muteLocalVideo()
Mutes the local video.
Definition: StreamClient.h:137
void setLocalVideoMuted(bool muted)
Mutes or unmutes the local video.
Definition: StreamClient.cpp:159
void setOnEncodedVideoFrameReceived(const EncodedVideoFrameReceivedCallback &callback)
Sets the callback that is called when an encoded video stream frame is received.
Definition: StreamClient.h:216
void setOnAddRemoteStream(const std::function< void(const Client &)> &callback)
Sets the callback that is called when a stream is added.
Definition: StreamClient.h:156
void muteRemoteAudio()
Mutes the remote audio.
Definition: StreamClient.h:118
void setOnAudioFrameReceived(const AudioFrameReceivedCallback &callback)
Sets the callback that is called when an audio stream frame is received.
Definition: StreamClient.h:238
bool isLocalVideoMuted()
Indicates if the local video is muted.
Definition: StreamClient.h:129
Represents a video stream configuration.
Definition: VideoStreamConfiguration.h:26
Represents the base class of DataChannelClient and StreamClient.
Definition: WebrtcClient.h:29
Represents a WebRTC peer connection configuration.
Definition: WebrtcConfiguration.h:14