Intel® Collaboration Suite for WebRTC  version 4.3.1
Open WebRTC Toolkit (OWT) Client SDK for Windows*
p2ppublication.h
1 // Copyright (C) <2018> Intel Corporation
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 #ifndef OWT_P2P_PUBLICATION_H_
5 #define OWT_P2P_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 namespace rtc {
12 class TaskQueue;
13 }
14 namespace owt {
15 namespace p2p {
16 using namespace owt::base;
17 class P2PClient;
18 class P2PPublication : public Publication {
19  public:
20  P2PPublication(std::shared_ptr<P2PClient> client, std::string target_id, std::shared_ptr<LocalStream> stream);
21  virtual ~P2PPublication() {}
23  void GetStats(
24  std::function<void(std::shared_ptr<ConnectionStats>)> on_success,
25  std::function<void(std::unique_ptr<Exception>)> on_failure) override;
27  void Stop() override;
30  void Mute(TrackKind track_kind,
31  std::function<void()> on_success,
32  std::function<void(std::unique_ptr<Exception>)> on_failure) override {}
35  void Unmute(TrackKind track_kind,
36  std::function<void()> on_success,
37  std::function<void(std::unique_ptr<Exception>)> on_failure) override {}
39  void AddObserver(PublicationObserver& observer) override;
41  void RemoveObserver(PublicationObserver& observer) override;
42  private:
43  std::string target_id_;
44  std::shared_ptr<LocalStream> local_stream_;
45  std::weak_ptr<P2PClient> p2p_client_; // Weak ref to associated p2p client
46  std::shared_ptr<rtc::TaskQueue> event_queue_;
47  mutable std::mutex observer_mutex_;
48  std::vector<std::reference_wrapper<PublicationObserver>> observers_;
49  bool ended_;
50 };
51 } // namespace p2p
52 } // namespace owt
53 #endif // OWT_P2P_PUBLICATION_H_
Definition: conferencepublication.h:12
void Mute(TrackKind track_kind, std::function< void()> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) override
Definition: p2ppublication.h:30
Definition: publication.h:23
Definition: audioplayerinterface.h:8
Definition: audioplayerinterface.h:9
Definition: p2ppublication.h:18
Observer that receives event from publication.
Definition: publication.h:12
void Unmute(TrackKind track_kind, std::function< void()> on_success, std::function< void(std::unique_ptr< Exception >)> on_failure) override
Definition: p2ppublication.h:35