SkyWay Linux SDK
読み取り中…
検索中…
一致する文字列を見つけられません
data_stream.hpp
1//
2// © NTT DOCOMO BUSINESS, Inc. All Rights Reserved.
3//
4
5#ifndef SKYWAY_CORE_STREAM_REMOTE_DATA_STREAM_HPP_
6#define SKYWAY_CORE_STREAM_REMOTE_DATA_STREAM_HPP_
7
8#include <mutex>
9
10#include <api/data_channel_interface.h>
11
12#include "skyway/core/interface/remote_stream.hpp"
13
14namespace skyway {
15namespace core {
16namespace stream {
17namespace remote {
18
19using RemoteStream = interface::RemoteStream;
20
23public:
24 using PublicationId = std::string;
26 class Listener {
27 public:
28 virtual void OnData(const std::string& data) = 0;
29 virtual void OnDataBuffer(const uint8_t* data, size_t length) = 0;
30 };
31 RemoteDataStream(const std::string& id);
34 virtual void AddListener(Listener* listener);
35
38 virtual void RemoveListener(Listener* listener);
39
41 void OnDataBuffer(const webrtc::DataBuffer& buffer);
43 bool Enable() override;
45 bool Disable() override;
47
48private:
49 std::mutex listeners_mutex_;
50 std::vector<Listener*> listeners_;
51 std::atomic<bool> is_enabled_;
52};
53
54} // namespace remote
55} // namespace stream
56} // namespace core
57} // namespace skyway
58
59#endif /* SKYWAY_CORE_STREAM_REMOTE_DATA_STREAM_HPP_ */
RemoteMemberで扱うStream
Definition remote_stream.hpp:15
データ受信イベントリスナ
Definition data_stream.hpp:26
RemoteMemberで扱うDataStream
Definition data_stream.hpp:22
virtual void AddListener(Listener *listener)
データ受信イベントリスナを購読します。
virtual void RemoveListener(Listener *listener)
データ受信イベントリスナの購読を中止します。