44 Channel(std::unique_ptr<rtc_api::interface::ChannelState> rtc_api_channel_state,
45 std::unique_ptr<interface::ChunkMessengerFactory> chunk_messenger_factory);
46 Channel(std::unique_ptr<rtc_api::interface::ChannelState> rtc_api_channel_state);
55 static std::shared_ptr<Channel>
Create();
65 static void DisposeAllChannels();
71 std::string
Id()
const override;
72 boost::optional<std::string>
Name()
const override;
73 boost::optional<std::string>
Metadata()
const override;
75 std::vector<RemoteMember*>
Bots(
bool active_only =
true)
override;
76 std::vector<MemberInterface*>
Members(
bool active_only =
true)
override;
77 std::vector<PublicationInterface*>
Publications(
bool active_only =
true)
override;
78 std::vector<SubscriptionInterface*>
Subscriptions(
bool active_only =
true)
override;
79 ChannelState
State()
const override;
85 void Dispose(
bool remove_myself_if_needed =
true)
override;
88 MemberInterface* FindMember(
const std::string& member_id,
bool active_only =
true)
override;
89 RemoteMember* FindRemoteMember(
const std::string& member_id,
bool active_only =
true)
override;
91 bool active_only =
true)
override;
93 bool active_only =
true)
override;
94 std::vector<SubscriptionInterface*> GetSubscriptionsByPublicationId(
95 const std::string& publication_id,
bool active_only =
true)
override;
96 std::vector<SubscriptionInterface*> GetSubscriptionsBySubscriberId(
97 const std::string& subscriber_id,
bool active_only =
true)
override;
98 std::vector<PublicationInterface*> GetPublicationsByPublisherId(
99 const std::string& publisher_id,
bool active_only =
true)
override;
101 boost::optional<model::Member> GetMemberDto(
const std::string& member_id)
const override;
102 boost::optional<model::Publication> GetPublicationDto(
103 const std::string& publication_id)
const override;
104 boost::optional<model::Subscription> GetSubscriptionDto(
105 const std::string& subscription_id)
const override;
107 void AddInternalEventListener(interface::Channel::InternalEventListener*)
override;
108 void RemoveInternalEventListener(interface::Channel::InternalEventListener*)
override;
111 void OnChannelDeleted(
const std::string& channel_id)
override;
114 void OnMemberRemoved(
const std::string& member_id)
override;
115 void OnMemberMetadataUpdated(
const model::Member& member)
override;
117 void OnStreamUnpublished(
const std::string& publication_id)
override;
122 void OnPublicationUnsubscribed(
const std::string& subscription_id)
override;
129 std::vector<interface::LocalPerson*> LocalPersons(
bool active_only =
true);
130 std::vector<RemoteMember*> RemoteMembers(
bool active_only =
true);
131 std::unique_ptr<member::LocalPerson> CreateLocalPerson(
const model::Member& member);
132 std::unique_ptr<RemoteMember> CreateRemoteMember(
const model::Member& member);
134 std::unique_ptr<rtc_api::interface::ChannelState> rtc_api_channel_state_;
136 std::atomic<bool> disposed_;
138 std::vector<std::unique_ptr<member::LocalPerson>> persons_;
139 std::vector<std::unique_ptr<RemoteMember>> remote_members_;
140 std::vector<std::unique_ptr<PublicationInterface>> publications_;
141 std::vector<std::unique_ptr<SubscriptionInterface>> subscriptions_;
143 std::unordered_set<interface::Channel::EventListener*> listeners_;
144 std::unordered_set<interface::Channel::InternalEventListener*> internal_listeners_;
146 boost::optional<std::string> tmp_local_person_id_;
147 boost::optional<int> tmp_keepalive_interval_sec_;
148 boost::optional<int> tmp_keepalive_interval_gap_sec_;
149 bool waiting_for_local_person_creation_;
151 std::mutex listeners_mtx_;
154 std::mutex persons_mtx_;
155 std::mutex remote_members_mtx_;
156 std::mutex publications_mtx_;
157 std::mutex subscriptions_mtx_;
158 std::mutex dispose_mtx_;
160 std::unique_ptr<interface::ChunkMessengerFactory> chunk_messenger_factory_;
162 static std::unordered_set<std::shared_ptr<Channel>> channels_;
166 friend class CoreChannelTest;