Intel® Collaboration Suite for WebRTC  version 4.3.1
Open WebRTC Toolkit (OWT) Client SDK for Windows*
owt::base::LocalStream Class Reference

This class represents a local stream. More...

#include <owt/base/stream.h>

Inheritance diagram for owt::base::LocalStream:
Collaboration diagram for owt::base::LocalStream:

Public Member Functions

virtual void Attributes (const std::unordered_map< std::string, std::string > &attributes)
 Set a user-defined attribute map. More...
 
void Close ()
 Close a local stream. More...
 
virtual const std::unordered_map< std::string, std::string > Attributes () const
 Returns a user-defined attribute map. More...
 
- Public Member Functions inherited from owt::base::Stream
 Stream (MediaStreamInterface *media_stream, StreamSourceInfo source)
 
virtual std::string Id () const
 Get the ID of the stream. More...
 
virtual void DisableAudio ()
 Disable all audio tracks of the stream.
 
virtual void DisableVideo ()
 Disable all video tracks of the stream.
 
virtual void EnableAudio ()
 Enable all audio tracks of the stream.
 
virtual void EnableVideo ()
 Enable all video tracks of the stream.
 
virtual const std::unordered_map< std::string, std::string > Attributes () const
 Returns a user-defined attribute map. More...
 
virtual StreamSourceInfo Source () const
 Returns the audio/video source info of the stream. More...
 
virtual void AttachVideoRenderer (VideoRendererInterface &renderer)
 
virtual void AttachVideoRenderer (VideoRenderWindow &render_window)
 
virtual void AttachAudioPlayer (AudioPlayerInterface &player)
 
virtual void DetachVideoRenderer ()
 Detach the stream from its renderer.
 
virtual void DetachAudioPlayer ()
 Detach the stream from the audio player.
 
void AddObserver (StreamObserver &observer)
 Register an observer on the stream.
 
void RemoveObserver (StreamObserver &observer)
 De-Register an observer on the stream.
 

Static Public Member Functions

static std::shared_ptr< LocalStreamCreate (const LocalCameraStreamParameters &parameters, int &error_code)
 Create a local camera stream. This creates a local camera stream with specified device settings. More...
 
static std::shared_ptr< LocalStreamCreate (const bool is_audio_enabled, webrtc::VideoTrackSourceInterface *video_source, int &error_code)
 Create a local camera stream with video track source. This creates a local camera stream with specified video track source. More...
 
static std::shared_ptr< LocalStreamCreate (std::shared_ptr< LocalCustomizedStreamParameters > parameters, std::unique_ptr< VideoFrameGeneratorInterface > framer)
 Initialize a LocalCustomizedStream with parameters and frame generator. More...
 
static std::shared_ptr< LocalStreamCreate (std::shared_ptr< LocalCustomizedStreamParameters > parameters, VideoEncoderInterface *encoder)
 
static std::shared_ptr< LocalStreamCreate (std::shared_ptr< LocalDesktopStreamParameters > parameters, std::unique_ptr< LocalScreenStreamObserver > observer)
 Initialize a local screen stream with parameters. More...
 

Detailed Description

This class represents a local stream.

A local stream can be published to remote side.

Member Function Documentation

◆ Attributes() [1/2]

virtual const std::unordered_map<std::string, std::string> owt::base::Stream::Attributes
inline

Returns a user-defined attribute map.

These attributes are defined by publisher. P2P mode always return empty map because it is not supported yet.

◆ Attributes() [2/2]

virtual void owt::base::LocalStream::Attributes ( const std::unordered_map< std::string, std::string > &  attributes)
inlinevirtual

Set a user-defined attribute map.

Remote user can get attribute map by calling Attributes(). P2P mode does not support setting attributes.

◆ Close()

void owt::base::LocalStream::Close ( )

Close a local stream.

This will remote all tracks on the stream, and detach any sink previously attached.

◆ Create() [1/5]

static std::shared_ptr<LocalStream> owt::base::LocalStream::Create ( const LocalCameraStreamParameters parameters,
int &  error_code 
)
static

Create a local camera stream. This creates a local camera stream with specified device settings.

Parameters
parametersLocal camera stream settings for stream creation.
error_codeError code will be set if creation fails.
Returns
Pointer to created LocalStream.

◆ Create() [2/5]

static std::shared_ptr<LocalStream> owt::base::LocalStream::Create ( const bool  is_audio_enabled,
webrtc::VideoTrackSourceInterface *  video_source,
int &  error_code 
)
static

Create a local camera stream with video track source. This creates a local camera stream with specified video track source.

Parameters
is_audio_enabledIf audio is enabled in the stream.
video_sourcePointer to VideoTrackSourceInterface used for stream creation.
error_codeError code will be set if creation fails.
Returns
Pointer to created LocalStream.

◆ Create() [3/5]

static std::shared_ptr<LocalStream> owt::base::LocalStream::Create ( std::shared_ptr< LocalCustomizedStreamParameters parameters,
std::unique_ptr< VideoFrameGeneratorInterface framer 
)
static

Initialize a LocalCustomizedStream with parameters and frame generator.

The input of the video stream MUST be YUV frame if initializing with frame generator.

Parameters
parametersParameters for creating the stream. The stream will not be impacted if changing parameters after it is created.
framerPointer to an instance implemented VideoFrameGeneratorInterface. This instance will be destroyed by SDK when stream is closed.
Returns
Pointer to created LocalStream.

◆ Create() [4/5]

static std::shared_ptr<LocalStream> owt::base::LocalStream::Create ( std::shared_ptr< LocalCustomizedStreamParameters parameters,
VideoEncoderInterface encoder 
)
static

a local customized stream with parameters and encoder interface.

The input of the video stream MUST be encoded frame if initializing with video encoder interface.

Parameters
parametersParameters for creating the stream. The stream will not be impacted if changing parameters after it is created.
encoderPointer to an instance implementing VideoEncoderInterface.
Returns
Pointer to created LocalStream.

◆ Create() [5/5]

static std::shared_ptr<LocalStream> owt::base::LocalStream::Create ( std::shared_ptr< LocalDesktopStreamParameters parameters,
std::unique_ptr< LocalScreenStreamObserver observer 
)
static

Initialize a local screen stream with parameters.

Parameters
parametersParameters for creating the stream. The stream will not be impacted if changing parameters after it is created.
observerSource callback required for application to specify capture window/screen source.
Returns
Pointer to created LocalStream.