Open3D (C++ API)  0.18.0
Data Structures | Public Member Functions | Protected Member Functions | Protected Attributes
open3d::visualization::webrtc_server::PeerConnectionManager Class Reference

#include <PeerConnectionManager.h>

Public Member Functions

 PeerConnectionManager (const std::list< std::string > &ice_server_list, const Json::Value &config, const std::string &publish_filter, const std::string &webrtc_udp_port_range)
 
virtual ~PeerConnectionManager ()
 
bool InitializePeerConnection ()
 
const std::map< std::string, HttpServerRequestHandler::HttpFunctionGetHttpApi ()
 
const Json::Value GetIceCandidateList (const std::string &peerid)
 
const Json::Value AddIceCandidate (const std::string &peerid, const Json::Value &json_message)
 
const Json::Value GetMediaList ()
 
const Json::Value HangUp (const std::string &peerid)
 
const Json::Value Call (const std::string &peerid, const std::string &window_uid, const std::string &options, const Json::Value &json_message)
 
const Json::Value GetIceServers ()
 
void SendInitFramesToPeer (const std::string &peerid)
 
void CloseWindowConnections (const std::string &window_uid)
 
void OnFrame (const std::string &window_uid, const std::shared_ptr< core::Tensor > &im)
 

Protected Member Functions

rtc::scoped_refptr< BitmapTrackSourceInterfaceGetVideoTrackSource (const std::string &window_uid)
 
PeerConnectionObserver * CreatePeerConnection (const std::string &peerid)
 
bool AddStreams (webrtc::PeerConnectionInterface *peer_connection, const std::string &window_uid, const std::string &options)
 
rtc::scoped_refptr< BitmapTrackSourceInterfaceCreateVideoSource (const std::string &window_uid, const std::map< std::string, std::string > &opts)
 
bool WindowStillUsed (const std::string &window_uid)
 
rtc::scoped_refptr< webrtc::PeerConnectionInterface > GetPeerConnection (const std::string &peerid)
 

Protected Attributes

std::unique_ptr< webrtc::TaskQueueFactory > task_queue_factory_
 
rtc::scoped_refptr< webrtc::PeerConnectionFactoryInterface > peer_connection_factory_
 
std::unordered_map< std::string, PeerConnectionObserver * > peerid_to_connection_
 
std::mutex peerid_to_connection_mutex_
 
std::unordered_set< std::string > peerid_data_channel_ready_
 
std::mutex peerid_data_channel_mutex_
 
std::unordered_map< std::string, rtc::scoped_refptr< BitmapTrackSourceInterface > > window_uid_to_track_source_
 
std::mutex window_uid_to_track_source_mutex_
 
std::unordered_map< std::string, std::set< std::string > > window_uid_to_peerids_
 
std::unordered_map< std::string, std::string > peerid_to_window_uid_
 
std::mutex window_uid_to_peerids_mutex_
 
std::list< std::string > ice_server_list_
 
const Json::Value config_
 
const std::regex publish_filter_
 
std::map< std::string, HttpServerRequestHandler::HttpFunctionfunc_
 
std::string webrtc_port_range_
 

Detailed Description

PeerConnectionManager manages WebRTC signaling (i.e. handshake), data channel and video streams.

[Stage 1: Signaling] Signaling is the handshake process to establish a WebRTC connection. See https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Connectivity#signaling for more information. In PeerConnectionManager, a WebRTC client (e.g. JavaScript video player) calls the following HTTP APIs:

[Stage 2: Sending video streams and send/recv with data channel]

[Stage 3: Hangup] The client calls /api/hangup to close the WebRTC connection. This does not close the Open3D Window as a Window can be connected to 0 or more peers.

TODO (yixing): Use PImpl.

Constructor & Destructor Documentation

◆ PeerConnectionManager()

open3d::visualization::webrtc_server::PeerConnectionManager::PeerConnectionManager ( const std::list< std::string > &  ice_server_list,
const Json::Value &  config,
const std::string &  publish_filter,
const std::string &  webrtc_udp_port_range 
)

◆ ~PeerConnectionManager()

open3d::visualization::webrtc_server::PeerConnectionManager::~PeerConnectionManager ( )
virtual

Member Function Documentation

◆ AddIceCandidate()

const Json::Value open3d::visualization::webrtc_server::PeerConnectionManager::AddIceCandidate ( const std::string &  peerid,
const Json::Value &  json_message 
)

◆ AddStreams()

bool open3d::visualization::webrtc_server::PeerConnectionManager::AddStreams ( webrtc::PeerConnectionInterface *  peer_connection,
const std::string &  window_uid,
const std::string &  options 
)
protected

◆ Call()

const Json::Value open3d::visualization::webrtc_server::PeerConnectionManager::Call ( const std::string &  peerid,
const std::string &  window_uid,
const std::string &  options,
const Json::Value &  json_message 
)

◆ CloseWindowConnections()

void open3d::visualization::webrtc_server::PeerConnectionManager::CloseWindowConnections ( const std::string &  window_uid)

