Fork me on GitHub
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
rtpfwd.h File Reference

RTP forwarders (headers) More...

#include "rtp.h"
#include "rtpsrtp.h"
Include dependency graph for rtpfwd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  janus_rtp_forwarder
 Helper struct for implementing RTP forwarders. More...
 

Typedefs

typedef struct janus_rtp_forwarder janus_rtp_forwarder
 Helper struct for implementing RTP forwarders.
 

Functions

int janus_rtp_forwarders_init (void)
 
void janus_rtp_forwarders_deinit (void)
 
janus_rtp_forwarderjanus_rtp_forwarder_create (const char *ctx, uint32_t stream_id, int udp_fd, const char *host, int port, uint32_t ssrc, int pt, int srtp_suite, const char *srtp_crypto, gboolean simulcast, int substream, gboolean is_video, gboolean is_data)
 Helper method to create a new janus_rtp_forwarder instance.
 
int janus_rtp_forwarder_add_rtcp (janus_rtp_forwarder *rf, int rtcp_port, void(*rtcp_callback)(janus_rtp_forwarder *rf, char *buffer, int len))
 Helper method to add RTCP support to an existing forwarder.
 
void janus_rtp_forwarder_send_rtp (janus_rtp_forwarder *rf, char *buffer, int len, int substream)
 Helper method to forward an RTP packet within the context of a forwarder.
 
void janus_rtp_forwarder_send_rtp_full (janus_rtp_forwarder *rf, char *buffer, int len, int substream, uint32_t *ssrcs, char **rids, janus_videocodec vcodec, janus_mutex *rid_mutex)
 Extended version of janus_rtp_forwarder_send_rtp, to be used when the forwarder is configured to act as a simulcast receiver, and so will call janus_rtp_simulcasting_context_process_rtp.
 
void janus_rtp_forwarder_destroy (janus_rtp_forwarder *rf)
 Helper method to free a janus_rtp_forwarder instance.
 

Detailed Description

RTP forwarders (headers)

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Implementation of the so called RTP forwarders, that is an helper mechanism that core and/or plugins can make use of to quickly and simply forward RTP streams to a separate UDP address out of the context of any signalling. Such a mechanism can be used, for instance, for scalabiloty purposes, monitoring, or feeding external applications with media traffic handled by Janus..

Protocols

Typedef Documentation

◆ janus_rtp_forwarder

Helper struct for implementing RTP forwarders.

Function Documentation

◆ janus_rtp_forwarder_add_rtcp()

int janus_rtp_forwarder_add_rtcp ( janus_rtp_forwarder rf,
int  rtcp_port,
void(*)(janus_rtp_forwarder *rf, char *buffer, int len)  rtcp_callback 
)

Helper method to add RTCP support to an existing forwarder.

Note
Notice that only a single RTCP handler can be added to a forwarder, and once added it cannot be removed until the forwarder is destroyed
Parameters
[in]rfThe janus_rtp_forwarder instance to add RTCP to
[in]rtcp_portThe port to latch to for RTCP purposes
[in]rtcp_callbackThe function to invoke when RTCP feedback is received
Returns
0 if successful, a negative integer otherwise

◆ janus_rtp_forwarder_create()

janus_rtp_forwarder * janus_rtp_forwarder_create ( const char *  ctx,
uint32_t  stream_id,
int  udp_fd,
const char *  host,
int  port,
uint32_t  ssrc,
int  pt,
int  srtp_suite,
const char *  srtp_crypto,
gboolean  simulcast,
int  substream,
gboolean  is_video,
gboolean  is_data 
)

Helper method to create a new janus_rtp_forwarder instance.

Parameters
[in]ctxThe context of this forwarder (e.g., the plugin name)
[in]idThe unique forwarder ID to assign as part of the context (0=autogenerate)
[in]udp_fdThe socket to use for sending RTP packets
[in]hostThe address to forward the RTP packets to
[in]portThe port to forward the RTP packets to
[in]ssrcThe SSRC to put in outgoing RTP packets
[in]ptThe payload type to put in outgoing RTP packets
[in]srtp_suiteIn case SRTP must be enabled, the SRTP suite to use
[in]srtp_cryptoIn case SRTP must be enabled, the base64-encoded SRTP crypto material to use
[in]simulcastWhether the RTP forwarder should act as a simulcast viewer (meaning it will only forward the highest quality available substream)
[in]substreamIn case we want to forward a specific simulcast substream, which substream it is
Note
Do NOT mix the simulcast and substream properties, as they implement different behaviours
Parameters
[in]is_videoWhether this a video forwarder
[in]is_dataWhether this a data channel forwarder
Returns
A pointer to a valid janus_rtp_forwarder instance, if successfull, NULL otherwise

◆ janus_rtp_forwarder_destroy()

void janus_rtp_forwarder_destroy ( janus_rtp_forwarder rf)

Helper method to free a janus_rtp_forwarder instance.

Parameters
[in]rfThe janus_rtp_forwarder instance to free

◆ janus_rtp_forwarder_send_rtp()

void janus_rtp_forwarder_send_rtp ( janus_rtp_forwarder rf,
char *  buffer,
int  len,
int  substream 
)

Helper method to forward an RTP packet within the context of a forwarder.

Note
This is equivalent to calling janus_rtp_forwarder_send_rtp_full with all the extra arguments that are usually not required set to NULL
Parameters
[in]rfThe janus_rtp_forwarder instance to use
[in]bufferThe RTP packet buffer
[in]lenThe length of the RTP packet buffer
[in]substreamIn case the forwarder is relaying a single simulcast substream, the substream the packet belongs to (pass -1 to ignore)

◆ janus_rtp_forwarder_send_rtp_full()

void janus_rtp_forwarder_send_rtp_full ( janus_rtp_forwarder rf,
char *  buffer,
int  len,
int  substream,
uint32_t *  ssrcs,
char **  rids,
janus_videocodec  vcodec,
janus_mutex rid_mutex 
)

Extended version of janus_rtp_forwarder_send_rtp, to be used when the forwarder is configured to act as a simulcast receiver, and so will call janus_rtp_simulcasting_context_process_rtp.

Parameters
[in]rfThe janus_rtp_forwarder instance to use
[in]bufferThe RTP packet buffer
[in]lenThe length of the RTP packet buffer
[in]substreamIn case the forwarder is relaying a single simulcast substream, the substream the packet belongs to (pass -1 to ignore)
[in]ssrcsThe simulcast SSRCs to refer to (may be updated if rids are involved)
[in]ridsThe simulcast rids to refer to, if any
[in]vcodecVideo codec of the RTP payload
[in]rid_mutexA mutex that must be acquired before reading the rids array, if any

◆ janus_rtp_forwarders_deinit()

void janus_rtp_forwarders_deinit ( void  )

◆ janus_rtp_forwarders_init()

int janus_rtp_forwarders_init ( void  )