3.5. Proximie::PxMedia reference

namespace PxMedia

The PxMedia namespace implements the core media streaming functionality provided the SDK. This includes audio and video feeds being between the host applications and other participants in a media session.

Typedefs

using AudioInputFeedComponents = std::vector<std::reference_wrapper<AudioInputFeedComponent>>

A sequence of audio input feed components, as a vector of references.

using PxMediaError = PxUtility::ErrorCodeException<PxMediaErrorCategory>

Exception class for PxMediaError errors

using StreamIndexHint = uint16_t

A preferred stream index for presentation in applications.

The index hint is intended to allow a sending application to suggest placement or priority of a given stream. For example, in Proximie’s webapp, the four panes for videos are assigned an index and clients can suggest which pane to use. This is a hint only, since different participants may try to suggest the same index without being aware of each other.

Enums

enum class AVContainer

The container format for the output file.

Values:

enumerator MP4
enumerator MKV
enumerator AVI
enumerator FLV
enum class AudioCodec

The audio codec to use for the output file.

Values:

enumerator AAC
enumerator MP3
enumerator OPUS
enumerator VORBIS
enum class VideoCodec

The video codec to use for the output file.

Values:

enumerator H264
enumerator H265
enumerator VP8
enumerator VP9
enumerator AV1
enum class ConnectionState

Enumeration for a connection state.

Values:

enumerator READY
enumerator CONNECTING

No connection, ready to connect

enumerator CONNECTED

In the process of connecting

enumerator DISCONNECTING

Connected and active

enum class PxMediaErrorCode

Custom error codes for PxMedia operations, namely Media Server functions.

Values:

enumerator Successful

Success (not an error)

enumerator StreamIdNotFound

The stream ID supplied was not known/found.

enumerator InvalidStreamId

The stream ID supplied is not valid.

enumerator NotConnected

The session/media server has not connected yet.

enumerator SessionActive

The session is already active.

enumerator NoSession

There is no active session.

enumerator InvalidSession

The session requested is invalid.

enumerator SessionNotActive

The session requested is valid, but not active.

enumerator SessionCreateFailed

Session creation failed.

enumerator SessionFeedNotFound

The feed did not belong to the session.

enumerator SessionFeedExists

The feed already exists in the session.

enumerator SessionDisconnected

The session was unexpectedly disconnected.

enumerator PluginAttachFailed

Media server could not connect to the plugin.

enumerator PluginConnectionActive

Connection is already active.

enumerator PluginConnectionClosed

Connection is closed.

enumerator CreateMediaRoomFailed

The media room could not be created.

enumerator JoinMediaRoomFailed

The media room could not be joined.

enumerator WebRtcAnswerFailed

WebRTC answer failed.

enumerator WebRtcOfferFailed

WebRTC offer failed.

enumerator MediaRoomStartFailed

Stream failed to start in the media room.

enumerator MediaRoomConfigureFailed

Stream failed configuring for the media room.

enumerator WebRtcCandidateFailed

WebRTC trickle candidate failed.

enumerator MediaDeviceMetadataInvalid

Media stream metadata was invalid.

enumerator WebSocketError

WebSocket error.

enumerator MediaServerHangup

Received a media server hangup event.

enumerator MediaServerHangupClosePC

Received a close peer connection hangup.

enumerator NoPipeline

Pipeline elements have not be built/set.

enumerator PipelineIsStopped

Pipeline is stopped (error, manually, …)

enumerator PipelineStreamError

Pipeline stream error.

enumerator KeepaliveTimeout

No keepalive answer within expected timeout.

enumerator ExpectedAck

Expected ack, but received another type.

enumerator InvalidResponseContent

The response JSON’s content was incorrect.

enumerator InvalidPeerChannel

The requested channel is invalid.

enumerator InvalidEncryptionKey

The encryption key is invalid.

enumerator InvalidAdaptiveRule

The adaptive rule is invalid.

Functions

inline error_code make_error_code(const PxMediaErrorCode code)

Provides support to make an error_code for the PxMediaErrorCode type.

inline error_condition make_error_condition(const PxMediaErrorCode code)

Provides support to make an error_condition for the PxMediaErrorCode type.

template<typename T>
class AdaptiveBandsRule : public Proximie::PxMedia::AdaptiveRule<T>
#include <PxMedia/AdaptiveBandsRule.h>

An adaptive rule that takes a number of bands matching a quality range to a target value of the templated type.

Public Types

using Bands = std::vector<Band>

A vector of bands to choose between.

The bands are ordered, where the first band is the value to apply as the lowest quality band, and the band size is indicated by the weight. The bands are normalised so the bands will always encapsulate the full 0..1 quality range to apply.

Public Functions

AdaptiveBandsRule() = default

Construct an empty adaptive bands rule.

inline outcome::result<void> bands(const Bands &bands)

Set the bands for the rule.

inline virtual boost::optional<T> valueForQuality(AdaptiveQuality quality) const override

Given a quality, set the target value to the outcome.

The return value is optional, allowing the rule to return nothing to indicate no change.

Public Static Functions

static inline std::shared_ptr<AdaptiveBandsRule<T>> create()

Factory function to create an empty adaptive bands rule.

static inline SharedOutcome<AdaptiveBandsRule<T>> create(const Bands &bands)

Factory function to create an instance of the rule as a shared pointer. The caller provides a defined number of bands to interpolate between.

The function validates the bands are valid, and thus returns an error outcome if they are not.

struct Band
#include <PxMedia/AdaptiveBandsRule.h>

The definition of a band in the adaptive rule.

A band is a (non-negative) weight and a value. For convenience, the caller can use any scale of weight values, and these are normalized for choosing a band for a 0..1 quality.

Public Members

double weight

The (non-negative) weight of the band.

T value

When the band is matched, the value is applied.

template<typename T>
class AdaptiveMinMaxRule : public Proximie::PxMedia::AdaptiveRule<T>
#include <PxMedia/AdaptiveMinMaxRule.h>

General adaptive rule which interpolates between a minimum and maximum value of the templated type.

The type must have a lerp function defined for it.

Public Functions

inline AdaptiveMinMaxRule(T min, T max)

Construct a min/max rule, providing a defined minimum and maximum value to lerp with.

inline AdaptiveMinMaxRule &minimum(T min)

Set the minimum value

inline const T &minimum() const

Get the minimum value

inline AdaptiveMinMaxRule &maximum(T max)

Set the maximum value

inline const T &maximum() const

Get the maximum value

inline virtual boost::optional<T> valueForQuality(AdaptiveQuality quality) const override

Given a quality, set the target value to the outcome.

The return value is optional, allowing the rule to return nothing to indicate no change.

Public Static Functions

static inline std::shared_ptr<AdaptiveMinMaxRule<T>> create(const T &minValue, const T &maxValue)

Factory function to create an instance of the rule as a shared pointer. The caller provides a defined minimum and maximum value to lerp with.

class AdaptiveQuality
#include <PxMedia/AdaptiveQuality.h>

Adaptive feed quality is a floating point value in the range 0..1

Public Types

using QualityValueType = double

The underlying floating point value type for quality

Public Functions

AdaptiveQuality() = default

Feed quality constructor sets the quality to 1

inline AdaptiveQuality(QualityValueType quality)

Feed qualities can be inferred from a floating point value

inline bool isMaxQuality() const

Test if at maximum quality

inline QualityValueType value(QualityValueType set)

Set a feed quality.

The value is truncated to the range 0..1

inline QualityValueType value() const

Obtain the feed quality level

Friends

inline friend bool operator==(const AdaptiveQuality &lhs, const AdaptiveQuality &rhs)

Equality comparison

inline friend bool operator!=(const AdaptiveQuality &lhs, const AdaptiveQuality &rhs)

Inequality comparison

template<typename T>
class AdaptiveRule
#include <PxMedia/AdaptiveRule.h>

Definition for a rule which takes an adaptive quality value and gives back an outcome value.

Subclassed by Proximie::PxMedia::AdaptiveBandsRule< T >, Proximie::PxMedia::AdaptiveMinMaxRule< T >

Public Types

using ValueType = T

Type alias for the value type that the rule returns.

Public Functions

virtual boost::optional<T> valueForQuality(AdaptiveQuality quality) const = 0

Given a quality, set the target value to the outcome.

The return value is optional, allowing the rule to return nothing to indicate no change.

virtual ~AdaptiveRule() = default

Virtual destructor, always subclassed.

class AudioInputFeedAuto : public Proximie::PxMedia::AudioInputFeedComponent
#include <PxMedia/AudioInputFeedAuto.h>

An audio input component that chooses an appropriate audio source to use.

This feed component can be used to simply add an audio input without the application needing to provide device details itself.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class AudioInputFeedTestSignal : public Proximie::PxMedia::AudioInputFeedComponent
#include <PxMedia/AudioInputFeedTestSignal.h>

An audio input feed component that simply sends a regular beat as an audio signal.

This component can be used to use test audio without a physical device. This can be useful when testing to avoid acoustic feedback loops when testing.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class AudioOutputFeedAuto : public Proximie::PxMedia::AudioOutputFeedComponent
#include <PxMedia/AudioOutputFeedAuto.h>

An audio input component that chooses an appropriate audio output to use.

This feed component can be used to simply add a suitable audio output without the application needing to provide device details itself.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class AudioOutputFeedWavescope : public Proximie::PxMedia::AudioOutputFeedComponent
#include <PxMedia/AudioOutputFeedWavescope.h>

An audio output feed component that displays the audio input as a simple waveform in a window.

This component can be used to use test audio without a physical output device such as a speaker. This can be useful when testing to avoid acoustic feedback loops when testing.

This component automatically opens a window to output the waveform. The ability to specify an output target/window will be added in a subsequent SDK release.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class AudioPeerRtpDecodeFeedOpus : public Proximie::PxMedia::AudioPeerRtpDecodeFeedComponent
#include <PxMedia/AudioPeerRtpDecodeFeedOpus.h>

A audio feed component for specifying Opus decoding for SRTP.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

struct Properties
#include <PxMedia/AudioPeerRtpDecodeFeedOpus.h>

The properties required to decode the audio feed for SRTP using Opus. No properties are currently supported.

class AudioPeerRtpEncodeFeedOpus : public Proximie::PxMedia::AudioPeerRtpEncodeFeedComponent
#include <PxMedia/AudioPeerRtpEncodeFeedOpus.h>

A audio feed component for specifying Opus encoding for SRTP.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

struct Properties
#include <PxMedia/AudioPeerRtpEncodeFeedOpus.h>

The properties required to encode the audio feed for SRTP using Opus.

class AudioWebRtcEncodeFeedOpus : public Proximie::PxMedia::AudioWebRtcEncodeFeedComponent
#include <PxMedia/AudioWebRtcEncodeFeedOpus.h>

An audio feed component for specifying audio encoding using Opus.

The Opus encoder component uses fixed settings at this stage. In a later SDK update the component will expose settings that the application can set itself.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class AVOutputFeedFile : public Proximie::PxMedia::FeedBase
#include <PxMedia/AVOutputFeedFile.h>

An output feed component that writes video (and optionally audio) to given local file(s).

This feed component provides properties to specify how the feed is encoded and saved to a file.

Additional features that this type of feed supports

void onFeedFileFinished(const std::function<void(const shared_not_null<AVOutputFeedFile>&, string_view path)> &func)

Notify that a feed file has finished and can be read/used.

void fileOutputLocationHandler(const OnFormatLocationHandler &handler)

Override default file naming behaviour Important note: This function is called during the file recording and streaming process. The provided handler should return a value promptly and not block processing unduly.

Public Types

using FeedProperties = FeedBase::FeedBaseProperties

Properties that apply to the whole feed.

using OnFormatLocationHandler = std::function<std::string(guint seq)>

Callback for overriding file output location.

Public Static Functions

static NotNullOutcome<AVOutputFeedFile> create(const shared_not_null<PxCore::ProximieContext> &context, const FeedProperties &props, const AVOutputFeedFileSettings &settings, const VideoInputFeedComponent &input, const std::vector<shared_not_null<PxMedia::AudioInputFeedComponent>> &audioInputs = {})

Factory method to create a recording feed that takes a video input, zero or more audio inputs, and writes it to disk.

struct AVOutputFeedFileSettings
#include <PxMedia/AVOutputFeedFile.h>

Settings for the AVOutputFeedFile.

Public Members

std::string destinationDirectory

The directory to save the output files to.

std::string destinationFilenamePattern = {"video%02d.mp4"}

A printf-compatible pattern to use for generating output file names.

PxMedia::VideoCodec videoCodec = PxMedia::VideoCodec::H264

The video codec to use; note that only h.264 is supported at this time

PxMedia::AudioCodec audioCodec = PxMedia::AudioCodec::AAC

The audio codec to use; note that only AAC is supported at this time.

PxMedia::AVContainer avContainer = PxMedia::AVContainer::MP4

The container format to use; note that only MP4 is supported at this time

uint32_t maxFiles = {0}

The maximum number of files to create.

uint64_t maxFileSizeMB = {0}

The maximum size of a file in MB.

uint64_t maxFileDurationS = {0}

The maximum duration of a file in seconds.

class BitRate
#include <PxMedia/BitRate.h>

Encapsulates a bit rate value with varying units of bits (bits, kbits, etc.) per second.

BitRate defines some convenient literals for creating bit rate values.

Enable the literals by including the following:

using namespace Proximie::PxMedia::Literals;

Then, you can create bit rate values using the following:

constexpr auto H264_BITRATE = 2000_kbps;

The following literals are supported: bps, kbps, mbps, gbps.

Creation

Also see the main BitRate description for details on how to use bit rate literals.

constexpr BitRate() = default

Default construction is a zero bit rate

inline BitRate(ValueType value, UnitType unit)

Construct with value and unit type as a parameter.

template<UnitType U>
static inline constexpr BitRate make(ValueType value)

Make a constexpr BitRate, with a value of a given unit as the template.

Get bit rate values

inline ValueType bitsPerSecond() const

Bit rate in bits per second

ValueType bitRateWithUnits(UnitType unit, ScaleMethod rounding, ValueType *remainder = nullptr) const

Scales the bit rate to the specified unit.

When scaling a bit rate to a larger unit without floating point, there is the possibility of rounding being needed. This function allows the caller to specify how rounding should be performed, including how to handle non-zero bit rates that would otherwise be rounded to a zero value.

Parameters:
  • unit[in] The units to convert the bitrate value to

  • rounding[in] How to round the value when converting

  • remainder[out] Optionally output the remainder in bits

Returns:

The bit rate converted to the requested units

inline double decimalBitRateWithUnits(UnitType unit) const

Scaled bit rate to a given unit type, as a decimal value.

Comparison & testing of the bit rate value

inline bool isZero() const

Test if the bitrate value is zero

inline bool operator==(const BitRate &rhs) const

Equality with another BitRate

inline bool operator!=(const BitRate &rhs) const

Inequality

inline bool operator<(const BitRate &rhs) const

Less than

inline bool operator<=(const BitRate &rhs) const

Less than or equal to

inline bool operator>(const BitRate &rhs) const

Greater than

inline bool operator>=(const BitRate &rhs) const

Greater than or equal to

Public Types

enum class UnitType

Units of bits per second

Values:

enumerator Bits
enumerator KBits
enumerator MBits
enumerator GBits
enum class ScaleMethod

How to round when scaling to a specified unit

Values:

enumerator Nearest

Round to the nearest unit.

enumerator Down

Round down to the nearest unit.

enumerator Up

Round up to the nearest unit.

enumerator DownNotZero

Round down, but only to when already zero.

enumerator NearestNotZero

Round nearest, but only to when already zero.

using ValueType = std::int64_t

A number of bits

class Configuration
#include <PxMedia/Configuration.h>

Singleton for configuring PxMedia module settings.

Use the Configuration::get() method to access the singleton instance, and then chain setter methods to configure the settings.

Configuration settings

Accessors to get & set configuration settings. Note that setter methods typically return the configuration instance to allow chaining. However, where setters have error return, these are not chainable.

Configuration &gstreamerDebugLevel(GstDebugLevel level)

Set the GStreamer debugging level.

Note that the debug level is the GStreamer library debug level type GstDebugLevel, not the Proximie SDK logging severity level.

The SDK does not set/override any GStreamer debugging level itself, only when the application itself calls this function.

GstDebugLevel gstreamerDebugLevel() const

Returns the current GStreamer debug level

Configuration &gstreamerLogTarget(GStreamerLogger target)

Set the target for GStreamer log output.

When using the Proximie SDK logger target, GStreamer debug levels are translated to the corresponding SDK logger severity levels.

inline GStreamerLogger gstreamerLogTarget() const

Returns the current GStreamer target

Public Types

enum class GStreamerLogger

Enumeration to specify where GStreamer output is targeted

Values:

enumerator CONSOLE

Output to console (default)

enumerator PXLOGGER

Direct output to the Proximie SDK logger.

using fspath = boost::filesystem::path

Alias for the filesystem path type.

Public Functions

outcome::result<void> diagnosticsFolder(const fspath &folder)

Set the diagnostics folder for PxMedia.

Returns an error if the path is not an existing directory

Configuration &diagnosticsFolderOrThrow(const fspath &folder)

Set the diagnostics folder for PxMedia.

Throws an error if the path is not an existing directory

outcome::result<fspath> diagnosticsFolder() const

Returns the diagnostics folder for PxMedia.

If no folder has been set, the configuration will default to the system temp folder. If the folder (set or defaulted) does not exist, an error will be returned.

Public Static Functions

static Configuration &get()

Access the configuration singleton

class VideoInputFeedComponent : public Proximie::PxMedia::FeedComponent<VideoInputFeedComponentProvider>
#include <PxMedia/feed-components.h>

Base class for video input feed components.

Subclassed by Proximie::PxMedia::VideoFormattedInputFeedComponent, Proximie::PxMedia::VideoInputFeedUdp

Public Functions

inline VideoFeedStageSequence &videoStages()

Obtain the video feed stage sequence object, which can be used to set additional video processing stages for the component.

inline const VideoFeedStageSequence &videoStages() const

Read-only access to the video feed stage sequence.

class VideoFormattedInputFeedComponent : public Proximie::PxMedia::VideoInputFeedComponent
#include <PxMedia/feed-components.h>

Base class for video formatted input feed components.

Subclassed by Proximie::PxMedia::VideoInputFeedTestPattern, Proximie::PxMedia::VideoInputFeedV4Linux2, Proximie::PxMedia::VideoInputFeedXImage

Public Functions

inline VideoCapabilities &videoCapabilities()

Obtain video capabilities object, which can be used to set video capabilities settings for the component.

inline const VideoCapabilities &videoCapabilities() const

Read-only access to the video capabilities.

class VideoWebRtcEncodeFeedComponent : public Proximie::PxMedia::FeedComponent<VideoWebRtcEncodeFeedComponentProvider>
#include <PxMedia/feed-components.h>

Base class for video WebRTC encoder feed components.

Subclassed by Proximie::PxMedia::VideoWebRtcEncodeFeedH264, Proximie::PxMedia::VideoWebRtcEncodeFeedVp8

class VideoPeerRtpEncodeFeedComponent : public Proximie::PxMedia::FeedComponent<VideoPeerRtpEncodeFeedComponentProvider>
#include <PxMedia/feed-components.h>

Class for video Peer encoder feed components.

class VideoPeerRtpDecodeFeedComponent : public Proximie::PxMedia::FeedComponent<VideoPeerRtpDecodeFeedComponentProvider>
#include <PxMedia/feed-components.h>

Class for video Peer decoder feed components.

class PeerSrtpEncryptFeedComponent : public Proximie::PxMedia::FeedComponent<PeerSrtpEncryptFeedComponentProvider>
#include <PxMedia/feed-components.h>

Class for SRTP-based peer feed encryption components.

class PeerSrtpDecryptFeedComponent : public Proximie::PxMedia::FeedComponent<PeerSrtpDecryptFeedComponentProvider>
#include <PxMedia/feed-components.h>

Class for SRTP-based peer feed decryption components.

class PeerSrtSinkFeedComponent : public Proximie::PxMedia::FeedComponent<PeerSrtSinkFeedComponentProvider>
#include <PxMedia/feed-components.h>

Class for SRT-based peer feed encryption and transmission components.

class PeerSrtSourceFeedComponent : public Proximie::PxMedia::FeedComponent<PeerSrtSourceFeedComponentProvider>
#include <PxMedia/feed-components.h>

Class for SRT-based peer feed receipt and decryption components.

class PeerUdpSinkFeedComponent : public Proximie::PxMedia::FeedComponent<PeerUdpSinkFeedComponentProvider>
#include <PxMedia/feed-components.h>

Class for Peer feed Udp Sink component.

class PeerUdpSourceFeedComponent : public Proximie::PxMedia::FeedComponent<PeerUdpSourceFeedComponentProvider>
#include <PxMedia/feed-components.h>

Class for Peer feed Udp Source component.

class VideoOutputFeedComponent : public Proximie::PxMedia::FeedComponent<VideoOutputFeedComponentProvider>
#include <PxMedia/feed-components.h>

Base class for video output feed components.

Subclassed by Proximie::PxMedia::VideoOutputFeedAuto, Proximie::PxMedia::VideoOutputFeedFake, Proximie::PxMedia::VideoOutputFeedUdp

class AudioInputFeedComponent : public Proximie::PxMedia::FeedComponent<AudioInputFeedComponentProvider>
#include <PxMedia/feed-components.h>

Base class for audio input feed components.

Subclassed by Proximie::PxMedia::AudioInputFeedAuto, Proximie::PxMedia::AudioInputFeedTestSignal

class AudioWebRtcEncodeFeedComponent : public Proximie::PxMedia::FeedComponent<AudioWebRtcEncodeFeedComponentProvider>
#include <PxMedia/feed-components.h>

Base class for audio WebRTC encoder feed components.

Subclassed by Proximie::PxMedia::AudioWebRtcEncodeFeedOpus

class AudioPeerRtpEncodeFeedComponent : public Proximie::PxMedia::FeedComponent<AudioPeerRtpEncodeFeedComponentProvider>
#include <PxMedia/feed-components.h>

Base class for audio peer encoder feed components.

Subclassed by Proximie::PxMedia::AudioPeerRtpEncodeFeedOpus

class AudioPeerRtpDecodeFeedComponent : public Proximie::PxMedia::FeedComponent<AudioPeerRtpDecodeFeedComponentProvider>
#include <PxMedia/feed-components.h>

Base class for audio peer decoder feed components.

Subclassed by Proximie::PxMedia::AudioPeerRtpDecodeFeedOpus

class AudioOutputFeedComponent : public Proximie::PxMedia::FeedComponent<AudioOutputFeedComponentProvider>
#include <PxMedia/feed-components.h>

Base class for audio output feed components.

Subclassed by Proximie::PxMedia::AudioOutputFeedAuto, Proximie::PxMedia::AudioOutputFeedWavescope

class FeedBase : public Proximie::PxMedia::IFeedFeature, public std::enable_shared_from_this<FeedBase>
#include <PxMedia/FeedBase.h>

Base feed object that all feed objects inherit from.

Subclassed by Proximie::PxMedia::AVOutputFeedFile, Proximie::PxMedia::MediaServerFeed, Proximie::PxMedia::PeerFeed, Proximie::PxMedia::UtilityAudioMixerFeed, Proximie::PxMedia::UtilityVideoLocalFeed

Feed object interface

template<typename T>
inline bool is() const

Helper to test if a feed is a given derived type.

template<typename T>
inline std::shared_ptr<T> as()

Helper to cast a feed to a given derived type Returns nullptr if the feed is not of the given type

Public Functions

inline virtual std::string streamId() const override

The unique stream ID for the feed

inline virtual std::string label() const override

The human-readable label for the feed

inline virtual outcome::result<void> startFeed() override

Start the feed playing.

No effect if the feed is already playing

inline virtual outcome::result<void> stopFeed() override

Stop the feed playing.

No effect if the feed is not already playing

inline virtual void onFeedStarted(const std::function<void(const shared_not_null<FeedBase>&)> &func) override

Notify that a feed has successfully started

inline virtual void onFeedStopped(const std::function<void(const shared_not_null<FeedBase>&, error_code)> &func) override

Notify that a feed has stopped, which may be intentionally or in error

inline outcome::result<std::string> getPipelineGraph() const

Obtain GStreaming pipeline graph for the feed with all details.

Returns:

The graph is returned as a string in the .dot format as an outcome

inline outcome::result<boost::filesystem::path> writePipelineGraphToFile(string_view filename) const

Write a pipeline .dot graph to a file with all details.

The file name may be absolute or relative, if relative it will use the diagnostics folder from the PxMedia::Configuration

Returns:

The path to the file written

inline virtual outcome::result<std::string> getPipelineGraphWithDetails(GstDebugGraphDetails details) const override

Obtain GStreaming pipeline graph for the feed at a given detail level.

Returns:

The graph is returned as a string in the .dot format as an outcome

inline virtual outcome::result<boost::filesystem::path> writePipelineGraphWithDetailsToFile(string_view filename, GstDebugGraphDetails details) const override

Write a pipeline .dot graph to a file at a given detail level.

The file name may be absolute or relative, if relative it will use the diagnostics folder from the PxMedia::Configuration

Returns:

The path to the file written

struct FeedBaseProperties
#include <PxMedia/FeedBase.h>

Properties that apply to the whole feed.

Subclassed by Proximie::PxMedia::MediaServerIncomingVideoFeed::FeedProperties, Proximie::PxMedia::MediaServerOutgoingVideoFeed::FeedProperties, Proximie::PxMedia::PeerFeed::FeedProperties

Public Functions

inline explicit FeedBaseProperties(string_view label = {})

Constructor allowing the label to be set.

Public Members

std::string label

Readable label for the feed.

template<class PROVIDER>
class FeedComponent
#include <PxMedia/FeedComponent.h>

The basic building block and abstract interface of all feed components.

Template Parameters:

PROVIDER – Opaque “provider” class that is used to create/implement a feed instance’s behaviour

Public Types

using Provider = PROVIDER

The provider template type.

Public Functions

virtual shared_not_null<Provider> makeProvider() const = 0

Required override to create a provider for the component

class FeedPacketLossAssessor : public Proximie::PxMedia::FeedPerformanceAssessor
#include <PxMedia/FeedPacketLossAssessor.h>

A feed performance assessment helper that looks at packet loss.

Public Functions

FeedPacketLossAssessor() = default

Create the assessor with default settings

inline explicit FeedPacketLossAssessor(const Settings &settings)

Create the assessor with custom settings

virtual double assessPerformance(const FeedPerformanceStats &details) const override

Given the current stats of a feed, return the delta to apply to the current quality level.

struct Settings
#include <PxMedia/FeedPacketLossAssessor.h>

Settings for the packet loss assessment instances

Public Functions

Settings()

Construct settings with reasonable default values

Public Members

double lowPacketLossRatioThreshold

The low threshold indicates the point where quality should be reduced to improve the packet loss to an acceptable level. Below this threshold, the quality may be improved.

double severePacketLossRatioThreshold

The severe threshold indicates the point where quality should be reduced more aggressively.

double qualityImproveDelta

When the packet loss ratio is below the low threshold, the quality will be improved by this delta.

double qualityReduceGentleDelta

When the packet loss ratio is moderate, the quality will be reduced by this “gentle” delta.

double qualityReduceSevereDelta

When the packet loss ratio is severe, the quality will be reduced by this “severe” delta.

class FeedPerformanceAssessor
#include <PxMedia/FeedPerformanceAssessor.h>

A rule for assessing performance and quality

Subclassed by Proximie::PxMedia::FeedPacketLossAssessor

Public Functions

virtual ~FeedPerformanceAssessor() = default

Virtual destructor as this class is overrideable

virtual double assessPerformance(const FeedPerformanceStats &details) const = 0

Given the current stats of a feed, return the delta to apply to the current quality level.

struct FeedPerformanceStats
#include <PxMedia/FeedPerformanceAssessor.h>

Information shared with the monitor for each feed being monitored

Public Functions

inline explicit FeedPerformanceStats(const shared_not_null<MediaServerOutgoingVideoFeed> &feed)

Create a stats struct with a non-null feed reference

Public Members

shared_not_null<MediaServerOutgoingVideoFeed> feed

The feed being assessed

AdaptiveQuality currentQuality

The current quality setting that was set for the feed

WebRtcStats webRtcStats

WebRTC statistics collected from the feed

double packetLossRatio = 0

Packet loss ratio from the current statistics

boost::optional<double> packetLossRatioAverage

When available, the (moving) average packet loss calculated from recent assessments

class FeedQualityMonitor
#include <PxMedia/FeedQualityMonitor.h>

A class that checks the performance of a set of adaptive feeds, and applies quality requests to adapt their performance accordingly.

Public Functions

explicit FeedQualityMonitor(std::unique_ptr<FeedPerformanceAssessor> assessor)

Construct a new FeedQualityMonitor object, providing a performance assessment handler.

After creation, the caller can add feeds and start the monitor.

bool isRunning() const

Returns whether the monitor is currently running.

void start(std::chrono::milliseconds interval)

Start the feed quality monitor with the given interval.

If the monitor is already running, it will reset with the given new timing internal.

void stop()

Stop the feed quality monitor. If the monitor is not running, this is a no-op.

bool isFeedRegistered(const shared_not_null<MediaServerOutgoingVideoFeed> &feed) const

Check if a feed is being monitored already.

void registerFeed(const shared_not_null<MediaServerOutgoingVideoFeed> &feed)

Register a feed to be monitored. Ignored if the feed is already registered.

void unregisterFeed(const shared_not_null<MediaServerOutgoingVideoFeed> &feed)

Unregister a feed from being monitored. Ignored if the feed is not registered.

void unregisterAllFeeds()

Unregister all currently registered feeds.

class FrameRate
#include <PxMedia/FrameRate.h>

Encapsulates a formal frame rate value.

Creation

inline FrameRate()

Default construction is a zero frame rate

inline FrameRate(FractionInt frameRate)

Construct a frame rate object with a simple frame rate integer (i.e. the denominator defaults to 1).

inline FrameRate(FractionInt numerator, FractionInt denominator)

Construct a frame rate object with numerator/denominator values.

Public Types

using FractionInt = gint

Frame rate fraction numerator/denominator integer type

Public Functions

inline void set(FractionInt frameRate)

Set a frame rate value with a simple frame rate integer (i.e. the denominator defaults to 1).

inline void set(FractionInt numerator, FractionInt denominator)

Set a frame rate value with numerator/denominator values.

inline FractionInt numerator() const

Obtain the frame rate ratio numerator value

inline FractionInt denominator() const

Obtain the frame rate ratio denominator value

inline bool isZero() const

Test if zero numerator (i.e. no frame rate)

inline std::string toFrameRateString() const

Obtain a string/printable version of the frame rate value

inline double toDouble() const

Convert to a double value

inline void fromDouble(double value)

Convert from a double value

Public Static Functions

static inline FrameRate createFromDouble(double value)

Make a frame rate from a double value

class IFeedFeature
#include <PxMedia/IFeedFeature.h>

Base interface common to all feed objects.

Subclassed by Proximie::PxMedia::FeedBase

Public Functions

virtual std::string streamId() const = 0

The unique stream ID for the feed

virtual std::string label() const = 0

The human-readable label for the feed

virtual outcome::result<void> startFeed() = 0

Start the feed playing.

No effect if the feed is already playing

virtual outcome::result<void> stopFeed() = 0

Stop the feed playing.

No effect if the feed is not already playing

virtual outcome::result<std::string> getPipelineGraphWithDetails(GstDebugGraphDetails details) const = 0

Obtain GStreaming pipeline graph for the feed at a given detail level.

Returns:

The graph is returned as a string in the .dot format as an outcome

virtual outcome::result<boost::filesystem::path> writePipelineGraphWithDetailsToFile(string_view filename, GstDebugGraphDetails details) const = 0

Write a pipeline .dot graph to a file at a given detail level.

The file name may be absolute or relative, if relative it will use the diagnostics folder from the PxMedia::Configuration

Returns:

The path to the file written

virtual void onFeedStarted(const std::function<void(const shared_not_null<FeedBase>&)> &func) = 0

Notify that a feed has successfully started

virtual void onFeedStopped(const std::function<void(const shared_not_null<FeedBase>&, error_code)> &func) = 0

Notify that a feed has stopped, which may be intentionally or in error

class IMediaServerFeedFeature
#include <PxMedia/IMediaServerFeedFeature.h>

The interface common to all media server feeds.

Public Types

using FeedStatsCallback = std::function<void(shared_not_null<MediaServerFeedStats>)>

Callback for obtaining feed statistics.

Public Functions

virtual std::shared_ptr<MediaServerSession> session() const = 0

Obtain the media session this feed belongs to. This may be null if the session has shut down.

virtual bool feedStatistics(const FeedStatsCallback &callback) = 0

Request the feed’s statistics.

This function is asynchronous, calling the provided callback with the results when collected.

class IPeerFeedFeature
#include <PxMedia/IPeerFeedFeature.h>

The interface common to all peer feeds.

Public Functions

virtual std::shared_ptr<PeerSession> session() const = 0

Obtain the peer session this feed belongs to. Note that the peer session may be null if the session has shut down.

class MediaServerFeed : public Proximie::PxMedia::FeedBase
#include <PxMedia/MediaServerFeed.h>

Base class for all feeds that are part of a media server session.

Subclassed by Proximie::PxMedia::MediaServerIncomingVideoFeed, Proximie::PxMedia::MediaServerOutgoingVideoFeed, Proximie::PxMedia::MediaServerTwoWayAudioFeed

Public Types

using MediaServerFeedProperties = FeedBaseProperties

Properties that apply to the whole feed.

Public Functions

inline IMediaServerFeedFeature &mediaServerFeed()

Supports the media server feed feature.

inline const IMediaServerFeedFeature &mediaServerFeed() const

Supports the media server feed feature.

struct MediaServerFeedStats
#include <PxMedia/MediaServerFeedStats.h>

Statistics for a given media feed

Public Functions

inline MediaServerFeedStats(const shared_not_null<MediaServerFeed> &feed, WebRtcStats webRtcStats)

Create feed statistics details for a given feed.

Public Members

shared_not_null<MediaServerFeed> feed

The feed.

WebRtcStats webRtcStats

WebRTC stats for the feed.

class MediaServerIncomingVideoFeed : public Proximie::PxMedia::MediaServerFeed
#include <PxMedia/MediaServerIncomingVideoFeed.h>

A class which manages an incoming video feed in a media server session.

Public Static Functions

static NotNullOutcome<MediaServerIncomingVideoFeed> create(const shared_not_null<MediaServerSession> &session, const FeedProperties &props, const VideoOutputFeedComponent &output)

Factory method to create a two-way audio feed associated with a media server session.

struct FeedProperties : public Proximie::PxMedia::FeedBase::FeedBaseProperties
#include <PxMedia/MediaServerIncomingVideoFeed.h>

Properties that apply to the whole feed.

Public Functions

inline explicit FeedProperties(string_view streamId)

Construct feed properties with just the stream-id to subscribe to.

inline explicit FeedProperties(string_view label, string_view streamId)

Construct feed properties with a label & stream-id to subscribe to

Public Members

std::string subscribeFeedStreamId

The stream ID to subscribe to.

class MediaServerOutgoingVideoFeed : public Proximie::PxMedia::MediaServerFeed
#include <PxMedia/MediaServerOutgoingVideoFeed.h>

A class which manages a local video feed being shared in a media server session.

Adaptive streaming support

void applyAdaptiveQuality(AdaptiveQuality quality)

Request the connection adjust its quality

AdaptiveQuality adaptiveQuality() const

Obtain the current adaptive quality

Public Static Functions

static inline NotNullOutcome<MediaServerOutgoingVideoFeed> create(const shared_not_null<MediaServerSession> &session, const FeedProperties &props, const VideoInputFeedComponent &input)

Factory method to create an outgoing video feed in a media server session.

static inline NotNullOutcome<MediaServerOutgoingVideoFeed> create(const shared_not_null<MediaServerSession> &session, const FeedProperties &props, const VideoInputFeedComponent &input, const VideoOutputFeedComponent &localOut)

Factory method to create an outgoing video feed in a media server session, with an additional local video output target.

struct FeedProperties : public Proximie::PxMedia::FeedBase::FeedBaseProperties
#include <PxMedia/MediaServerOutgoingVideoFeed.h>

Properties that apply to the whole feed.

Public Functions

inline explicit FeedProperties(const std::string &label = {}, StreamIndexHint indexHint = 0)

Constructor to feed properties with label etc.

Public Members

StreamIndexHint indexHint = 0

Index hint for the stream.

class MediaServerSession : public std::enable_shared_from_this<MediaServerSession>
#include <PxMedia/MediaServerSession.h>

Manages audio and video connections to media servers.

Maintains audio and video media connections to session media server. Local devices can be shared with other session participants, and their streams are made available to the host application using the session object.

For more details see Media Server Session in the SDK documentation.

Aliases

using ConnectionState = PxMedia::ConnectionState

Connection state.

using ServiceRequestFields = PxRestApi::ProximieServices::RequestFields

Service request fields.

Public Types

using OnErrorEvent = std::function<void(const shared_not_null<MediaServerSession>&, error_code)>

Signature for events with error.

using OnStreamIdEvent = std::function<void(const shared_not_null<MediaServerSession>&, string_view)>

Signature for events with stream-id.

using OnStreamIdWithErrorEvent = std::function<void(const shared_not_null<MediaServerSession>&, string_view, error_code)>

Signature for events with stream-id and error.

using OnNewRemoteFeedEvent = std::function<void(const shared_not_null<MediaServerSession>&, const shared_not_null<FeedMetadata>&)>

Signature for events with feed metadata.

using OnFeedStatisticsEvent = std::function<void(const shared_not_null<MediaServerSession>&, const shared_not_null<MediaServerFeedStats>&)>

Signature for events with feed statistics.

Public Functions

ConnectionState state() const

Connectivity state of the session.

FutureOutcome<void> connectToSession(string_view sessionId, const PxCore::RemoteEnvironment &env, const ServiceRequestFields &serviceSettings)

Start to connect to a given session.

Returns a future that resolves to the outcome of the connection attempt.

The caller can use the future returned to wait for the connection to complete. Also the MediaServerSession::onSessionConnected callback is always called (i.e. immediately or later), with the error in case of an error.

FutureOutcome<void> disconnectFromSession()

Disconnect from the current session.

Returns a future that resolves to the outcome of the disconnection attempt.

The caller can use the future returned to wait for the connection to complete. Also the MediaServerSession::onSessionDisconnected callback is always called (i.e. immediately or later), with the error in case of an error.

std::vector<std::string> listSessionFeedIds() const

Obtain a list of all feed IDs owned by the session.

std::vector<shared_not_null<MediaServerFeed>> listSessionFeeds() const

List all feeds currently associated with the session

std::shared_ptr<MediaServerFeed> getFeed(string_view streamId) const

Obtain a feed from it’s stream ID.

Returns:

A shared pointer to the feed, or nullptr if not found

void audioEncoder(const AudioWebRtcEncodeFeedComponent &encoder)

Set the default audio encoder for newly created feeds.

void videoEncoder(const VideoWebRtcEncodeFeedComponent &encoder)

Set the default video encoder for newly created feeds.

void onSessionConnected(const OnErrorEvent &func)

Notifies when a session has connected, either with an error or successfully.

void onSessionError(const OnErrorEvent &func)

Notify when the is an error with the media session after connection.

void onNewRemoteFeed(const OnNewRemoteFeedEvent &func)

Notify that a new remote feed is available from the media server.

void onRemoteFeedRemoved(const OnStreamIdEvent &func)

Notify that a remote feed is no longer available.

void onFeedStarted(const OnStreamIdEvent &func)

Notify that a feed has successfully started.

void onFeedStopped(const OnStreamIdWithErrorEvent &func)

Notify that a feed has stopped, which may be intentionally or in error.

void onSessionDisconnected(const OnErrorEvent &func)

Notifies when a session has disconnected, either in error or by request.

Public Static Functions

static shared_not_null<MediaServerSession> create(const shared_not_null<PxCore::ProximieContext> &context)

Create a new MediaServerSession into a shared pointer.

A MediaServerSession is required to be owned as a smart pointer to permit asynchronous requests and operations.

For more details, see Creating a MediaServerSession instance.

struct FeedMetadata
#include <PxMedia/MediaServerSession.h>

Metadata for a given feed.

Public Functions

inline FeedMetadata(string_view withId, StreamFeedType::Enum withType, string_view withLabel)

Construct with the required metadata.

Public Members

std::string streamId

Stream ID for the feed.

StreamFeedType::Enum feedType = StreamFeedType::Enum::None

Feed type for informational purposes.

boost::optional<std::string> label

Human readable label, if present.

class MediaServerTwoWayAudioFeed : public Proximie::PxMedia::MediaServerFeed
#include <PxMedia/MediaServerTwoWayAudioFeed.h>

A class which manages a two-way audio feed in a media server session.

Public Types

using FeedProperties = MediaServerFeedProperties

Properties that apply to the whole feed.

Public Static Functions

static NotNullOutcome<MediaServerTwoWayAudioFeed> create(const shared_not_null<MediaServerSession> &session, const FeedProperties &props, const AudioInputFeedComponent &input, const AudioOutputFeedComponent &output)

Factory method to create a two-way audio feed associated with a media server session.

class PeerFeed : public Proximie::PxMedia::FeedBase
#include <PxMedia/PeerFeed.h>

Base class for all peer session feeds.

Subclassed by Proximie::PxMedia::PeerLocalAudioFeed, Proximie::PxMedia::PeerLocalVideoFeed, Proximie::PxMedia::PeerRemoteAudioFeed, Proximie::PxMedia::PeerRemoteVideoFeed

Public Functions

inline IPeerFeedFeature &peerFeed()

Supports the peer feed feature

inline const IPeerFeedFeature &peerFeed() const

Supports the peer feed feature

struct FeedProperties : public Proximie::PxMedia::FeedBase::FeedBaseProperties
#include <PxMedia/PeerFeed.h>

Properties that apply to the whole feed.

Note that feed properties always require a channel key

Public Members

std::string channel

The peer’s channel key.

class PeerLocalAudioFeed : public Proximie::PxMedia::PeerFeed
#include <PxMedia/PeerLocalAudioFeed.h>

A peer feed that sends local Audio to the remote peer.

Public Static Functions

static inline NotNullOutcome<PeerLocalAudioFeed> create(const shared_not_null<PeerSession> &session, const FeedProperties &props, const AudioInputFeedComponent &input)

Factory method to create an outgoing feed associated with a peer session.

static inline NotNullOutcome<PeerLocalAudioFeed> create(const shared_not_null<PeerSession> &session, const FeedProperties &props, const AudioInputFeedComponent &input, const AudioOutputFeedComponent &localOut)

Factory method to create an outgoing feed associated with a peer session, which also outputs locally.

class PeerLocalVideoFeed : public Proximie::PxMedia::PeerFeed
#include <PxMedia/PeerLocalVideoFeed.h>

A peer feed that sends local video to the remote peer.

Public Static Functions

static inline NotNullOutcome<PeerLocalVideoFeed> create(const shared_not_null<PeerSession> &session, const FeedProperties &props, const VideoInputFeedComponent &input, const X264EncoderFeedComponent *encoderProperties = nullptr)

Factory method to create an outgoing feed associated with a peer session.

static inline NotNullOutcome<PeerLocalVideoFeed> create(const shared_not_null<PeerSession> &session, const FeedProperties &props, const VideoInputFeedComponent &input, const VideoOutputFeedComponent &localOut, const X264EncoderFeedComponent *encoderProperties = nullptr)

Factory method to create an outgoing feed associated with a peer session, which also outputs locally.

class PeerRemoteAudioFeed : public Proximie::PxMedia::PeerFeed
#include <PxMedia/PeerRemoteAudioFeed.h>

A peer feed that receives Audio from the remote peer.

Public Static Functions

static NotNullOutcome<PeerRemoteAudioFeed> create(const shared_not_null<PeerSession> &session, const FeedProperties &props, const AudioOutputFeedComponent &output)

Factory method to create an incoming feed associated with a peer session.

class PeerRemoteVideoFeed : public Proximie::PxMedia::PeerFeed
#include <PxMedia/PeerRemoteVideoFeed.h>

A peer feed that receives video from the remote peer.

Public Static Functions

static NotNullOutcome<PeerRemoteVideoFeed> create(const shared_not_null<PeerSession> &session, const FeedProperties &props, const VideoOutputFeedComponent &output)

Factory method to create an incoming feed associated with a peer session.

class PeerSession
#include <PxMedia/PeerSession.h>

A peer session represents a connection between two peers.

For more details see Peer Streaming in the SDK documentation.

Public Functions

std::vector<std::string> listSessionFeedIds() const

List all feeds currently associated with the session

std::vector<shared_not_null<PeerFeed>> listSessionFeeds() const

List all feeds currently associated with the session

std::shared_ptr<PeerFeed> getFeed(string_view streamId) const

Obtain a feed by it’s stream ID

shared_not_null<AVOutputFeedFile> createRecordingFeed(const std::string &videoFeedId, const std::vector<std::string> &audioFeedIds, const AVOutputFeedFile::AVOutputFeedFileSettings &settings)

Add a feed that will record the stream to a file output

Public Static Functions

static NotNullOutcome<PeerSession> create(const shared_not_null<PxCore::ProximieContext> &context, const PeerSessionSettings &settings)

Factory method to create a new peer session

struct PeerChannel
#include <PxMedia/PeerSession.h>

Details needed to declare a channel sent by the peer

Public Members

std::string label

Human-readable name/label.

PxUtility::NetworkPort_t port = PxUtility::DEFAULT_UDP_PORT

The port to use.

struct PeerDetails
#include <PxMedia/PeerSession.h>

The details of a peer connection and it’s “channels”

Public Members

std::string label

Human-readable name/label.

PeerHost host

The host details.

KeyMap<PeerChannel> channels

The channels that the peer has declared. This is a map of unique channel key to channel details

struct PeerHost
#include <PxMedia/PeerSession.h>

Details needed to locate a peer host

Public Members

std::string hostname

The host name or IP address.

struct PeerSessionSettings
#include <PxMedia/PeerSession.h>

Settings and parameters for a session between peers

Public Functions

inline PeerSessionSettings(PeerDetails local, PeerDetails remote, string_view key)

Create session settings with local and remote peer details.

Note that the encryption key needs to be encoded as follows:

  • Only containing hexadecimal characters (not case sensitive)

  • Exactly 60 characters long (i.e. representing 30 bytes)

Public Members

std::string encryptionKey

The key used for encryption.

PeerDetails local

The local peer details.

PeerDetails remote

The remote peer details.

class PxMediaErrorCategory : public boost::system::error_category
#include <PxMedia/PxMediaErrorCode.h>

Error category for PxMediaErrorCode.

Error category

Implements the error_category interface

const char *name() const noexcept override

Returns the error category name as a string

std::string message(int code) const override

Returns the message for the provided error code

Public Types

using ErrorCodeEnum = PxMediaErrorCode

Alias for the enum type used

Public Static Functions

static const PxMediaErrorCategory &category()

Returns the category instance for the PxMediaErrorCategory

static const char *messageFromErrorCode(ErrorCodeEnum code)

Helper to translate an error code into a message string

class UtilityAudioMixerFeed : public Proximie::PxMedia::FeedBase
#include <PxMedia/UtilityAudioMixerFeed.h>

An audio mixing utility feed.

Utility feeds are pipelines which don’t have a remote element, and are not associated with or managed by a session. This feed takes multiple audio inputs and mixes them together into a single audio output.

Public Types

using FeedProperties = FeedBase::FeedBaseProperties

Properties that apply to the whole feed.

Public Static Functions

static NotNullOutcome<UtilityAudioMixerFeed> create(const shared_not_null<PxCore::ProximieContext> &context, const FeedProperties &props, const AudioInputFeedComponents &inputs, const AudioOutputFeedComponent &output)

Factory method to create a utility feed that takes multiple audio inputs and mixes them together into a single audio output.

class UtilityVideoLocalFeed : public Proximie::PxMedia::FeedBase
#include <PxMedia/UtilityVideoLocalFeed.h>

A simple utility video feed.

Utility feeds are pipelines which don’t have a remote element, and are not associated with or managed by a session.

Public Types

using FeedProperties = FeedBase::FeedBaseProperties

Properties that apply to the whole feed.

Public Static Functions

static NotNullOutcome<UtilityVideoLocalFeed> create(const shared_not_null<PxCore::ProximieContext> &context, const FeedProperties &props, const VideoInputFeedComponent &input, const VideoOutputFeedComponent &localOut)

Factory method to create a utility feed that takes a video input and sends onward to some video output.

class VideoCapabilities
#include <PxMedia/VideoCapabilities.h>

Provide capability settings that are common to all video media types.

Getters and setters

Setter functions return a reference to the parent object, allowing callers to chain setting functions.

inline MediaType mediaType() const

Get media type.

inline VideoCapabilities &mediaType(MediaType set)

Set media type.

inline VideoSizePixels height() const

Get video height in pixels.

inline VideoCapabilities &height(VideoSizePixels set)

Set video height in pixels.

inline VideoSizePixels width() const

Get video width in pixels.

inline VideoCapabilities &width(VideoSizePixels set)

Set video width in pixels.

inline const VideoResolution &resolution() const

Get video resolution.

inline VideoCapabilities &resolution(const VideoResolution &set)

Set video resolution.

inline AdaptiveRulePtr<VideoResolution> adaptiveResolution() const

Get the adaptive resolution rule.

inline VideoCapabilities &adaptiveResolution(const AdaptiveRulePtr<VideoResolution> &set)

Set the adaptive resolution rule.

inline FrameRate frameRate() const

Get frame rate.

inline VideoCapabilities &frameRate(FrameRate set)

Set frame rate.

inline AdaptiveRulePtr<FrameRate> adaptiveFrameRate() const

Get the adaptive frame rate rule.

inline VideoCapabilities &adaptiveFrameRate(const AdaptiveRulePtr<FrameRate> &set)

Set the adaptive frame rate rule.

Public Types

using VideoSizePixels = uint32_t

Video height/width, in pixels

template<typename T>
using AdaptiveRulePtr = std::shared_ptr<AdaptiveRule<T>>

Adaptive rule references.

using MediaType = VideoMediaFormat::MediaType

The underlying media type of a video feed.

struct VideoResolution
#include <PxMedia/VideoCapabilities.h>

Convenience structure to hold video resolution in pixels.

Public Functions

constexpr VideoResolution() = default

By default create a zero-initialised resolution

inline constexpr VideoResolution(VideoSizePixels setWidth, VideoSizePixels setHeight)

When initialising, require both width and height

Public Members

VideoSizePixels width = 0

Width in pixels.

VideoSizePixels height = 0

Height in pixels.

class VideoFeedStageComponent : public Proximie::PxMedia::FeedComponent<VideoFeedStageComponentProvider>
#include <PxMedia/VideoFeedStage.h>

Base class for video feed stage components.

Subclassed by Proximie::PxMedia::VideoStageRotateCrop

class VideoFeedStageSequence
#include <PxMedia/VideoFeedStage.h>

A sequence of video feed stage components.

Public Types

using ComponentSequence = std::vector<std::reference_wrapper<const VideoFeedStageComponent>>

A sequence of feed stage component references to set a sequence.

Public Functions

inline void sequence(const ComponentSequence &components)

Set the sequence of feed stages with a sequence of components.

class VideoInputFeedTestPattern : public Proximie::PxMedia::VideoFormattedInputFeedComponent
#include <PxMedia/VideoInputFeedTestPattern.h>

A video input feed component that sends a “test card” pattern as the video feed.

This component can be used to use test video without a physical device.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class VideoInputFeedUdp : public Proximie::PxMedia::VideoInputFeedComponent
#include <PxMedia/VideoInputFeedUdp.h>

A video input feed using a UDP source.

This feed component provides properties to specify how the feed obtains H264 encoded video using RTP from a given UDP port.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

inline UdpSourceProperties &udpProperties()

Access the UDP source properties.

inline const UdpSourceProperties &udpProperties() const

Access the UDP source properties as const.

inline RtpProperties &rtpProperties()

Access the RTP properties.

inline const RtpProperties &rtpProperties() const

Access the RTP properties as const.

class RtpProperties
#include <PxMedia/VideoInputFeedUdp.h>

RTP properties.

Getters and setters

Setter functions return a reference to the parent object, allowing callers to chain setting functions.

inline uint32_t clockRate() const

Get the clock rate.

inline RtpProperties &clockRate(uint32_t set)

Set the clock rate.

class UdpSourceProperties
#include <PxMedia/VideoInputFeedUdp.h>

UDP source properties.

Getters and setters

Setter functions return a reference to the parent object, allowing callers to chain setting functions.

By default, the UDP host is set to "localhost" and the port is set to the default 5004.

inline const std::string &host() const

Get UDP host, where empty indicates using "localhost"

inline UdpSourceProperties &host(const std::string &set)

Set UDP host - if empty, uses the value "localhost"

inline UdpSourceProperties &localhost()

Sets the UDP host as localhost.

inline PxUtility::NetworkPort_t port() const

Get the UDP port.

inline UdpSourceProperties &port(PxUtility::NetworkPort_t set)

Set the UDP port.

inline uint32_t mtu() const

Get the maximum expected packet size (mtu), zero for default.

inline UdpSourceProperties &mtu(uint32_t set)

Set the maximum expected packet size (mtu), zero for default.

inline UdpSourceProperties &defaultMtu()

Set the maximum expected packet size (mtu) to the default.

inline std::chrono::milliseconds timeout() const

Get the timeout (ms) for the UDP source, where zero is disabled.

inline UdpSourceProperties &timeout(std::chrono::milliseconds set)

set the timeout (ms) for the UDP source, where zero is disabled

inline UdpSourceProperties &noTimeout()

Disable the timeout for the UDP source.

class VideoInputFeedV4Linux2 : public Proximie::PxMedia::VideoFormattedInputFeedComponent
#include <PxMedia/VideoInputFeedV4Linux2.h>

A video input feed component using a Video4Linux2 device.

This feed component provides properties to specify which actual device to use, and the VideoCapabilities (such as resolution and frame rate).

Public Types

enum class IOMode

IO Mode for the device.

Values:

enumerator AUTO

Default, automatic selection.

enumerator RW

Read/Write.

enumerator MMAP

Memory-mapped.

enumerator USERPTR

User pointer mode.

enumerator DMABUF

DMA buffer.

enumerator DMABUF_IMPORT

DMA buffer import.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

inline DeviceProperties &deviceProperties()

Returns the device properties for selecting the device to use.

inline const DeviceProperties &deviceProperties() const

Read-only access to the device properties.

class DeviceProperties
#include <PxMedia/VideoInputFeedV4Linux2.h>

Device properties.

The device can be specified in various ways, including path/location, file descriptor and by name. The caller should choose one value to set to specify the device.

If no device is specified, the default is to use device /dev/video0.

Getters and setters

Setter functions return a reference to the parent object, allowing callers to chain setting functions.

inline const std::string &device() const

Get the device location.

inline DeviceProperties &device(string_view set)

Set the device location e.g. "/dev/video0"

inline int deviceFd() const

Get the device file descriptor.

inline DeviceProperties &deviceFd(int set)

Set the device file descriptor.

inline const std::string &deviceName() const

Get the device name.

inline DeviceProperties &deviceName(string_view set)

Set the device name.

inline const boost::optional<IOMode> &ioMode() const

Get the IO mode.

inline DeviceProperties &ioMode(IOMode set)

Set the IO mode.

inline DeviceProperties &defaultIOMode()

Set the default IO mode.

class VideoInputFeedXImage : public Proximie::PxMedia::VideoFormattedInputFeedComponent
#include <PxMedia/VideoInputFeedXImage.h>

A video input feed component capturing an X desktop or window.

This feed component provides properties to specify which X display or window to capture, and the VideoCapabilities (such as resolution and frame rate).

Setters

These setter functions return a reference to the parent object, allowing callers to chain setting functions.

To set video feed sub-properties, use the VideoInputFeedXImage::videoCapabilities accessor function.

VideoInputFeedXImage &displayName(string_view set)

Set the display name

VideoInputFeedXImage &xid(int64_t set)

Set the XID of the window to capture

VideoInputFeedXImage &xname(string_view set)

Set the name of the window to capture

VideoInputFeedXImage &captureArea(const PxUtility::Rectangle<int> &set)

Set the capture area pixel coordinates

VideoInputFeedXImage &startx(int set)

Set the top-left X coordinate of area to capture

VideoInputFeedXImage &starty(int set)

Set the top-left Y coordinate of area to capture

VideoInputFeedXImage &endx(int set)

Set the bottom-right X coordinate of area to capture

VideoInputFeedXImage &endy(int set)

Set the bottom-right Y coordinate of area to capture

VideoInputFeedXImage &useDamage(bool set)

Set whether to use XDamage to only capture changed regions

VideoInputFeedXImage &showPointer(bool set)

Set whether to show mouse pointer

VideoInputFeedXImage &remote(bool set)

Set whether the X display is remote

VideoInputFeedXImage &enableNavigationEvents(bool set)

Set whether to enable navigation events

inline const Properties &properties() const

Returns a read-only reference to the properties for the object

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

struct Properties
#include <PxMedia/VideoInputFeedXImage.h>

The properties required to specify the video input device and its settings.

X Desktop capture settings

These settings determine how the X Desktop or window is captured.

bool enableNavigationEvents = false

Enable navigation events.

bool remote = false

Whether the X display is remote.

bool showPointer = true

Show mouse pointer (requires XFixes extension)

bool useDamage = true

Use XDamage to only capture changed regions (requires XDamage extension)

PxUtility::Rectangle<int> captureArea

The area to capture, as a rectangle of integer pixel coordinates.

int64_t xid = 0

The XID of the window to capture. 0 means the root window.

std::string displayName

X Display name.

std::string xname

The name of the window to capture, if any.

class VideoOutputFeedAuto : public Proximie::PxMedia::VideoOutputFeedComponent
#include <PxMedia/VideoOutputFeedAuto.h>

A video output component that chooses an appropriate output to use.

This feed component can be used to simply add a suitable video output; in practice, this will open a new window to stream video to. This can be useful to test video feeds, but real world applications will typically want to control and manage video output windows using other output components.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class VideoOutputFeedFake : public Proximie::PxMedia::VideoOutputFeedComponent
#include <PxMedia/VideoOutputFeedFake.h>

A video output component that chooses an appropriate output to use.

This feed component can be used to simply add a suitable video output; in practice, this will open a new window to stream video to. This can be useful to test video feeds, but real world applications will typically want to control and manage video output windows using other output components.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class VideoOutputFeedUdp : public Proximie::PxMedia::VideoOutputFeedComponent
#include <PxMedia/VideoOutputFeedUdp.h>

A video output feed component that sends video output to a given UDP port.

This feed component provides properties to specify how the feed is encoded using H264 streamed to UDP port using RTP.

Setters

These setter functions return a reference to the parent object, allowing callers to chain setting functions.

To set encoder sub-properties, use the VideoOutputFeedUdp::encoderProperties accessor function.

inline VideoOutputFeedUdp &configInterval(int32_t set)

Set RTP config interval

inline VideoOutputFeedUdp &aggregateMode(RtpAggregateMode set)

Set RTP aggregate mode

inline VideoOutputFeedUdp &host(string_view set)

Set UDP host

inline VideoOutputFeedUdp &port(PxUtility::NetworkPort_t set)

Set UDP port

Public Types

enum class RtpAggregateMode

Settings for RTP aggregate mode.

Values:

enumerator NONE

Do not aggregate NAL units.

enumerator ZERO_LATENCY

Aggregate NAL units until a VCL unit is included.

enumerator MAX_STAP

Aggregate all NAL units with the same timestamp.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

inline X264EncoderFeedComponent &encoderProperties()

Returns encoder properties object, which can be used to set encoder settings for the component.

inline const Properties &properties() const

Returns a read-only reference to the properties for the object

struct Properties
#include <PxMedia/VideoOutputFeedUdp.h>

The properties required to specify the video output encoder and UDP settings.

RTP settings

int32_t configInterval

The send SPS and PPS insertion interval, in seconds.

The interval can also be set to the following special values:

  • 0 for disabled

  • -1 to send with every IDR frame

RtpAggregateMode aggregateMode

Bundle suitable SPS/PPS NAL units into STAP-A aggregate packets.

UDP settings

std::string host

Host - if empty, uses the value "localhost"

PxUtility::NetworkPort_t port = PxUtility::DEFAULT_UDP_PORT

Port to use for UDP

Public Members

X264EncoderFeedComponent encoder

Encoder settings for the video feed over UDP.

class VideoStageRotateCrop : public Proximie::PxMedia::VideoFeedStageComponent
#include <PxMedia/VideoStageRotateCrop.h>

A processing stage that applies rotation and/or cropping to the video.

Getters and setters

Setter functions return a reference to the parent object, allowing callers to chain setting functions.

inline Order order() const

Get the order of rotation and cropping.

inline VideoStageRotateCrop &order(Order set)

Set the order of rotation and cropping.

inline RotateFlip rotateFlip() const

Get the rotation/flip method.

inline VideoStageRotateCrop &rotateFlip(RotateFlip set)

Get the rotation/flip method.

inline const PxUtility::Rectangle<CropSizePixels> &cropRectangle() const

Get the crop rectangle.

inline PxUtility::Rectangle<CropSizePixels> &cropRectangle()

Access the crop rectangle for modification.

Public Types

enum class Order

Order to apply the rotation/flipping and cropping.

Values:

enumerator RotateFlipThenCrop

Rotate/flip the video first, then crop.

enumerator CropThenRotateFlip

Crop the video first, then rotate/flip.

enumerator RotateFlipOnly

Rotate/flip the video only.

enumerator CropOnly

Crop the video only.

enum class RotateFlip

Rotation/flip method.

Values:

enumerator None

No rotation or flip.

enumerator Clockwise90

Rotate 90 degrees clockwise.

enumerator Rotate180

Rotate 180 degrees.

enumerator Anticlockwise90

Rotate 90 degrees anticlockwise.

enumerator FlipHorizontal

Flip horizontally.

enumerator FlipVertical

Flip vertically.

enumerator FlipDiagonalUL

Flip diagonally upper-left to lower-right.

enumerator FlipDiagonalUR

Flip diagonally upper-right to lower-left.

using CropSizePixels = uint32_t

Cropping values, in pixels.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

class VideoWebRtcEncodeFeedH264 : public Proximie::PxMedia::VideoWebRtcEncodeFeedComponent
#include <PxMedia/VideoWebRtcEncodeFeedH264.h>

A video feed component for specifying H264 encoding for WebRTC.

Setters

These setter functions return a reference to the parent object, allowing callers to chain setting functions.

To set video feed sub-properties, use the VideoWebRtcEncodeFeedH264::encodingProperties accessor function.

inline VideoWebRtcEncodeFeedH264 &rtpMtu(int32_t set)

Set the RTP MTU value

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

inline X264EncoderFeedComponent &encodingProperties()

Returns H264 encoding object, which can be used to set encoding properties for the component.

inline const Properties &properties() const

Returns a read-only reference to the properties for the object

struct Properties
#include <PxMedia/VideoWebRtcEncodeFeedH264.h>

The properties required to encode the video feed for WebRTC using H264.

RTP properties

uint32_t rtpMtu

Maximum size of one packet for rtp.

Public Members

X264EncoderFeedComponent encoding

H264 encoder parameters.

class VideoWebRtcEncodeFeedVp8 : public Proximie::PxMedia::VideoWebRtcEncodeFeedComponent
#include <PxMedia/VideoWebRtcEncodeFeedVp8.h>

A video feed component for specifying VP8 encoding for WebRTC.

Setters

These setter functions return a reference to the parent object, allowing callers to chain setting functions.

inline VideoWebRtcEncodeFeedVp8 &targetBitrate(BitRate set)

Set the target bitrate, where zero indicates “auto”

inline VideoWebRtcEncodeFeedVp8 &deadline(int64_t set)

Set the frame deadline

inline VideoWebRtcEncodeFeedVp8 &keyframeMaxDist(int32_t set)

Set the keyframe maximum distance

inline VideoWebRtcEncodeFeedVp8 &cpuUsed(int32_t set)

Set CPU used (see https://www.webmproject.org/docs/encoder-parameters/)

inline VideoWebRtcEncodeFeedVp8 &threads(int32_t set)

Set threads to use

inline VideoWebRtcEncodeFeedVp8 &rtpMtu(uint32_t set)

Set RTP MTU (maximum size of one packet for rtp)

inline VideoWebRtcEncodeFeedVp8 &endUsage(EndUsageType set)

Set end usage rate contorl mode

inline VideoWebRtcEncodeFeedVp8 &errorResilient(ErrorResilienceType set)

Set error resilience

inline const Properties &properties() const

Returns a read-only reference to the properties for the object

Public Types

enum class EndUsageType

End usage type specifies the bit rate control mode.

Values:

enumerator VBR

Variable Bit Rate (VBR) mode.

enumerator CBR

Constant Bit Rate (CBR) mode.

enumerator CQ

Constant Quality Mode (CQ) mode.

enum class ErrorResilienceType

Error resilience setting.

Values:

enumerator Default

Default error resilience.

enumerator Partitions

Allow partitions to be decoded independently.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

struct Properties
#include <PxMedia/VideoWebRtcEncodeFeedVp8.h>

The properties required to encode the video feed for WebRTC using VP8.

Public Members

BitRate targetBitrate

Target bitrate (0 = auto)

int64_t deadline

Deadline (usec per frame, or 0=best, 1=realtime)

int32_t keyframeMaxDist

Maximum number of frames between keyframes.

int32_t cpuUsed

See https://www.webmproject.org/docs/encoder-parameters/.

int32_t threads

Number of threads to use.

uint32_t rtpMtu

Maximum size of one packet for rtp.

EndUsageType endUsage

End usage setting

ErrorResilienceType errorResilient

Error resilience.

struct WebRtcStats
#include <PxMedia/WebRtcStats.h>

Statistics gather from a WebRTC feed.

WebRTC stats are based on the webrtc-stats spec available from https://www.w3.org/TR/webrtc-stats/. Since the webrtc-stats spec is a draft and subject to change, the stats are represented by a JSON object rather than strongly typed at this stage.

Note: timestamp fields in the output are based on the host system’s “monotonic clock”, in microseconds. The basis of the clock value is undefined/system dependent, and applications should use the values for relative comparisons only.

Public Members

std::shared_ptr<const json_object> json

Stats in plain JSON form.

std::shared_ptr<const StatsElements> elements

Stats parsed into a typed structure.

Public Static Functions

static outcome::result<WebRtcStats> create(const GstStructure &stats)

Create a parsed stats object from a base WebRTC GST structure

Ref.: https://gstreamer.freedesktop.org/documentation/webrtc/index.html#webrtcbin::get-stats

struct BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Base/common properties for all WebRTC stats.

Subclassed by Proximie::PxMedia::WebRtcStats::CandidatePairStats, Proximie::PxMedia::WebRtcStats::CodecStats, Proximie::PxMedia::WebRtcStats::IceCandidateStats, Proximie::PxMedia::WebRtcStats::InboundRtpStats, Proximie::PxMedia::WebRtcStats::OutboundRtpStats, Proximie::PxMedia::WebRtcStats::PeerConnectionStats, Proximie::PxMedia::WebRtcStats::RemoteInboundRtpStats, Proximie::PxMedia::WebRtcStats::RemoteOutboundRtpStats, Proximie::PxMedia::WebRtcStats::TransportStats

Public Functions

PxUtility::JsonSerializer &serializeBase(PxUtility::JsonSerializer &serializer, string_view type)

Helper to serialize with type

Public Members

std::string id

Stats identifier.

double timestamp = 0

Timestamp of the stats.

struct CandidatePairStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for a candidate pair.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

boost::optional<double> availableIncomingBitrate

Available incoming bitrate.

boost::optional<double> availableOutgoingBitrate

Available outgoing bitrate.

boost::optional<int64_t> bytesReceived

Bytes received.

boost::optional<int64_t> bytesSent

Bytes sent.

boost::optional<double> currentRoundTripTime

Current round trip time.

boost::optional<double> lastPacketReceivedTimestamp

Last packet received timestamp.

boost::optional<double> lastPacketSentTimestamp

Last packet sent timestamp.

boost::optional<std::string> localCandidateId

Local candidate identifier.

boost::optional<bool> nominated

Whether or not the candidate pair has been nominated to be used.

boost::optional<std::string> remoteCandidateId

Remote candidate identifier.

boost::optional<int64_t> requestsReceived

Requests received.

boost::optional<int64_t> requestsSent

Requests sent.

boost::optional<int64_t> responsesReceived

Responses received.

boost::optional<int64_t> responsesSent

Responses sent.

boost::optional<std::string> state

State of the connection between the two candidates.

boost::optional<double> totalRoundTripTime

Total round trip time.

boost::optional<std::string> transportId

The transport inspected to obtain the transport-related stats.

struct CodecStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for a codec.

Note that in some cases the codec stats are omitted

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

boost::optional<int64_t> payloadType

Payload type of the codec.

boost::optional<int64_t> ssrc

Synchronization source.

boost::optional<std::string> mimeType

MIME type of the codec.

boost::optional<std::string> codecType

Codec type, e.g. “encode”.

boost::optional<int64_t> clockRate = 0

Clock rate of the codec.

boost::optional<int64_t> channels

Number of channels.

boost::optional<std::string> sdpFmtpLine

SDP FMTP line.

struct GstRtpJitterBufferStats
#include <PxMedia/WebRtcStats.h>

GST RTP jitter buffer stats.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

int64_t numPushed = 0

Number of packets pushed.

int64_t numLost = 0

Number of packets lost.

int64_t numLate = 0

Number of packets late.

int64_t numDuplicates = 0

Number of packets duplicated.

int64_t avgJitter = 0

Average jitter.

int64_t rtxCount = 0

RTX count.

int64_t rtxSuccessCount = 0

RTX success count.

double rtxPerPacket = 0

RTX per packet.

int64_t rtxRtt = 0

RTX round trip time.

struct GstRtpSourceStats
#include <PxMedia/WebRtcStats.h>

GST RTP source stats.

See https://gstreamer.freedesktop.org/documentation/rtpmanager/RTPSource.html#RTPSource:stats

Subclassed by Proximie::PxMedia::WebRtcStats::GstRtpSourceStatsWithRb

Public Functions

virtual void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

int64_t ssrc = 0

Synchronization source.

bool internal = false

Internal flag.

bool validated = false

Validated flag.

bool receivedBye = false

Received “BYE” flag.

bool isCsrc = false

Is CSRC flag.

bool isSender = false

Is sender flag.

int64_t seqNumBase = 0

Sequence number base.

int64_t clockRate = 0

Clock rate.

uint64_t octetsSent = 0

Number of octets sent.

uint64_t packetsSent = 0

Number of packets sent.

uint64_t octetsReceived = 0

Number of octets received.

uint64_t packetsReceived = 0

Number of packets received.

uint64_t bytesReceived = 0

Number of bytes received.

uint64_t bitRate = 0

Bit rate.

int64_t packetsLost = 0

Number of packets lost.

uint64_t jitter = 0

Jitter.

int64_t sentPliCount = 0

Number of PLI packets sent.

int64_t recvPliCount = 0

Number of PLI packets received.

int64_t sentFirCount = 0

Number of FIR packets sent.

int64_t recvFirCount = 0

Number of FIR packets received.

int64_t sentNackCount = 0

Number of NACK packets sent.

int64_t recvNackCount = 0

Number of NACK packets received.

int64_t recvPacketRate = 0

Receive packet rate.

bool haveSr = false

Have SR flag.

uint64_t srNtpTime = 0

SR NTP time.

int64_t srRtpTime = 0

SR RTP time.

int64_t srOctetCount = 0

SR octet count.

int64_t srPacketCount = 0

SR packet count.

struct GstRtpSourceStatsWithRb : public Proximie::PxMedia::WebRtcStats::GstRtpSourceStats
#include <PxMedia/WebRtcStats.h>

GST RTP source stats, with RB details.

See https://gstreamer.freedesktop.org/documentation/rtpmanager/RTPSource.html#RTPSource:stats

Public Functions

virtual void serialize(PxUtility::JsonSerializer &serializer) override

Serialize with JsonSerializer

Public Members

bool sentRb = false

Sent RB flag.

int64_t sentRbFractionLost = 0

Sent RB fraction lost.

int64_t sentRbPacketsLost = 0

Sent RB packets lost.

int64_t sentRbExtHighestSeq = 0

Sent RB extended highest sequence.

int64_t sentRbJitter = 0

Sent RB jitter.

int64_t sentRbLsr = 0

Sent RB LSR.

int64_t sentRbDlsr = 0

Sent RB DLSR.

bool haveRb = false

Have RB flag.

int64_t rbSsrc = 0

RB SSRC.

int64_t rbFractionLost = 0

RB fraction lost.

int64_t rbPacketsLost = 0

RB packets lost.

int64_t rbExtHighestSeq = 0

RB extended highest sequence.

int64_t rbJitter = 0

RB jitter.

int64_t rbLsr = 0

RB LSR.

int64_t rbDlsr = 0

RB DLSR.

int64_t rbRoundTrip = 0

RB round trip time.

struct IceCandidateStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for an ICE candidate.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

boost::optional<std::string> address

Candidate address.

std::string candidateType

Candidate type.

boost::optional<bool> deleted

Deleted flag.

boost::optional<int64_t> port

Candidate port.

boost::optional<uint64_t> priority

Candidate priority.

boost::optional<std::string> protocol

Candidate protocol.

boost::optional<std::string> relayProtocol

Relay protocol.

std::string transportId

Transport identifier.

boost::optional<std::string> url

URL of the ICE server.

struct InboundRtpStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for inbound RTP.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

int64_t ssrc = 0

Synchronization source.

std::string codecId

Codec identifier.

std::string transportId

Transport identifier.

int64_t packetsReceived = 0

Number of packets received.

double jitter = 0

Jitter.

std::string remoteId

Remote identifier.

int64_t bytesReceived = 0

Number of bytes received.

int64_t firCount = 0

Number of FIR packets.

int64_t pliCount = 0

Number of PLI packets.

int64_t nackCount = 0

Number of NACK packets.

boost::optional<int64_t> packetsLost

Number of packets lost.

boost::optional<int64_t> packetsDiscarded

Number of packets discarded.

boost::optional<int64_t> packetsDuplicated

Number of packets duplicated.

boost::optional<GstRtpJitterBufferStats> gstRtpJitterBufferStats

RTP jitter stats.

GstRtpSourceStatsWithRb gstRtpSourceStats

GST RTP source stats.

struct OutboundRtpStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for outbound RTP.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

int64_t ssrc = 0

Synchronization source.

std::string codecId

Codec identifier.

std::string transportId

Transport identifier.

int64_t bytesSent = 0

Number of bytes sent.

int64_t packetsSent = 0

Number of packets sent.

int64_t firCount = 0

Number of FIR packets.

int64_t pliCount = 0

Number of PLI packets.

int64_t nackCount = 0

Number of NACK packets.

GstRtpSourceStats gstRtpSourceStats

GST RTP source stats.

struct PeerConnectionStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for a peer connection.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

int64_t dataChannelsOpened = 0

Number of channels opened.

int64_t dataChannelsClosed = 0

Number of channels closed.

int64_t dataChannelsRequested = 0

Number of channels requested.

int64_t dataChannelsAccepted = 0

Number of channels accepted.

struct RemoteInboundRtpStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for remote inbound RTP.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

std::string localId

Local identifier.

int64_t ssrc = 0

Synchronization source.

std::string codecId

Codec identifier.

std::string transportId

Transport identifier.

int64_t packetsLost = 0

Number of packets lost.

double jitter = 0

Jitter.

double fractionLost = 0

Fraction of packets lost.

double roundTripTime = 0

Round trip time.

GstRtpSourceStatsWithRb gstRtpSourceStats

GST RTP source stats.

struct RemoteOutboundRtpStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for remote outbound RTP.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

Public Members

int64_t ssrc = 0

Synchronization source.

std::string codecId

Codec identifier.

std::string transportId

Transport identifier.

int64_t bytesSent = 0

Number of bytes sent.

int64_t packetsSent = 0

Number of packets sent.

double remoteTimestamp = 0

Remote timestamp.

std::string localId

Local identifier.

struct StatsElements
#include <PxMedia/WebRtcStats.h>

All the WebRTC stats elements.

Public Members

KeyMap<PeerConnectionStats> peerConnections

Peer connections.

KeyMap<CodecStats> codecs

Codec sources.

KeyMap<TransportStats> transports

Transports.

KeyMap<InboundRtpStats> inboundRtps

Inbound RTPs.

KeyMap<OutboundRtpStats> outboundRtps

Outbound RTPs.

KeyMap<RemoteInboundRtpStats> remoteInboundRtps

Remote inbound RTPs.

KeyMap<RemoteOutboundRtpStats> remoteOutboundRtps

Remote outbound RTPs.

KeyMap<CandidatePairStats> candidatePairs

Candidate pairs.

KeyMap<IceCandidateStats> iceCandidates

ICE candidate stats.

std::vector<std::string> unparsedStats

List of identifiers for unparsed stats.

struct TransportStats : public Proximie::PxMedia::WebRtcStats::BaseWebRtcStats
#include <PxMedia/WebRtcStats.h>

Stats for a transport.

Public Functions

void serialize(PxUtility::JsonSerializer &serializer)

Serialize with JsonSerializer

class X264EncoderFeedComponent : public Proximie::PxMedia::FeedComponent<X264EncoderFeedComponentProvider>
#include <PxMedia/X264EncoderFeedComponent.h>

Encapsulates X264 encoder element for use in feed components.

Setters

These setter functions return a reference to the parent object, allowing callers to chain setting functions.

inline X264EncoderFeedComponent &bitrate(BitRate set)

Set bitrate

inline X264EncoderFeedComponent &speedPreset(EncoderPreset set)

Set speed preset type

inline X264EncoderFeedComponent &tune(EncoderTune set)

Set encoder tuning

inline X264EncoderFeedComponent &keyIntMax(uint32_t set)

Set maximum between two key-frames (0 = auto)

inline X264EncoderFeedComponent &pass(EncoderPass set)

Set encoder pass setting

inline X264EncoderFeedComponent &byteStream(bool set)

Set byte stream flag

inline X264EncoderFeedComponent &threads(uint32_t set)

Set threads used (0 = auto)

Public Types

enum class EncoderPreset

Encoder speed/quality tradeoff preset options.

Values:

enumerator NONE

No preset.

enumerator ULTRAFAST

Ultrafast preset.

enumerator SUPERFAST

Superfast preset.

enumerator VERYFAST

Very fast preset.

enumerator FASTER

Faster preset.

enumerator FAST

Fast preset.

enumerator MEDIUM

Medium preset.

enumerator SLOW

Slow preset.

enumerator SLOWER

Slower preset.

enumerator VERYSLOW
enumerator PLACEBO

Very slot preset.

enum class EncoderTune

Encoder “non-psychovisual tuning” options.

Values:

enumerator STILLIMAGE

Still image.

enumerator FASTDECODE

Fast decode.

enumerator ZEROLATENCY

Zero latency.

enum class EncoderPass

Encoding pass type.

Values:

enumerator CBR

Constant Bit Rate encoding.

enumerator QUANT

Constant Quantizer.

enumerator QUAL

Constant Quality.

enumerator PASS1

VBR Encoding - Pass 1.

enumerator PASS2

VBR Encoding - Pass 2.

enumerator PASS3

VBR Encoding - Pass 3.

Public Functions

virtual shared_not_null<Provider> makeProvider() const override

Required override to create a provider for the component

inline const Properties &properties() const

Returns a read-only reference to the properties for the object

struct Properties
#include <PxMedia/X264EncoderFeedComponent.h>

Properties required to encode video with X264.

Public Members

BitRate bitrate

Bit rate.

EncoderPreset speedPreset

Preset for speed/quality tradeoff.

EncoderTune tune

Preset for non-psychovisual tuning.

uint32_t keyIntMax

Maximum between two key-frames (0 = auto)

EncoderPass pass

Encoding pass/type.

bool byteStream

Generate byte stream format of NALU.

uint32_t threads

Threads used by the codec (0 = auto)

namespace BitRateLiterals

This namespace contains literals for BitRate values.

See the main BitRate class for more details.

namespace Literals
namespace BitRateLiterals

This namespace contains literals for BitRate values.

See the main BitRate class for more details.

namespace StreamFeedType

Define stream feed type identifiers.

Enums

enum class Enum

Enumerated constant for a stream feed type.

Values:

enumerator None

Unknown/no stream feed type.

enumerator Audio

Audio stream feed.

enumerator Camera

Camera stream feed.

enumerator Screen

Screen-share stream feed.

enumerator RemoteHand

Legacy: “remote hand” stream feed.

enumerator Monitor

Stream that monitors stream feed activity.

Functions

bool validateEnumValue(int64_t value, Enum &set)

Helper to take an untyped integer value and produce a type-safe StreamFeedType::Enum value.

Parameters:
  • value[in] Untyped integer value to attempt to convert

  • set[out] When the submitted value is valid, set this value accordingly

Returns:

true when the conversion was successful, otherwise false.

namespace VideoMediaFormat

Constants for video media formats

Enums

enum class BaseMedia : uint16_t

Base media format type.

See: https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/media-types.html#table-of-video-types

Values:

enumerator IMAGE

image (e.g. image/jpeg)

enumerator VIDEO_ENCODED

encoded video (e.g. video/mpeg)

enumerator VIDEO_XRAW

video/x-raw, which has further raw formats

enum class MediaType

Video media types

Values:

enumerator IMAGE

Image media type without explicit format.

enumerator IMAGE_JPEG

image/jpeg

enumerator VIDEO_ENCODED

encoded video media type without explicit format

enumerator VIDEO_XRAW

Video/x-raw without explicit format.

enumerator VIDEO_XRAW_I420

planar 4:2:0 YUV

enumerator VIDEO_XRAW_YV12

planar 4:2:0 YUV (I420 with U/V planes swapped)

enumerator VIDEO_XRAW_YUY2

packed 4:2:2 YUV

enumerator VIDEO_XRAW_YVYU

packed 4:2:2 YUV (YUY2 with U/V planes swapped)

enumerator VIDEO_XRAW_UYVY

packed 4:2:2 YUV

enumerator VIDEO_XRAW_AYUV

packed 4:4:4 YUV + alpha channel

enumerator VIDEO_XRAW_RGBx

sparse RGB packed into 32 bit, space last

enumerator VIDEO_XRAW_BGRx

sparse reverse RGB packed into 32 bit, space last

enumerator VIDEO_XRAW_xRGB

sparse RGB packed into 32 bit, space first

enumerator VIDEO_XRAW_xBGR

sparse reverse RGB packed into 32 bit, space first

enumerator VIDEO_XRAW_RGBA

RGB, alpha last.

enumerator VIDEO_XRAW_BGRA

reverse RGB, alpha last

enumerator VIDEO_XRAW_ARGB

RGB, alpha channel first.

enumerator VIDEO_XRAW_ABGR

reverse RGB, alpha channel first

enumerator VIDEO_XRAW_RGB

plain RGB

enumerator VIDEO_XRAW_BGR

reverse RGB

enumerator VIDEO_XRAW_Y41B

planar 4:1:1 YUV

enumerator VIDEO_XRAW_Y42B

planar 4:2:2 YUV

enumerator VIDEO_XRAW_Y444

planar 4:4:4 YUV

enumerator VIDEO_XRAW_v210

packed 4:2:2 10-bit YUV, complex format

enumerator VIDEO_XRAW_v216

packed 4:2:2 16-bit YUV, Y0-U0-Y1-V1 order

enumerator VIDEO_XRAW_NV12

planar 4:2:0 YUV with interleaved UV plane

enumerator VIDEO_XRAW_NV21

planar 4:2:0 YUV with interleaved VU plane

enumerator VIDEO_XRAW_GRAY8

8-bit grayscale

enumerator VIDEO_XRAW_GRAY16_BE

16-bit grayscale, most sig. byte first

enumerator VIDEO_XRAW_GRAY16_LE

16-bit grayscale, least sig. byte first

enumerator VIDEO_XRAW_Y16

same as “GRAY16_LE”

enumerator VIDEO_XRAW_v308

packed 4:4:4 YUV

enumerator VIDEO_XRAW_IYU2

packed 4:4:4 YUV, U-Y-V order

enumerator VIDEO_XRAW_RGB16

RGB 5-6-5 bits per component.

enumerator VIDEO_XRAW_BGR16

reverse RGB 5-6-5 bits per component

enumerator VIDEO_XRAW_RGB15

RGB 5-5-5 bits per component.

enumerator VIDEO_XRAW_BGR15

reverse RGB 5-5-5 bits per component

enumerator VIDEO_XRAW_UYVP

packed 10-bit 4:2:2 YUV

enumerator VIDEO_XRAW_A420

planar 4:4:2:0 AYUV

enumerator VIDEO_XRAW_RGB8P

8-bit paletted RGB

enumerator VIDEO_XRAW_YUV9

planar 4:1:0 YUV

enumerator VIDEO_XRAW_YVU9

planar 4:1:0 YUV (YUV9 but UV planes swapped)

enumerator VIDEO_XRAW_IYU1

packed 4:1:1 YUV (Cb-Y0-Y1-Cr-Y2-Y3 …)

enumerator VIDEO_XRAW_ARGB64

RGB, alpha first, 16 bits/channel, native endian

enumerator VIDEO_XRAW_AYUV64

Packed 4:4:4 YUV + alpha, 16 bits/ch., native endian.

enumerator VIDEO_XRAW_r210

packed 4:4:4 RGB, 10 bits/channel

enumerator VIDEO_XRAW_I420_10LE

planar 4:2:0 YUV, 10 bits/channel LE

enumerator VIDEO_XRAW_I420_10BE

planar 4:2:0 YUV, 10 bits/channel BE

enumerator VIDEO_XRAW_I422_10LE

planar 4:2:2 YUV, 10 bits/channel LE

enumerator VIDEO_XRAW_I422_10BE

planar 4:2:2 YUV, 10 bits/channel BE

enumerator VIDEO_XRAW_Y444_10BE

planar 4:4:4 YUV, 10 bits/channel

enumerator VIDEO_XRAW_Y444_10LE

planar 4:4:4 YUV, 10 bits/channel

enumerator VIDEO_XRAW_GBR

planar 4:4:4 RGB, 8 bits/channel

enumerator VIDEO_XRAW_GBR_10BE

planar 4:4:4 RGB, 10 bits/channel

enumerator VIDEO_XRAW_GBR_10LE

planar 4:4:4 RGB, 10 bits/channel

enumerator VIDEO_XRAW_RGBP
enumerator VIDEO_XRAW_BGRP

planar 4:4:4 RGB, R-G-B order, 8 bits/channel

enumerator VIDEO_XRAW_RGBA64_LE

planar 4:4:4 RGB, B-G-R order, 8 bits/channel

enumerator VIDEO_XRAW_RGBA64_BE

RGB, alpha last, 16 bits/channel, LE

enumerator VIDEO_XRAW_BGRA64_LE

RGB, alpha last, 16 bits/channel, BE

enumerator VIDEO_XRAW_BGRA64_BE

reverse RGB, alpha last, 16 bits/channel, LE

enumerator VIDEO_XRAW_ARGB64_LE

reverse RGB, alpha last, 16 bits/channel, BE

enumerator VIDEO_XRAW_ARGB64_BE

RGB, alpha first, 16 bits/channel, LE

enumerator VIDEO_XRAW_ABGR64_LE

RGB, alpha first, 16 bits/channel, BE

enumerator VIDEO_XRAW_ABGR64_BE

reverse RGB, alpha first, 16 bits/channel, LE

enumerator VIDEO_XRAW_NV16

reverse RGB, alpha first, 16 bits/channel, BE

planar 4:2:2 YUV with interleaved UV plane

enumerator VIDEO_XRAW_NV61

planar 4:2:2 YUV with interleaved VU plane

enumerator VIDEO_XRAW_NV24

planar 4:4:4 YUV with interleaved UV plane

enumerator VIDEO_XRAW_NV12_64Z32

planar 4:2:0 YUV, interleaved UV plane in 64x32 tiles zigzag

enumerator VIDEO_XRAW_P012_LE

4:2:0 YUV with interleaved UV plane, 2 bytes per channel, color stored in MSB 12 bits, LE

enumerator VIDEO_XRAW_P012_BE

4:2:0 YUV with interleaved UV plane, 2 bytes per channel, color stored in MSB 12 bits, BE

enumerator VIDEO_XRAW_Y212_LE

packed 4:2:2 YUV, 2 bytes per channel, color stored in MSB 12 bits (Y-U-Y-V), LE

enumerator VIDEO_XRAW_Y212_BE

packed 4:2:2 YUV, 2 bytes per channel, color stored in MSB 12 bits (Y-U-Y-V), BE

enumerator VIDEO_XRAW_Y412_LE

packed 4:4:4:4 AYUV, 2 bytes per channel, color stored in MSB 12 bits (U-Y-V-A), LE

enumerator VIDEO_XRAW_Y412_BE

packed 4:4:4:4 AYUV, 2 bytes per channel, color stored in MSB 12 bits (U-Y-V-A), BE