Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Route packets to packet writers. More...
#include <router.h>
Public Member Functions | |
Router (core::IArena &arena) | |
Initialize. More... | |
ROC_ATTR_NODISCARD bool | add_route (IWriter &writer, unsigned flags) |
Add route. More... | |
bool | has_source_id (unsigned flags) |
Check if there is detected source id for given route. More... | |
stream_source_t | get_source_id (unsigned flags) |
Get detected source id for given route. More... | |
virtual ROC_ATTR_NODISCARD status::StatusCode | write (const PacketPtr &packet) |
Write next packet. More... | |
Route packets to packet writers.
To create a route, user provides packet writer and packet flags. Packets that include specified flags will be routed to given writer.
When the very first packet is routed to a writer, router remembers which source id (SSRC) that packet has, or that the packet doesn't have any source id. Then router ensures that only packets with that source id are passed to same writer.
The user can query which source id were detected for which routes.
roc::packet::Router::Router | ( | core::IArena & | arena | ) |
Initialize.
ROC_ATTR_NODISCARD bool roc::packet::Router::add_route | ( | IWriter & | writer, |
unsigned | flags | ||
) |
Add route.
flags
set will be routed to writer
. stream_source_t roc::packet::Router::get_source_id | ( | unsigned | flags | ) |
Get detected source id for given route.
bool roc::packet::Router::has_source_id | ( | unsigned | flags | ) |
Check if there is detected source id for given route.
|
virtual |
Write next packet.
packet
to a writer or drop it if no routes found. Implements roc::packet::IWriter.