2 * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include "StreamManager.h"
23 namespace AittWebRTCNamespace {
25 class SinkStreamManager : public StreamManager {
27 using EncodedFrameCallabck = std::function<void(void)>;
28 explicit SinkStreamManager(const std::string &topic, const std::string &aitt_id,
29 const std::string &thread_id);
30 virtual ~SinkStreamManager();
31 std::vector<uint8_t> GetDiscoveryMessage(void) override;
32 // TODO: WebRTC CAPI doesn't allow destroy webrtc handle at callback.
33 // We need to avoid that situation
34 void SetOnEncodedFrameCallback(EncodedFrameCallabck cb);
37 void SetWebRtcStreamCallbacks(WebRtcStream &stream) override;
38 void OnStreamStateChanged(WebRtcState::Stream state, WebRtcStream &stream);
39 void OnOfferCreated(std::string sdp, WebRtcStream &stream);
40 void OnIceCandidate(void);
41 void OnEncodedFrame(void);
42 void HandleStreamState(const std::string &discovery_id,
43 const std::vector<uint8_t> &message) override;
44 void HandleStartStream(const std::string &discovery_id);
45 void HandleStreamInfo(const std::string &discovery_id,
46 const std::vector<uint8_t> &message) override;
47 void AddStream(const std::string &discovery_id);
48 void UpdateStreamInfo(const std::string &discovery_id, const std::string &id,
49 const std::string &peer_id, const std::string &sdp,
50 const std::vector<std::string> &ice_candidates);
52 EncodedFrameCallabck encoded_frame_cb_;
54 } // namespace AittWebRTCNamespace