StreamManager refactoring
[platform/core/ml/aitt.git] / modules / webrtc / SrcStreamManager.h
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #pragma once
18
19 #include <map>
20
21 #include "StreamManager.h"
22
23 namespace AittWebRTCNamespace {
24
25 class SrcStreamManager : public StreamManager {
26   public:
27     explicit SrcStreamManager(const std::string &topic, const std::string &aitt_id,
28           const std::string &thread_id);
29     virtual ~SrcStreamManager();
30     std::vector<uint8_t> GetDiscoveryMessage(void) override;
31
32   private:
33     void SetWebRtcStreamCallbacks(WebRtcStream &stream) override;
34     void OnStreamStateChanged(WebRtcState::Stream state);
35     void OnAnswerCreated(std::string sdp, WebRtcStream &stream);
36     void OnIceCandidate(void);
37     void OnSignalingStateNotify(WebRtcState::Signaling state, WebRtcStream &stream);
38     void HandleStreamState(const std::string &discovery_id,
39           const std::vector<uint8_t> &message) override;
40     void HandleStreamInfo(const std::string &discovery_id,
41           const std::vector<uint8_t> &message) override;
42     void AddStream(const std::string &discovery_id, const std::string &id, const std::string &sdp,
43           const std::vector<std::string> &ice_candidates);
44     void UpdateStreamInfo(const std::string &discovery_id, const std::string &id,
45           const std::string &peer_id, const std::string &sdp,
46           const std::vector<std::string> &ice_candidates);
47 };
48 }  // namespace AittWebRTCNamespace