SkyWay Linux SDK
読み取り中…
検索中…
一致する文字列を見つけられません
room_publication.hpp
1#ifndef SKYWAY_ROOM_ROOM_PUBLICATION_HPP
2#define SKYWAY_ROOM_ROOM_PUBLICATION_HPP
3
4#include <mutex>
5
6#include <skyway/core/interface/publication.hpp>
7
8#include "skyway/media/stream/interface/local/local_stream.hpp"
9#include "skyway/room/interface/room_domain_factory.hpp"
10#include "skyway/room/interface/room_publication.hpp"
11
12namespace skyway {
13namespace room {
14
17public:
19 RoomPublication(std::shared_ptr<core::interface::Publication> core,
20 interface::RoomDomainFactory* factory,
21 std::shared_ptr<media::stream::interface::local::LocalStream> stream);
23
25 std::string Id() override;
27 std::shared_ptr<interface::RoomMember> Publisher() override;
28 std::vector<std::shared_ptr<interface::RoomSubscription>> Subscriptions() override;
30 std::optional<std::string> Metadata() override;
31 std::vector<Codec> CodecCapabilities() override;
32 std::vector<Encoding> Encodings() override;
34 std::shared_ptr<media::stream::interface::local::LocalStream> Stream() override;
37 bool UpdateMetadata(const std::string& metadata) override;
38 bool UpdateEncodings(std::vector<Encoding> encodings) override;
40 std::shared_ptr<media::stream::interface::local::LocalStream> stream) override;
41 bool Enable() override;
42 bool Disable() override;
43 std::optional<WebRTCStats> GetStats(const std::string& selector) override;
44
45private:
46 class CoreEventListenerAdapter : public core::interface::Publication::EventListener {
47 public:
48 CoreEventListenerAdapter(RoomPublication* outer);
49 void OnUnpublished();
50 void OnSubscribed(std::shared_ptr<core::interface::Subscription> subscription);
51 void OnUnsubscribed(std::shared_ptr<core::interface::Subscription> subscription);
52 void OnSubscriptionListChanged();
53 void OnMetadataUpdated(const std::string& metadata);
54 void OnEnabled();
55 void OnDisabled();
56 void OnStateChanged();
57 void OnConnectionStateChanged(const core::ConnectionState new_state);
58
59 private:
60 RoomPublication* outer_;
61 };
62
63 class OriginEventListenerAdapter : public core::interface::Publication::EventListener {
64 public:
65 OriginEventListenerAdapter(RoomPublication* outer);
66 void OnMetadataUpdated(const std::string& metadata) override;
67
68 private:
69 RoomPublication* outer_;
70 };
71
72 void OnUnpublished();
73 void OnSubscribed(std::shared_ptr<core::interface::Subscription> subscription);
74 void OnUnsubscribed(std::shared_ptr<core::interface::Subscription> subscription);
75 void OnSubscriptionListChanged();
76 void OnMetadataUpdated(const std::string& metadata);
77 void OnEnabled();
78 void OnDisabled();
79 void OnStateChanged();
80 void OnConnectionStateChanged(const core::ConnectionState new_state);
81 void SetStream(std::shared_ptr<media::stream::interface::local::LocalStream> stream);
82 domain::PublicationType ConvertToPlatformPublicationType(model::PublicationType type);
83 PublicationState ConvertToPlatformPublicationState(core::interface::PublicationState state);
84 std::mutex stream_mtx_;
85 std::shared_ptr<media::stream::interface::local::LocalStream> stream_;
86 std::shared_ptr<core::interface::Publication> core_;
87 interface::RoomDomainFactory* factory_;
88 std::unique_ptr<CoreEventListenerAdapter> core_event_listener_adapter_;
89
90 std::mutex listener_mtx_;
91 interface::RoomPublication::EventListener* listener_;
92 std::unique_ptr<OriginEventListenerAdapter> origin_event_listener_adapter_;
93};
94
95} // namespace room
96} // namespace skyway
97
98#endif /* SKYWAY_ROOM_ROOM_PUBLICATION_HPP */
RoomPublicationの操作を行うクラス
Definition room_publication.hpp:16
std::optional< std::string > Metadata() override
Metadataを取得します。
void AddEventListener(interface::RoomPublication::EventListener *listener) override
イベントを購読します。
domain::ContentType ContentType() override
ContentType(VideoかAudioかDataか)を取得します。
PublicationState State() override
State(公開状態がEnableかDisabelかCancelか)を取得します。
bool UpdateEncodings(std::vector< Encoding > encodings) override
エンコーディング設定を更新します。
bool UpdateMetadata(const std::string &metadata) override
Metadataを更新します。
bool Disable() override
Publicationの公開を一時停止します。
bool Enable() override
Publicationの公開を開始します。disableによって停止していた場合は再開します。
domain::PublicationType Type() override
PublicationのTypeを取得します。
std::optional< WebRTCStats > GetStats(const std::string &selector) override
統計情報を取得します。
std::shared_ptr< media::stream::interface::local::LocalStream > Stream() override
Publisherが持つStreamを取得します。
bool ReplaceStream(std::shared_ptr< media::stream::interface::local::LocalStream > stream) override
公開しているStreamを変更します。
std::shared_ptr< interface::RoomMember > Publisher() override
このPublicationを公開しているMemberを取得します。
void RemoveEventListener(interface::RoomPublication::EventListener *listener) override
イベントの購読を中止します。
std::vector< Codec > CodecCapabilities() override
このPublicationのコーデック一覧を取得します。
std::vector< std::shared_ptr< interface::RoomSubscription > > Subscriptions() override
このPublicationを購読しているSubsciptionの一覧を取得します。
std::vector< Encoding > Encodings() override
このPublicationのエンコーディング設定の一覧を取得します。
std::string Id() override
Idを取得します。
イベントリスナ
Definition room_publication.hpp:19
RoomのPublicationを操作するインタフェース
Definition room_publication.hpp:16
PublicationType
Publicationの通信方式
Definition domain.hpp:19
ContentType
コンテンツの種類
Definition domain.hpp:22
PublicationState
Publicationの公開状態
Definition types.hpp:30