Loading...
Searching...
No Matches
rtpfwd.h File Reference
Core » Protocols

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)
| RTP forwarders code initialization.
void | janus_rtp_forwarders_deinit (void)
| RTP forwarders code de-initialization.
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.
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

Copyright
  GNU General Public License v3

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

typedef struct janus_rtp_forwarder 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(* | rtcp_callback )(janus_rtp_forwarder *rf, char *buffer, int len) )

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] | rf | The janus_rtp_forwarder instance to add RTCP to
  [in] | rtcp_port | The port to latch to for RTCP purposes
  [in] | rtcp_callback | The 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] | ctx | The context of this forwarder (e.g., the plugin name)
  [in] | stream_id | The unique forwarder ID to assign as part of the context (0=autogenerate)
  [in] | udp_fd | The socket to use for sending RTP packets
  [in] | host | The address to forward the RTP packets to
  [in] | port | The port to forward the RTP packets to
  [in] | ssrc | The SSRC to put in outgoing RTP packets
  [in] | pt | The payload type to put in outgoing RTP packets
  [in] | srtp_suite | In case SRTP must be enabled, the SRTP suite to use
  [in] | srtp_crypto | In case SRTP must be enabled, the base64-encoded SRTP crypto material to use
  [in] | simulcast | Whether the RTP forwarder should act as a simulcast viewer (meaning it will only forward the highest quality available substream)
  [in] | substream | In 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_video | Whether this a video forwarder
  [in] | is_data | Whether this a data channel forwarder

Returns
  A pointer to a valid janus_rtp_forwarder instance, if successful, 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] | rf | The 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] | rf | The janus_rtp_forwarder instance to use
  [in] | buffer | The RTP packet buffer
  [in] | len | The length of the RTP packet buffer
  [in] | substream | In 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] | rf | The janus_rtp_forwarder instance to use
  [in] | buffer | The RTP packet buffer
  [in] | len | The length of the RTP packet buffer
  [in] | substream | In case the forwarder is relaying a single simulcast substream, the substream the packet belongs to (pass -1 to ignore)
  [in] | ssrcs | The simulcast SSRCs to refer to (may be updated if rids are involved)
  [in] | rids | The simulcast rids to refer to, if any
  [in] | vcodec | Video codec of the RTP payload
  [in] | rid_mutex | A mutex that must be acquired before reading the rids array, if any

## janus_rtp_forwarders_deinit()

void janus_rtp_forwarders_deinit | ( | void |  | ) |

RTP forwarders code de-initialization.

## janus_rtp_forwarders_init()

int janus_rtp_forwarders_init | ( | void |  | ) |

RTP forwarders code initialization.

Returns
  0 in case of success, a negative integer on errors