SkyWay Linux SDK
読み取り中…
検索中…
一致する文字列を見つけられません
context.hpp
1#ifndef SKYWAY_CONTEXT_HPP_
2#define SKYWAY_CONTEXT_HPP_
3
4#include <mutex>
5
6#include <skyway/core/context.hpp>
7#include <skyway/core/interface/remote_member_plugin.hpp>
8#include <skyway/global/error.hpp>
9#include <skyway/global/logger.hpp>
10#include <skyway/network/interface/http_client.hpp>
11#include <skyway/network/interface/websocket_client.hpp>
12#include "skyway/media/codec/video_codec.hpp"
13#include "skyway/media/device_manager.hpp"
14
15namespace skyway {
16namespace media {
17namespace rtp {
18
19class PassthroughVideoEncoderFactoryTest;
20
21} // namespace rtp
22} // namespace media
23
25class Context {
26public:
27 static const unsigned int kVersionMajor = 4;
28 static const unsigned int kVersionMinor = 1;
29 static const unsigned int kVersionPatch = 1;
30
33 public:
34 virtual ~EventListener() = default;
35
37 virtual void OnReconnectStart() = 0;
38
40 virtual void OnReconnectSuccess() = 0;
41
45 virtual void OnFatalError(const global::Error& error) = 0;
46 };
47
50 public:
51 virtual ~AuthTokenListener() = default;
52
54 virtual void OnTokenRefreshingNeeded() {}
55
57 virtual void OnTokenExpired() {}
58 };
59
63
65 struct RtcApi {
66 std::optional<std::string> domain;
67 std::optional<bool> secure;
68 };
69
71 struct IceParams {
72 std::optional<std::string> domain;
73 std::optional<int> version;
74 std::optional<bool> secure;
75 webrtc::PeerConnectionInterface::IceServers custom_ice_servers;
76 };
77
79 struct Signaling {
80 std::optional<std::string> domain;
81 std::optional<bool> secure;
82 };
83
85 struct Analytics {
86 std::optional<std::string> domain;
87 std::optional<bool> secure;
88 };
89
91 struct RtcConfig {
92 std::optional<int> timeout;
93 std::optional<domain::TurnPolicy> policy;
94 };
95
97
99 struct Token {
100 [[deprecated]] std::optional<int> remind_time_sec;
101 std::optional<int> update_remind_sec;
102 AuthTokenListener* listener = nullptr;
103 };
104
108 struct Rtp {
110 struct Input {
112 struct Video {
131 std::shared_ptr<media::codec::VideoCodec> codec;
132 Video() : enabled(false), codec(nullptr) {}
133 };
136 };
139 };
141 domain::LogLevel log_level = domain::LogLevel::kInfo;
142
144 RtcApi rtc_api;
145 IceParams ice_params;
146 Signaling signaling;
147 Analytics analytics;
148 RtcConfig rtc_config;
149 Token token;
151
153 bool enable_webrtc_log = false;
154
157 skyway::media::AudioBackendType::kPulseAudio;
158
164
167
170 struct SFU {
171 std::optional<std::string> domain;
172 std::optional<int> version;
173 std::optional<bool> secure;
174 };
175 SFU sfu;
177 };
178
184 static bool Setup(const std::string& token,
185 EventListener* listener,
186 const SkyWayOptions& options);
187
194 static bool SetupForDev(const std::string& app_id,
195 const std::string& secret_key,
196 EventListener* listener,
197 const SkyWayOptions& options);
198
205 static void Dispose();
206
208 static bool UpdateAuthToken(const std::string& token);
209
211 static std::string GetVersionString();
212
216 static std::shared_ptr<media::codec::VideoCodec> GetRtpVideoInputCodecWithValidate();
218
219private:
220 class CoreEventListenerAdapter : public core::Context::EventListener {
221 public:
222 CoreEventListenerAdapter();
223 void SetListener(Context::EventListener* listener);
224 void OnReconnectStart() override;
225 void OnReconnectSuccess() override;
226 void OnFatalError(const global::Error& error) override;
227
228 private:
229 Context::EventListener* listener_;
230 };
231
232 class CoreAuthTokenListenerAdapter : public token::interface::AuthTokenManager::Listener {
233 public:
234 CoreAuthTokenListenerAdapter();
235 void SetListener(Context::AuthTokenListener* listener);
236 void OnTokenRefreshingNeeded() override;
237 void OnTokenExpired() override;
238
239 private:
241 };
242
243 static core::TurnPolicy ConvertToCoreTurnPolicy(domain::TurnPolicy policy);
244 static core::ContextOptions ConvertToCoreContextOptions(const SkyWayOptions& options);
245
246 inline static SkyWayOptions::Rtp rtp_;
247 static std::mutex core_event_listener_mutex_;
248 static CoreEventListenerAdapter core_event_listener_adapter_;
249 static std::mutex core_auth_token_listener_mutex_;
250 static CoreAuthTokenListenerAdapter core_auth_token_listener_adapter_;
251
252public:
254 friend class media::rtp::PassthroughVideoEncoderFactoryTest;
256};
257} // namespace skyway
258
259#endif /* SKYWAY_CONTEXT_HPP_ */
AuthTokenのイベントリスナ
Definition context.hpp:49
virtual void OnTokenRefreshingNeeded()
設定したリマインド時間に応じてコールされるリマインダコールバック関数
Definition context.hpp:54
virtual void OnTokenExpired()
トークンが失効した時にコールされるコールバック関数
Definition context.hpp:57
Contextのイベントリスナ
Definition context.hpp:32
virtual void OnFatalError(const global::Error &error)=0
回復不能なエラーが発生した時にコールされます。
virtual void OnReconnectStart()=0
再接続処理が開始した時にコールされます。
virtual void OnReconnectSuccess()=0
再接続が成功した時にコールされます。
アプリケーションでSkyWay全体の設定、取得を行うStaticなコンテキスト
Definition context.hpp:25
static std::string GetVersionString()
SkyWay Linux SDKのバージョンを取得します。
static bool UpdateAuthToken(const std::string &token)
AuthTokenを更新します。
static bool SetupForDev(const std::string &app_id, const std::string &secret_key, EventListener *listener, const SkyWayOptions &options)
Contextを初期化します。このメソッドは動作確認用です。
static void Dispose()
SkyWayを終了し、Contextを破棄します。
static bool Setup(const std::string &token, EventListener *listener, const SkyWayOptions &options)
Contextを初期化します。
LogLevel
ログレベル
Definition domain.hpp:25
AudioBackendType
オーディオバックエンドの種類
Definition types.hpp:11
RTP映像入力に関する設定
Definition context.hpp:112
bool enabled
RTP映像入力を有効にするかどうか
Definition context.hpp:120
std::shared_ptr< media::codec::VideoCodec > codec
RTP映像入力のコーデック
Definition context.hpp:131
RTP入力に関する設定
Definition context.hpp:110
Video video
RTP映像入力に関する設定
Definition context.hpp:135
SkyWayのRTPに関する設定
Definition context.hpp:108
Input input
RTP入力に関する設定
Definition context.hpp:138
トークンに関する設定
Definition context.hpp:99
SkyWayの利用に関する設定
Definition context.hpp:61
bool enable_webrtc_log
WebRTCのログを有効にします
Definition context.hpp:153
skyway::media::AudioProcessingOptions audio_processing
音声処理に関する設定
Definition context.hpp:163
domain::LogLevel log_level
ログレベル
Definition context.hpp:141
Rtp rtp
RTPに関する設定
Definition context.hpp:166
skyway::media::AudioBackendType audio_backend
オーディオバックエンドを指定します
Definition context.hpp:156
音声処理に関する設定
Definition types.hpp:19