This is a C++ (11) implementation of the Secure Real-Time Media Flow Protocol (RTMFP) as described in RFC 7016.
The library includes sample Platform Adapters and other utilities, such as a
simple select()
based run loop, but these are not required to be used. The
protocol implementation is intended to be adaptable to any host program
environment.
The library is intended for clients, servers, and P2P applications. It includes the necessary helpers and callback hooks to support P2P introduction and load balancing.
The test
directory includes unit tests and examples. Of special
note are tcserver
, a simple RTMFP and RTMP live media
server; tcrelay
, an RTMFP ↔︎ RTMP relay/proxy; and
redirector
, a simple load balancer.
The most complete API documentation is currently in the
rtmfp.hpp
header file.
An application will instantiate an IPlatformAdapter
and an ICryptoAdapter
,
then a com::zenomt::rtmfp::RTMFP
(which requires these adapters). Typically
the platform adapter will need to be told of the new RTMFP
instance so it
can invoke the instance’s platform methods (such as howLongToSleep()
and
onReceivePacket()
).
The platform will add at least one interface by calling RTMFP::addInterface()
.
The application can open sending flows to new or current endpoints with
RTMFP::openFlow()
and Flow::openFlow
, and can open associated return flows
with RecvFlow::openReturnFlow()
.
The application can accept new flows by setting the onRecvFlow
callbacks
on the RTMFP
(for bare incoming flows) or on SendFlow
s (for associated
return flows).
The application can send messages to far peers with SendFlow::write()
, and
receive messages from far peers by setting the onMessage
callback on
RecvFlow
s. Messages can expire and be abandoned if not started or delivered
by per-message deadlines, or by arbitrary application logic using the
WriteReceipt
s returned by SendFlow::write()
.
The application can be notified by callback when a message is delivered or
abandoned.
SendFlow
s set to priority/precedence PRI_PRIORITY
,
PRI_IMMEDIATE
, PRI_FLASH
, or