Fork me on GitHub
Loading...
Searching...
No Matches
rtpfwd.h
Go to the documentation of this file.
1
16#ifndef JANUS_RTPFWD_H
17#define JANUS_RTPFWD_H
18
19#include "rtp.h"
20#include "rtpsrtp.h"
21
22
28
30typedef struct janus_rtp_forwarder {
31 /* \brief Opaque pointer to the owner of this forwarder */
32 void *source;
33 /* \brief Context of the forwarder */
34 char *context;
35 /* \brief Unique ID (within the context) of the forwarder */
36 uint32_t stream_id;
37 /* \brief Socket used for sending RTP packets */
38 int udp_fd;
39 /* \brief Whether this is a video forwarder */
40 gboolean is_video;
41 /* \brief Whether this is an audio forwarder */
42 gboolean is_data;
43 /* \brief SSRC to put in forwarded RTP packets */
44 uint32_t ssrc;
45 /* \brief Payload type to put in forwarded RTP packets */
47 /* \brief Substream to forward, in case this is part of a simulcast stream */
49 /* \brief Recipient address (IPv4) */
50 struct sockaddr_in serv_addr;
51 /* \brief Recipient address (IPv6) */
52 struct sockaddr_in6 serv_addr6;
53 /* \brief RTCP socket, if needed */
55 /* \brief RTCP local and remote ports, if needed */
57 /* \brief Callback to invoke when receiving RTCP messages, if any */
58 void (*rtcp_callback)(struct janus_rtp_forwarder *rf, char *buffer, int len);
59 /* \brief RTCP GSource, if needed */
60 GSource *rtcp_recv;
61 /* \brief Whether simulcast automatic selection is enabled for this forwarder */
62 gboolean simulcast;
63 /* \brief RTP switching context, if needed */
65 /* \brief Simulcast context, if needed */
67 /* \brief Whether SRTP is enabled for this forwarder */
68 gboolean is_srtp;
69 /* \brief The SRTP context, in case SRTP is enabled */
70 srtp_t srtp_ctx;
71 /* \brief The SRTP policy, in case SRTP is enabled */
72 srtp_policy_t srtp_policy;
73 /* \brief Opaque metadata property, in case it's useful to the owner
74 * \note This can be anything (e.g., a string, an allocated struct, etc.),
75 * as long as it can be freed with a single call to g_free(), as
76 * that's all that will be done when getting rid of the forwarder */
77 void *metadata;
79 volatile gint destroyed;
101 uint32_t stream_id, int udp_fd, const char *host, int port,
102 uint32_t ssrc, int pt, int srtp_suite, const char *srtp_crypto,
103 gboolean simulcast, int substream, gboolean is_video, gboolean is_data);
112 void (*rtcp_callback)(janus_rtp_forwarder *rf, char *buffer, int len));
121void janus_rtp_forwarder_send_rtp(janus_rtp_forwarder *rf, char *buffer, int len, int substream);
133void janus_rtp_forwarder_send_rtp_full(janus_rtp_forwarder *rf, char *buffer, int len, int substream,
134 uint32_t *ssrcs, char **rids, janus_videocodec vcodec, janus_mutex *rid_mutex);
138
139#endif
GMutex janus_mutex
Janus mutex implementation.
Definition mutex.h:73
RTP processing (headers)
janus_videocodec
Definition rtp.h:136
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.
Definition rtpfwd.c:247
void janus_rtp_forwarder_destroy(janus_rtp_forwarder *rf)
Helper method to free a janus_rtp_forwarder instance.
Definition rtpfwd.c:410
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.
Definition rtpfwd.c:333
void janus_rtp_forwarders_deinit(void)
RTP forwarders code de-initialization.
Definition rtpfwd.c:80
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.
Definition rtpfwd.c:146
struct janus_rtp_forwarder janus_rtp_forwarder
Helper struct for implementing RTP forwarders.
int janus_rtp_forwarders_init(void)
RTP forwarders code initialization.
Definition rtpfwd.c:44
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 ...
Definition rtpfwd.c:338
SRTP definitions (headers)
Definition refcount.h:78
Helper struct for implementing RTP forwarders.
Definition rtpfwd.h:30
int substream
Definition rtpfwd.h:48
uint16_t local_rtcp_port
Definition rtpfwd.h:56
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition rtpfwd.h:79
struct sockaddr_in serv_addr
Definition rtpfwd.h:50
char * context
Definition rtpfwd.h:34
GSource * rtcp_recv
Definition rtpfwd.h:60
gboolean is_video
Definition rtpfwd.h:40
gboolean is_srtp
Definition rtpfwd.h:68
void * metadata
Definition rtpfwd.h:77
int udp_fd
Definition rtpfwd.h:38
uint16_t remote_rtcp_port
Definition rtpfwd.h:56
srtp_t srtp_ctx
Definition rtpfwd.h:70
janus_rtp_switching_context rtp_context
Definition rtpfwd.h:64
int rtcp_fd
Definition rtpfwd.h:54
uint32_t stream_id
Definition rtpfwd.h:36
struct sockaddr_in6 serv_addr6
Definition rtpfwd.h:52
void * source
Definition rtpfwd.h:32
void(* rtcp_callback)(struct janus_rtp_forwarder *rf, char *buffer, int len)
Definition rtpfwd.h:58
gboolean is_data
Definition rtpfwd.h:42
uint32_t ssrc
Definition rtpfwd.h:44
srtp_policy_t srtp_policy
Definition rtpfwd.h:72
janus_refcount ref
Reference counter for this instance.
Definition rtpfwd.h:81
int payload_type
Definition rtpfwd.h:46
janus_rtp_simulcasting_context sim_context
Definition rtpfwd.h:66
gboolean simulcast
Definition rtpfwd.h:62
Helper struct for processing and tracking simulcast streams.
Definition rtp.h:385
RTP context, in order to make sure SSRC changes result in coherent seq/ts increases.
Definition rtp.h:295