SkyWay Linux SDK
読み取り中…
検索中…
一致する文字列を見つけられません
subscription.hpp
1//
2// © NTT DOCOMO BUSINESS, Inc. All Rights Reserved.
3//
4
5#ifndef SKYWAY_CORE_SUBSCRIPTION_HPP_
6#define SKYWAY_CORE_SUBSCRIPTION_HPP_
7
8#include "skyway/core/interface/channel.hpp"
9#include "skyway/core/interface/member.hpp"
10#include "skyway/core/interface/publication.hpp"
11#include "skyway/core/interface/subscription.hpp"
12#include "skyway/model/domain.hpp"
13
14namespace skyway {
15namespace core {
16
19public:
21 Subscription(std::shared_ptr<interface::Channel> channel, const model::Subscription& initial_dto, model::ContentType content_type);
23
27 void AddInternalListener(interface::Subscription::InternalListener* listener) override;
28 void RemoveInternalListener(interface::Subscription::InternalListener* listener) override;
30
31 std::string Id() const override;
32 model::ContentType ContentType() const override;
33 std::shared_ptr<interface::Publication> Publication() const override;
34 std::shared_ptr<interface::Member> Subscriber() const override;
35 interface::SubscriptionState State() override;
36
37 std::shared_ptr<interface::RemoteStream> Stream() override;
38 std::optional<std::string> PreferredEncodingId() const override;
39
40 bool ChangePreferredEncoding(const std::string& id) override;
41 bool Cancel() const override;
42 std::optional<model::WebRTCStats> GetStats() override;
44 void AddGetStatsCallback(Callback* callback) override;
45 void RemoveGetStatsCallback() override;
46
47 void SetStream(std::shared_ptr<interface::RemoteStream> stream) override;
48 void SetPreferredEncodingId(const std::string& id) override;
49
50 void OnCanceled() override;
51 void OnConnectionStateChanged(const core::ConnectionState new_state) override;
53private:
54 std::weak_ptr<interface::Channel> channel_;
55 model::Subscription initial_dto_;
56 model::ContentType content_type_;
57 std::atomic<interface::SubscriptionState> state_;
58 std::weak_ptr<interface::Member> subscriber_;
59 std::mutex stream_mtx_;
60 std::shared_ptr<interface::RemoteStream> stream_;
61 std::optional<std::string> preferred_encoding_id_;
62
63 std::mutex listeners_mtx_;
64 std::unordered_set<interface::Subscription::EventListener*> listeners_;
65 std::mutex internal_listeners_mtx_;
66 std::unordered_set<interface::Subscription::InternalListener*> internal_listeners_;
67 std::mutex get_stats_callback_mutex_;
68 Callback* get_stats_callback_;
69
70public:
72 friend class CoreSubscriptionTest;
74};
75
76} // namespace core
77} // namespace skyway
78
79#endif /* SKYWAY_CORE_SUBSCRIPTION_HPP_ */
Subscriptionの実装クラス
Definition subscription.hpp:18
interface::SubscriptionState State() override
State(公開状態がEnableかDisabelかCancelか)を取得します。
std::shared_ptr< interface::RemoteStream > Stream() override
Publisherが持つStreamを取得します。
bool ChangePreferredEncoding(const std::string &id) override
受信するエンコード設定を切り替えます。
std::shared_ptr< interface::Member > Subscriber() const override
このSubscriptionをSubscribeしているMemberを取得します。
void AddEventListener(interface::Subscription::EventListener *listener) override
イベントを購読します。
void RemoveEventListener(interface::Subscription::EventListener *listener) override
イベントの購読を中止します。
std::shared_ptr< interface::Publication > Publication() const override
このSubscriptionに紐づくPublicationを取得します。
std::optional< std::string > PreferredEncodingId() const override
このSubscriptionの優先エンコーディングIDを取得します。
model::ContentType ContentType() const override
ContentType(VideoかAudioかDataか)を取得します。
std::string Id() const override
Idを取得します。
std::optional< model::WebRTCStats > GetStats() override
統計情報を取得します。
bool Cancel() const override
Subscribeを中止します。
イベントリスナ
Definition subscription.hpp:30
Subscriptionのインターフェース
Definition subscription.hpp:27
Subscription情報
Definition domain.hpp:135