◆ CreatePeerConnection()

PeerConnectionManager::PeerConnectionObserver * open3d::visualization::webrtc_server::PeerConnectionManager::CreatePeerConnection ( const std::string &  peerid)
protected

◆ CreateVideoSource()

rtc::scoped_refptr< BitmapTrackSourceInterface > open3d::visualization::webrtc_server::PeerConnectionManager::CreateVideoSource ( const std::string &  window_uid,
const std::map< std::string, std::string > &  opts 
)
protected

◆ GetHttpApi()

const std::map< std::string, HttpServerRequestHandler::HttpFunction > open3d::visualization::webrtc_server::PeerConnectionManager::GetHttpApi ( )

◆ GetIceCandidateList()

const Json::Value open3d::visualization::webrtc_server::PeerConnectionManager::GetIceCandidateList ( const std::string &  peerid)

◆ GetIceServers()

const Json::Value open3d::visualization::webrtc_server::PeerConnectionManager::GetIceServers ( )

◆ GetMediaList()

const Json::Value open3d::visualization::webrtc_server::PeerConnectionManager::GetMediaList ( )

◆ GetPeerConnection()

rtc::scoped_refptr< webrtc::PeerConnectionInterface > open3d::visualization::webrtc_server::PeerConnectionManager::GetPeerConnection ( const std::string &  peerid)
protected

◆ GetVideoTrackSource()

rtc::scoped_refptr< BitmapTrackSourceInterface > open3d::visualization::webrtc_server::PeerConnectionManager::GetVideoTrackSource ( const std::string &  window_uid)
protected

◆ HangUp()

const Json::Value open3d::visualization::webrtc_server::PeerConnectionManager::HangUp ( const std::string &  peerid)

◆ InitializePeerConnection()

bool open3d::visualization::webrtc_server::PeerConnectionManager::InitializePeerConnection ( )

◆ OnFrame()

void open3d::visualization::webrtc_server::PeerConnectionManager::OnFrame ( const std::string &  window_uid,
const std::shared_ptr< core::Tensor > &  im 
)

◆ SendInitFramesToPeer()

void open3d::visualization::webrtc_server::PeerConnectionManager::SendInitFramesToPeer ( const std::string &  peerid)

◆ WindowStillUsed()

bool open3d::visualization::webrtc_server::PeerConnectionManager::WindowStillUsed ( const std::string &  window_uid)
protected

Field Documentation

◆ config_

const Json::Value open3d::visualization::webrtc_server::PeerConnectionManager::config_
protected

◆ func_

std::map<std::string, HttpServerRequestHandler::HttpFunction> open3d::visualization::webrtc_server::PeerConnectionManager::func_
protected

◆ ice_server_list_

std::list<std::string> open3d::visualization::webrtc_server::PeerConnectionManager::ice_server_list_
protected

◆ peer_connection_factory_

rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> open3d::visualization::webrtc_server::PeerConnectionManager::peer_connection_factory_
protected

◆ peerid_data_channel_mutex_

std::mutex open3d::visualization::webrtc_server::PeerConnectionManager::peerid_data_channel_mutex_
protected

◆ peerid_data_channel_ready_

std::unordered_set<std::string> open3d::visualization::webrtc_server::PeerConnectionManager::peerid_data_channel_ready_
protected

◆ peerid_to_connection_

std::unordered_map<std::string, PeerConnectionObserver*> open3d::visualization::webrtc_server::PeerConnectionManager::peerid_to_connection_
protected

◆ peerid_to_connection_mutex_

std::mutex open3d::visualization::webrtc_server::PeerConnectionManager::peerid_to_connection_mutex_
protected

◆ peerid_to_window_uid_

std::unordered_map<std::string, std::string> open3d::visualization::webrtc_server::PeerConnectionManager::peerid_to_window_uid_
protected

◆ publish_filter_

const std::regex open3d::visualization::webrtc_server::PeerConnectionManager::publish_filter_
protected

◆ task_queue_factory_

std::unique_ptr<webrtc::TaskQueueFactory> open3d::visualization::webrtc_server::PeerConnectionManager::task_queue_factory_
protected

◆ webrtc_port_range_

std::string open3d::visualization::webrtc_server::PeerConnectionManager::webrtc_port_range_
protected

◆ window_uid_to_peerids_

std::unordered_map<std::string, std::set<std::string> > open3d::visualization::webrtc_server::PeerConnectionManager::window_uid_to_peerids_
protected

◆ window_uid_to_peerids_mutex_

std::mutex open3d::visualization::webrtc_server::PeerConnectionManager::window_uid_to_peerids_mutex_
protected

◆ window_uid_to_track_source_

std::unordered_map<std::string, rtc::scoped_refptr<BitmapTrackSourceInterface> > open3d::visualization::webrtc_server::PeerConnectionManager::window_uid_to_track_source_
protected

◆ window_uid_to_track_source_mutex_

std::mutex open3d::visualization::webrtc_server::PeerConnectionManager::window_uid_to_track_source_mutex_
protected

The documentation for this class was generated from the following files: