1.3.6. Media feeds and sessions

About feeds

The Proximie SDK has a number of different ways to share and process audio and video media. This section provides an overview of the media feed and session classes available in the SDK.

Both audio and video are handled using “feed” objects. When feeds are used to send or receive media with another participating service or application, they are associated with a “session”.

There are three of categories of feed:

  • Media server feeds, which are used to send and receive media to and from the Proximie media services. For more information on media server feeds, see the Media Server Session section.

  • Peer feeds, which are used to communicate directly between two peers on the same network. For more information on peer feed, see the Peer Streaming section.

  • Utility feeds, which are used to process or modify audio and video locally. Form more information on utility feeds, see the Utility Feeds section.

Feed classes

All feeds have a common base class PxMedia::FeedBase, which has a standard set of operations to get details about the feed, and to start and stop the feed streaming.

Feeds are always created as shared pointers (i.e. std::shared_ptr) using a static factory method create for the concrete feed class being instantiated.

Feeds can have additional interfaces for specialised functionality, which are obtained using an accessor function on the feed - e.g. an application would call mediaServerFeed() on a MediaServerFeed feed object to get the unique media server feed interface.

We use this approach rather than inheritance as certain interfaces (now or in future) may be shared between feeds with different inheritance hierarchies - for example, an audio interface may appear on any type of feed, media session, peer or utility.

For more information on using these different feed types see the following sections:

Feed lifetimes

As mentioned above, feed objects are always created as shared pointers. Initially the application has the only reference to the feed, and disposing of the shared pointer will free the object.

For feeds that belong to a session (media server session or peer session), the session also takes ownership of any feed that has been started (namely using startFeed()). When the feed is stopped (e.g. using startFeed()) any owning session will release its reference to the feed. Consequently, feed objects that are playing in a session will continue to live even if the application disposes of it’s shared pointer reference. Only one both the application and the session have released their references to the feed will the feed object be destroyed.

When a session is closed, all feeds that belong to the session are stopped and released from the session. If the application has a feed reference at this point, it remains alive but is no longer associated with the session and will report itself as stopped.