Intel® Collaboration Suite for WebRTC  version 4.3.1
Open WebRTC Toolkit (OWT) Client SDK for Windows*
conferencepublication.h
1 // Copyright (C) <2018> Intel Corporation
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 #ifndef OWT_CONFERENCE_PUBLICATION_H_
5 #define OWT_CONFERENCE_PUBLICATION_H_
6 #include <vector>
7 #include <mutex>
8 #include "owt/base/commontypes.h"
9 #include "owt/base/mediaconstraints.h"
10 #include "owt/base/publication.h"
11 #include "owt/conference/streamupdateobserver.h"
12 namespace rtc {
13  class TaskQueue;
14 }
15 namespace webrtc{
16  class StatsReport;
17 }
18 namespace owt {
19 namespace base {
20 struct ConnectionStats;
21 }
22 namespace conference {
23 class ConferenceClient;
24 using namespace owt::base;
25 class ConferencePublication : public Publication, public ConferenceStreamUpdateObserver {
26  public:
27  ConferencePublication(std::shared_ptr<ConferenceClient> client, const std::string& pub_id,
28  const std::string& stream_id);
29  virtual ~ConferencePublication();
31  std::string Id() const { return id_; }
33  void Mute(TrackKind track_kind,
34  std::function<void()> on_success,
35  std::function<void(std::unique_ptr<Exception>)> on_failure) override;
37  void Unmute(TrackKind track_kind,
38  std::function<void()> on_success,
39  std::function<void(std::unique_ptr<Exception>)> on_failure) override;
41  void GetStats(
42  std::function<void(std::shared_ptr<ConnectionStats>)> on_success,
43  std::function<void(std::unique_ptr<Exception>)> on_failure) override;
44  void GetNativeStats(
45  std::function<void(
46  const std::vector<const webrtc::StatsReport*>& reports)> on_success,
47  std::function<void(std::unique_ptr<Exception>)> on_failure);
49  void Stop() override;
51  bool Ended() const { return ended_; }
53  void AddObserver(PublicationObserver& observer) override;
55  void RemoveObserver(PublicationObserver& observer) override;
56  private:
57  void OnStreamMuteOrUnmute(const std::string& stream_id, TrackKind track_kind, bool muted) override;
58  void OnStreamRemoved(const std::string& stream_id) override;
59  void OnStreamError(const std::string& error_msg) override;
60  std::string id_;
61  std::string stream_id_;
62  bool ended_;
63  mutable std::mutex observer_mutex_;
64  std::vector<std::reference_wrapper<PublicationObserver>> observers_;
65  std::weak_ptr<ConferenceClient> conference_client_; // Weak ref to associated conference client
66  std::shared_ptr<rtc::TaskQueue> event_queue_;
67 };
68 } // namespace conference
69 } // namespace owt
70 #endif // OWT_CONFERENCE_PUBLICATION_H_
Definition: conferencepublication.h:12
bool Ended() const
Check if the publication is stopped or not.
Definition: conferencepublication.h:51
Definition: publication.h:23
Definition: stream.h:17
Definition: audioplayerinterface.h:8
Definition: audioplayerinterface.h:9
Definition: conferencepublication.h:25
Observer that receives event from publication.
Definition: publication.h:12
std::string Id() const
Return the ID of the publication.
Definition: conferencepublication.h:31