Fork me on GitHub
Loading...
Searching...
No Matches
ice.h
Go to the documentation of this file.
1
21#ifndef JANUS_ICE_H
22#define JANUS_ICE_H
23
24#include <glib.h>
25#include <agent.h>
26
27#include "sdp.h"
28#include "dtls.h"
29#include "sctp.h"
30#include "rtcp.h"
31#include "text2pcap.h"
32#include "utils.h"
33#include "ip-utils.h"
34#include "refcount.h"
35#include "plugins/plugin.h"
36
37
47void janus_ice_init(gboolean ice_lite, gboolean ice_tcp, gboolean full_trickle, gboolean ignore_mdns,
48 gboolean ipv6, gboolean ipv6_linklocal, uint16_t rtp_min_port, uint16_t rtp_max_port);
50void janus_ice_deinit(void);
58int janus_ice_test_stun_server(janus_network_address *addr, uint16_t port, uint16_t local_port, janus_network_address *public_addr, uint16_t *public_port);
63int janus_ice_set_stun_server(gchar *stun_server, uint16_t stun_port);
71int janus_ice_set_turn_server(gchar *turn_server, uint16_t turn_port, gchar *turn_type, gchar *turn_user, gchar *turn_pwd);
80int janus_ice_set_turn_rest_api(gchar *api_server, gchar *api_key, gchar *api_method, uint api_timeout);
86uint16_t janus_ice_get_stun_port(void);
92uint16_t janus_ice_get_turn_port(void);
103void janus_ice_enable_nat_1_1(gboolean keep_private_host);
110void janus_ice_enforce_interface(const char *ip);
114gboolean janus_ice_is_enforced(const char *ip);
122void janus_ice_ignore_interface(const char *ip);
126gboolean janus_ice_is_ignored(const char *ip);
129gboolean janus_ice_is_ice_lite_enabled(void);
132gboolean janus_ice_is_ice_tcp_enabled(void);
138gboolean janus_ice_is_mdns_enabled(void);
141gboolean janus_ice_is_ipv6_enabled(void);
146#ifdef HAVE_ICE_NOMINATION
149void janus_ice_set_nomination_mode(const char *nomination);
152const char *janus_ice_get_nomination_mode(void);
153#endif
159void janus_ice_set_consent_freshness_enabled(gboolean enabled);
167void janus_ice_set_keepalive_conncheck_enabled(gboolean enabled);
173void janus_ice_set_hangup_on_failed_enabled(gboolean enabled);
179void janus_set_min_nack_queue(uint16_t mnq);
182uint16_t janus_get_min_nack_queue(void);
189void janus_set_nack_optimizations_enabled(gboolean optimize);
195void janus_set_no_media_timer(uint timer);
198uint janus_get_no_media_timer(void);
201void janus_set_slowlink_threshold(uint packets);
207void janus_set_twcc_period(uint period);
210uint janus_get_twcc_period(void);
213void janus_set_dscp(int dscp);
216int janus_get_dscp(void);
219void janus_ice_set_event_stats_period(int period);
226
229void janus_ice_event_set_combine_media_stats(gboolean combine_media_stats_to_one_event);
233
246
247
251const gchar *janus_get_ice_state_name(gint state);
252
253
262
263#define JANUS_ICE_HANDLE_WEBRTC_PROCESSING_OFFER (1 << 0)
264#define JANUS_ICE_HANDLE_WEBRTC_START (1 << 1)
265#define JANUS_ICE_HANDLE_WEBRTC_READY (1 << 2)
266#define JANUS_ICE_HANDLE_WEBRTC_STOP (1 << 3)
267#define JANUS_ICE_HANDLE_WEBRTC_ALERT (1 << 4)
268#define JANUS_ICE_HANDLE_WEBRTC_NEGOTIATED (1 << 5)
269#define JANUS_ICE_HANDLE_WEBRTC_TRICKLE (1 << 7)
270#define JANUS_ICE_HANDLE_WEBRTC_ALL_TRICKLES (1 << 8)
271#define JANUS_ICE_HANDLE_WEBRTC_TRICKLE_SYNCED (1 << 9)
272#define JANUS_ICE_HANDLE_WEBRTC_DATA_CHANNELS (1 << 10)
273#define JANUS_ICE_HANDLE_WEBRTC_CLEANING (1 << 11)
274#define JANUS_ICE_HANDLE_WEBRTC_HAS_AUDIO (1 << 12)
275#define JANUS_ICE_HANDLE_WEBRTC_HAS_VIDEO (1 << 13)
276#define JANUS_ICE_HANDLE_WEBRTC_GOT_OFFER (1 << 14)
277#define JANUS_ICE_HANDLE_WEBRTC_GOT_ANSWER (1 << 15)
278#define JANUS_ICE_HANDLE_WEBRTC_HAS_AGENT (1 << 16)
279#define JANUS_ICE_HANDLE_WEBRTC_ICE_RESTART (1 << 17)
280#define JANUS_ICE_HANDLE_WEBRTC_RESEND_TRICKLES (1 << 18)
281#define JANUS_ICE_HANDLE_WEBRTC_RFC4588_RTX (1 << 19)
282#define JANUS_ICE_HANDLE_WEBRTC_NEW_DATACHAN_SDP (1 << 20)
283#define JANUS_ICE_HANDLE_WEBRTC_E2EE (1 << 21)
284
285
287typedef enum janus_media_type {
296const char *janus_media_type_str(janus_media_type type);
297
300typedef struct janus_ice_stats_info {
302 guint32 packets;
304 guint64 bytes;
308 gint64 updated;
312 guint32 nacks;
314
317typedef struct janus_ice_stats {
323
327void janus_ice_notify_hangup(janus_ice_handle *handle, const char *reason);
328
329
334
335
337typedef struct janus_seq_info {
338 gint64 ts;
339 guint16 seq;
340 guint16 state;
345enum {
351
352
356 void *session;
358 guint64 handle_id;
362 char *token;
364 gint64 created;
366 void *app;
372 gint cdone;
374 GMainContext *mainctx;
376 GMainLoop *mainloop;
380 GThread *thread;
384 NiceAgent *agent;
390 gboolean controlling;
392 gchar *pc_mid;
400 gchar *local_sdp;
404 const gchar *hangup_reason;
408 GAsyncQueue *queued_candidates;
410 GAsyncQueue *queued_packets;
418 volatile gint dump_packets;
424 volatile gint has_pc;
426 volatile gint closepc;
428 volatile gint destroyed;
431};
432
442 gint cdone:1;
444 guint state;
446 gint64 gathered;
448 gint64 connected;
450 GSList *candidates;
500 uint32_t remb_bitrate;
510 gchar *ruser;
512 gchar *rpass;
514 GHashTable *media;
516 GHashTable *media_byssrc;
518 GHashTable *media_bymid;
523 GHashTable *media_bytype;
525 GHashTable *payload_types;
527 GHashTable *clock_rates;
529 GHashTable *rtx_payload_types;
533 gboolean noerrorlog;
537 volatile gint destroyed;
540};
541
542#define LAST_SEQS_MAX_LEN 160
552 char *mid;
556 guint32 ssrc;
558 guint32 ssrc_rtx;
564 char *rid[3];
566 gboolean disabled_rid[3];
568 gboolean rids_hml;
570 gboolean legacy_rid;
578 GHashTable *rtx_payload_types;
580 GHashTable *clock_rates;
584 char *codec;
586 gboolean (* video_is_keyframe)(const char* buffer, int len);
588 gboolean send, recv;
594 GHashTable *rtx_nacked[3];
598 gint64 first_ntp_ts[3];
600 guint32 first_rtp_ts[3];
604 guint32 last_rtp_ts;
606 gboolean do_nacks;
610 GHashTable *retransmit_seqs;
628 gboolean noerrorlog;
632 volatile gint destroyed;
635};
642
648 gint64 received;
653};
654
658
662janus_ice_trickle *janus_ice_trickle_new(const char *transaction, json_t *candidate);
668gint janus_ice_trickle_parse(janus_ice_handle *handle, json_t *candidate, const char **error);
673
674
678
683janus_ice_handle *janus_ice_handle_create(void *core_session, const char *opaque_id, const char *token);
692gint janus_ice_handle_attach_plugin(void *core_session, janus_ice_handle *handle, janus_plugin *plugin, int loop_index);
697gint janus_ice_handle_destroy(void *core_session, janus_ice_handle *handle);
701void janus_ice_webrtc_hangup(janus_ice_handle *handle, const char *reason);
706
707
711
729void janus_ice_send_pli_stream(janus_ice_handle *handle, int mindex);
733void janus_ice_send_remb(janus_ice_handle *handle, uint32_t bitrate);
741void janus_ice_incoming_data(janus_ice_handle *handle, char *label, char *protocol, gboolean textdata, char *buffer, int length);
746void janus_ice_relay_sctp(janus_ice_handle *handle, char *buffer, int length);
754
755
759
765int janus_ice_setup_local(janus_ice_handle *handle, gboolean offer, gboolean trickle, janus_dtls_role dtls_role);
771void janus_ice_candidates_to_sdp(janus_ice_handle *handle, janus_sdp_mline *mline, guint stream_id, guint component_id);
775void janus_ice_add_remote_candidate(janus_ice_handle *handle, NiceCandidate *c);
780void janus_ice_setup_remote_candidates(janus_ice_handle *handle, guint stream_id, guint component_id);
792
793
799void janus_ice_set_static_event_loops(int loops, gboolean allow_api);
813
814#endif
DTLS/SRTP processing (headers)
janus_dtls_role
DTLS roles.
Definition: dtls.h:51
@ SEQ_MISSING
Definition: ice.h:346
@ SEQ_GIVEUP
Definition: ice.h:348
@ SEQ_RECVED
Definition: ice.h:349
@ SEQ_NACKED
Definition: ice.h:347
void janus_ice_add_remote_candidate(janus_ice_handle *handle, NiceCandidate *c)
Method to queue a remote candidate for processing.
Definition: ice.c:3519
janus_media_type
Janus media types.
Definition: ice.h:287
@ JANUS_MEDIA_UNKNOWN
Definition: ice.h:288
@ JANUS_MEDIA_DATA
Definition: ice.h:291
@ JANUS_MEDIA_VIDEO
Definition: ice.h:290
@ JANUS_MEDIA_AUDIO
Definition: ice.h:289
void janus_ice_set_keepalive_conncheck_enabled(gboolean enabled)
Method to enable/disable connectivity checks as keepalives for PeerConnections.
Definition: ice.c:164
gint janus_ice_handle_attach_plugin(void *core_session, janus_ice_handle *handle, janus_plugin *plugin, int loop_index)
Method to attach a Janus ICE handle to a plugin.
Definition: ice.c:1419
void janus_ice_peerconnection_destroy(janus_ice_peerconnection *pc)
Method to only free resources related to a specific Webrtc PeerConnection allocated by a Janus ICE ha...
Definition: ice.c:1763
void janus_ice_webrtc_hangup(janus_ice_handle *handle, const char *reason)
Method to only hangup (e.g., DTLS alert) the WebRTC PeerConnection allocated by a Janus ICE handle.
Definition: ice.c:1654
uint16_t janus_get_min_nack_queue(void)
Method to get the current min NACK value (i.e., the minimum time window of packets per handle to stor...
Definition: ice.c:697
char * janus_ice_get_turn_rest_api(void)
Method to get the specified TURN REST API backend, if any.
Definition: ice.c:69
void janus_ice_set_static_event_loops(int loops, gboolean allow_api)
Method to configure the static event loops mechanism at startup.
Definition: ice.c:248
uint16_t janus_ice_get_turn_port(void)
Method to get the TURN server port.
Definition: ice.c:63
void janus_ice_send_pli_stream(janus_ice_handle *handle, int mindex)
Helper core callback, called when a plugin wants to send a RTCP PLI to a single video stream of a pee...
Definition: ice.c:5150
void janus_set_twcc_period(uint period)
Method to modify the TWCC feedback period (i.e., how often TWCC feedback is sent back to media sender...
Definition: ice.c:624
void janus_set_slowlink_threshold(uint packets)
Method to modify the slowlink-threshold property (i.e., the number of lost packets per seconds that s...
Definition: ice.c:610
void janus_ice_set_event_stats_period(int period)
Method to modify the event handler statistics period (i.e., the number of seconds that should pass be...
Definition: ice.c:417
void janus_ice_send_remb(janus_ice_handle *handle, uint32_t bitrate)
Helper core callback, called when a plugin wants to send a RTCP REMB to a peer.
Definition: ice.c:5159
gboolean janus_ice_is_ipv6_linklocal_enabled(void)
Method to check whether IPv6 link-local candidates will be gathered or not.
Definition: ice.c:117
void janus_enable_opaqueid_in_api(void)
Method to enable opaque ID in Janus API responses/events.
Definition: ice.c:194
gboolean janus_ice_event_get_combine_media_stats(void)
Method to retrieve wether media statistic events shall be dispatched combined or in single events.
Definition: ice.c:429
const gchar * janus_get_ice_state_name(gint state)
Helper method to get a string representation of a libnice ICE state.
Definition: ice.c:1355
gint janus_ice_trickle_parse(janus_ice_handle *handle, json_t *candidate, const char **error)
Helper method to parse trickle candidates.
Definition: ice.c:961
gboolean janus_is_nack_optimizations_enabled(void)
Method to check whether NACK optimizations on outgoing keyframes are enabled or not.
Definition: ice.c:685
gboolean janus_ice_is_enforced(const char *ip)
Method to check whether an interface is currently in the enforce list for ICE (that is,...
Definition: ice.c:369
const char * janus_media_type_str(janus_media_type type)
Helper method to get the string associated to a janus_media_mtype value.
Definition: ice.c:510
void janus_ice_notify_hangup(janus_ice_handle *handle, const char *reason)
Quick helper method to notify a WebRTC hangup through the Janus API.
Definition: ice.c:918
void janus_ice_stop_static_event_loops(void)
Method to stop all the static event loops, if enabled.
Definition: ice.c:305
char * janus_ice_get_stun_server(void)
Method to get the STUN server IP address.
Definition: ice.c:46
int janus_ice_get_event_stats_period(void)
Method to get the current event handler statistics period (see above)
Definition: ice.c:420
void janus_ice_relay_rtcp(janus_ice_handle *handle, janus_plugin_rtcp *packet)
Core RTCP callback, called when a plugin has an RTCP message to send to a peer.
Definition: ice.c:5092
gboolean janus_ice_is_loop_indication_allowed(void)
Method to check whether loop indication via API is allowed.
Definition: ice.c:245
void janus_ice_setup_remote_candidates(janus_ice_handle *handle, guint stream_id, guint component_id)
Method to handle remote candidates and start the connectivity checks.
Definition: ice.c:3533
void janus_ice_debugging_enable(void)
Method to enable libnice debugging (http://nice.freedesktop.org/libnice/libnice-Debug-messages....
Definition: ice.c:327
void janus_ice_trickle_destroy(janus_ice_trickle *trickle)
Helper method to destroy a janus_ice_trickle instance.
Definition: ice.c:1023
gboolean janus_ice_is_mdns_enabled(void)
Method to check whether mDNS resolution is enabled or not.
Definition: ice.c:106
gint janus_ice_handle_destroy(void *core_session, janus_ice_handle *handle)
Method to destroy a Janus ICE handle.
Definition: ice.c:1532
void janus_ice_notify_media_stopped(janus_ice_handle *handle)
Core SDP callback, called by the SDP stack when a stream has been paused by a negotiation.
Definition: ice.c:5229
gboolean janus_ice_is_keepalive_conncheck_enabled(void)
Method to check whether connectivity checks will be used as keepalives.
Definition: ice.c:174
void janus_set_no_media_timer(uint timer)
Method to modify the no-media event timer (i.e., the number of seconds where no media arrives before ...
Definition: ice.c:592
uint16_t janus_ice_get_stun_port(void)
Method to get the STUN server port.
Definition: ice.c:49
gboolean janus_ice_is_full_trickle_enabled(void)
Method to check whether full-trickle support is enabled or not.
Definition: ice.c:100
gboolean janus_ice_is_force_relay_allowed(void)
Method to check whether applications are allowed to force Janus to use TURN.
Definition: ice.c:82
uint janus_get_slowlink_threshold(void)
Method to get the current slowlink-threshold value (see above)
Definition: ice.c:617
void janus_ice_init(gboolean ice_lite, gboolean ice_tcp, gboolean full_trickle, gboolean ignore_mdns, gboolean ipv6, gboolean ipv6_linklocal, uint16_t rtp_min_port, uint16_t rtp_max_port)
ICE stuff initialization.
Definition: ice.c:1036
janus_ice_handle * janus_ice_handle_create(void *core_session, const char *opaque_id, const char *token)
Method to create a new Janus ICE handle.
Definition: ice.c:1383
int janus_ice_set_stun_server(gchar *stun_server, uint16_t stun_port)
Method to force Janus to use a STUN server when gathering candidates.
Definition: ice.c:1232
void janus_ice_deinit(void)
ICE stuff de-initialization.
Definition: ice.c:1092
void janus_set_nack_optimizations_enabled(gboolean optimize)
Method to enable/disable the NACK optimizations on outgoing keyframes: when enabled,...
Definition: ice.c:682
void janus_ice_incoming_data(janus_ice_handle *handle, char *label, char *protocol, gboolean textdata, char *buffer, int length)
Plugin SCTP/DataChannel callback, called by the SCTP stack when when there's data for a plugin.
Definition: ice.c:3290
void janus_ice_resend_trickles(janus_ice_handle *handle)
Method to resend all the existing candidates via trickle (e.g., after an ICE restart)
Definition: ice.c:3856
void janus_ice_allow_force_relay(void)
Method to enable applications to force Janus to use TURN.
Definition: ice.c:79
char * janus_ice_get_turn_server(void)
Method to get the TURN server IP address.
Definition: ice.c:60
void janus_ice_dtls_handshake_done(janus_ice_handle *handle)
Callback to be notified when the DTLS handshake for a specific component has been completed.
Definition: ice.c:5241
void janus_ice_enforce_interface(const char *ip)
Method to add an interface/IP to the enforce list for ICE (that is, only gather candidates from these...
Definition: ice.c:361
void janus_ice_restart(janus_ice_handle *handle)
Method to restart ICE and the connectivity checks.
Definition: ice.c:3846
void janus_ice_relay_rtp(janus_ice_handle *handle, janus_plugin_rtp *packet)
Core RTP callback, called when a plugin has an RTP packet to send to a peer.
Definition: ice.c:5025
void janus_ice_ignore_interface(const char *ip)
Method to add an interface/IP to the ignore list for ICE (that is, don't gather candidates)
Definition: ice.c:386
json_t * janus_ice_static_event_loops_info(void)
Helper method to return a summary of the static loops activity.
Definition: ice.c:288
void janus_ice_relay_sctp(janus_ice_handle *handle, char *buffer, int length)
Core SCTP/DataChannel callback, called by the SCTP stack when when there's data to send.
Definition: ice.c:5188
int janus_ice_get_peerconnection_num(void)
Method to get the number of active PeerConnection (for stats)
Definition: ice.c:435
gboolean janus_ice_is_ice_lite_enabled(void)
Method to check whether ICE Lite mode is enabled or not (still WIP)
Definition: ice.c:88
void janus_ice_send_pli(janus_ice_handle *handle)
Helper core callback, called when a plugin wants to send a RTCP PLI to a peer.
Definition: ice.c:5136
gboolean janus_ice_is_ignored(const char *ip)
Method to check whether an interface/IP is currently in the ignore list for ICE (that is,...
Definition: ice.c:397
gboolean janus_plugin_session_is_alive(janus_plugin_session *plugin_session)
Quick helper method to check if a plugin session associated with a Janus handle is still valid.
Definition: ice.c:788
void janus_set_min_nack_queue(uint16_t mnq)
Method to modify the min NACK value (i.e., the minimum time window of packets per handle to store for...
Definition: ice.c:690
janus_ice_peerconnection_medium * janus_ice_peerconnection_medium_create(janus_ice_handle *handle, janus_media_type type)
Method to quickly create a medium to be added to a handle PeerConnection.
Definition: ice.c:1864
void janus_ice_set_hangup_on_failed_enabled(gboolean enabled)
Method to enable/disable immediate hangups of PeerConnectionss on ICE failures.
Definition: ice.c:180
gboolean janus_ice_is_ipv6_enabled(void)
Method to check whether IPv6 candidates are enabled/supported or not.
Definition: ice.c:113
int janus_ice_setup_local(janus_ice_handle *handle, gboolean offer, gboolean trickle, janus_dtls_role dtls_role)
Method to locally set up the ICE candidates (initialization and gathering)
Definition: ice.c:3575
gboolean janus_is_opaqueid_in_api_enabled(void)
Method to check whether opaque ID have to be added to Janus API responses/events.
Definition: ice.c:197
void janus_ice_debugging_disable(void)
Method to disable libnice debugging (the default)
Definition: ice.c:342
gboolean janus_ice_is_ice_tcp_enabled(void)
Method to check whether ICE-TCP support is enabled/supported or not (still WIP)
Definition: ice.c:94
uint janus_get_no_media_timer(void)
Method to get the current no-media event timer (see above)
Definition: ice.c:599
gboolean janus_ice_is_consent_freshness_enabled(void)
Method to check whether consent fresnhess will be enabled in ICE.
Definition: ice.c:158
int janus_ice_set_turn_server(gchar *turn_server, uint16_t turn_port, gchar *turn_type, gchar *turn_user, gchar *turn_pwd)
Method to force Janus to use a TURN server when gathering candidates.
Definition: ice.c:1278
void janus_ice_set_consent_freshness_enabled(gboolean enabled)
Method to enable/disable consent freshness in PeerConnections.
Definition: ice.c:145
gboolean janus_ice_is_ice_debugging_enabled(void)
Method to check whether libnice debugging has been enabled (http://nice.freedesktop....
Definition: ice.c:324
void janus_ice_candidates_to_sdp(janus_ice_handle *handle, janus_sdp_mline *mline, guint stream_id, guint component_id)
Method to add local candidates to a janus_sdp SDP object representation.
Definition: ice.c:3465
int janus_get_dscp(void)
Method to get the current DSCP value (see above)
Definition: ice.c:645
janus_ice_trickle * janus_ice_trickle_new(const char *transaction, json_t *candidate)
Helper method to allocate a janus_ice_trickle instance.
Definition: ice.c:950
gboolean janus_ice_is_hangup_on_failed_enabled(void)
Method to check whether ICE failures will result in immediate hangups.
Definition: ice.c:186
void janus_ice_relay_data(janus_ice_handle *handle, janus_plugin_data *packet)
Core SCTP/DataChannel callback, called when a plugin has data to send to a peer.
void janus_ice_notify_data_ready(janus_ice_handle *handle)
Plugin SCTP/DataChannel callback, called by the SCTP stack when data can be written.
Definition: ice.c:5215
int janus_ice_set_turn_rest_api(gchar *api_server, gchar *api_key, gchar *api_method, uint api_timeout)
Method to force Janus to contact a TURN REST API server to get a TURN service to use when gathering c...
Definition: ice.c:1328
void janus_ice_enable_nat_1_1(gboolean keep_private_host)
Helper method to force Janus to overwrite all host candidates with the public IP.
Definition: ice.c:352
void janus_set_dscp(int dscp)
Method to modify the DSCP value to set, which is disabled by default.
Definition: ice.c:639
void janus_seq_list_free(janus_seq_info **head)
Definition: ice.c:759
int janus_ice_get_static_event_loops(void)
Method to return the number of static event loops, if enabled.
Definition: ice.c:242
int janus_ice_test_stun_server(janus_network_address *addr, uint16_t port, uint16_t local_port, janus_network_address *public_addr, uint16_t *public_port)
Method to check whether a STUN server is reachable.
Definition: ice.c:1098
void janus_ice_event_set_combine_media_stats(gboolean combine_media_stats_to_one_event)
Method to define wether the media stats shall be dispatched in one event (true) or in dedicated singl...
Definition: ice.c:426
uint janus_get_twcc_period(void)
Method to get the current TWCC period (see above)
Definition: ice.c:633
IP address related utility functions (headers)
GMutex janus_mutex
Janus mutex implementation.
Definition: mutex.h:73
Plugin-Core communication (implementation)
struct json_t json_t
Definition: plugin.h:236
Reference counter mechanism.
RTCP processing (headers)
SCTP processing for data channels (headers)
SDP processing (headers)
Janus DTLS-SRTP handle.
Definition: dtls.h:66
Janus ICE handle.
Definition: ice.h:354
void * app
Opaque application (plugin) pointer.
Definition: ice.h:366
gint last_event_stats
Count of how many seconds passed since the last stats passed to event handlers.
Definition: ice.h:416
janus_refcount ref
Reference counter for this instance.
Definition: ice.h:430
GList * pending_trickles
List of pending trickle candidates (those we received before getting the JSEP offer)
Definition: ice.h:406
void * static_event_loop
In case static event loops are used, opaque pointer to the loop.
Definition: ice.h:378
gboolean controlling
ICE role (controlling or controlled)
Definition: ice.h:390
janus_text2pcap * text2pcap
In case this session must be saved to text2pcap, the instance to dump packets to.
Definition: ice.h:420
GSource * rtcp_source
Definition: ice.h:382
gchar * local_sdp
SDP generated locally (just for debugging purposes)
Definition: ice.h:400
volatile gint has_pc
Atomic flag to check whether a PeerConnection was established.
Definition: ice.h:424
gchar * remote_sdp
SDP received by the peer (just for debugging purposes)
Definition: ice.h:402
GAsyncQueue * queued_packets
Queue of events in the loop and outgoing packets to send.
Definition: ice.h:410
volatile gint dump_packets
Flag to decide whether or not packets need to be dumped to a text2pcap file.
Definition: ice.h:418
GSource * rtp_source
GLib sources for outgoing traffic, recurring RTCP, and stats (and optionally TWCC)
Definition: ice.h:382
janus_flags webrtc_flags
Mask of WebRTC-related flags for this handle.
Definition: ice.h:370
GMainLoop * mainloop
GLib loop for the handle and libnice.
Definition: ice.h:376
guint srtp_errors_count
Count of the recent SRTP replay errors, in order to avoid spamming the logs.
Definition: ice.h:412
GAsyncQueue * queued_candidates
Queue of remote candidates that still need to be processed.
Definition: ice.h:408
gint64 created
Monotonic time of when the handle has been created.
Definition: ice.h:364
gchar * rtp_profile
RTP profile set by caller (so that we can match it)
Definition: ice.h:398
NiceAgent * agent
libnice ICE agent
Definition: ice.h:384
GThread * thread
GLib thread for the handle and libnice.
Definition: ice.h:380
janus_ice_peerconnection * pc
WebRTC PeerConnection, if any.
Definition: ice.h:396
janus_mutex mutex
Mutex to lock/unlock the ICE session.
Definition: ice.h:422
gint64 agent_started
Monotonic time of when the ICE agent has been started (remote credentials set)
Definition: ice.h:388
gchar * pc_mid
Main mid.
Definition: ice.h:392
volatile gint closepc
Whether a close_pc was requested recently on the PeerConnection.
Definition: ice.h:426
char * token
Token that was used to attach the handle, if required.
Definition: ice.h:362
char * opaque_id
Opaque identifier, e.g., to provide inter-handle relationships to external tools.
Definition: ice.h:360
gint last_srtp_error
Count of the recent SRTP replay errors, in order to avoid spamming the logs.
Definition: ice.h:414
gint last_srtp_summary
Definition: ice.h:414
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: ice.h:428
gint cdone
Number of gathered candidates.
Definition: ice.h:372
const gchar * hangup_reason
Reason this handle has been hung up.
Definition: ice.h:404
GSource * stats_source
Definition: ice.h:382
guint64 handle_id
Handle identifier, guaranteed to be non-zero.
Definition: ice.h:358
guint stream_id
ICE Stream ID.
Definition: ice.h:394
GSource * twcc_source
Definition: ice.h:382
GMainContext * mainctx
GLib context for the handle and libnice.
Definition: ice.h:374
janus_plugin_session * app_handle
Opaque core/plugin session pointer.
Definition: ice.h:368
gint64 agent_created
Monotonic time of when the ICE agent has been created.
Definition: ice.h:386
void * session
Opaque pointer to the core/peer session.
Definition: ice.h:356
A single media in a PeerConnection.
Definition: ice.h:544
gboolean disabled_rid[3]
Which simulcast rids are currently disabled, as per the latest negotiation.
Definition: ice.h:566
GQueue * retransmit_buffer
List of previously sent janus_rtp_packet RTP packets, in case we receive NACKs.
Definition: ice.h:608
char * rid[3]
Array of RTP Stream IDs (for simulcasting, if enabled)
Definition: ice.h:564
guint32 ssrc_peer_new[3]
Definition: ice.h:560
gboolean rids_hml
Whether the order of the rids in the SDP will be h-m-l (TRUE) or l-m-h (FALSE)
Definition: ice.h:568
GHashTable * rtx_nacked[3]
Map(s) of the NACKed packets (to track retransmissions and avoid duplicates)
Definition: ice.h:594
guint32 ssrc_peer[3]
SSRC(s) of the peer for this medium (may be simulcasting)
Definition: ice.h:560
int opusred_pt
opus/red payload type, if enabled
Definition: ice.h:576
guint32 first_rtp_ts[3]
First received RTP timestamp.
Definition: ice.h:600
janus_seq_info * last_seqs[3]
List of recently received sequence numbers (as a support to NACK generation, for each simulcast SSRC)
Definition: ice.h:622
guint32 ssrc_peer_rtx[3]
Retransmissions SSRC(s) of the peer for this medium (may be simulcasting)
Definition: ice.h:562
gboolean recv
Definition: ice.h:588
janus_media_type type
Type of this medium.
Definition: ice.h:548
guint32 ssrc_peer_rtx_orig[3]
Definition: ice.h:562
guint retransmit_recent_cnt
Number of retransmitted packets since last log message.
Definition: ice.h:616
gint64 retransmit_log_ts
Last time a log message about sending retransmits was printed.
Definition: ice.h:614
gint rtx_payload_type
Definition: ice.h:582
gboolean(* video_is_keyframe)(const char *buffer, int len)
Pointer to function to check if a packet is a keyframe (depends on negotiated codec; video only)
Definition: ice.h:586
GHashTable * retransmit_seqs
HashTable of retransmittable sequence numbers, in case we receive NACKs.
Definition: ice.h:610
int mindex
Index of this medium in the media list.
Definition: ice.h:550
guint32 ssrc_rtx
Retransmission SSRC of the server for this medium.
Definition: ice.h:558
gboolean do_nacks
Whether we should do NACKs (in or out) for this medium.
Definition: ice.h:606
janus_refcount ref
Reference counter for this instance.
Definition: ice.h:634
GHashTable * clock_rates
Mapping of payload types to their clock rates, as advertised in the SDP.
Definition: ice.h:580
GHashTable * rtx_payload_types
Mapping of rtx payload types to actual media-related packet types.
Definition: ice.h:578
gboolean noerrorlog
Helper flag to avoid flooding the console with the same error all over again.
Definition: ice.h:628
guint32 ssrc_peer_temp
Definition: ice.h:560
GHashTable * pending_nacked_cleanup
Map of the pending NACKed cleanup callback.
Definition: ice.h:596
janus_rtcp_context * rtcp_ctx[3]
RTCP context(s) for the medium (may be simulcasting)
Definition: ice.h:590
guint32 ssrc_peer_rtx_new[3]
Definition: ice.h:562
char * msid
Media Stream ID info.
Definition: ice.h:554
janus_rtp_switching_context rtp_ctx[3]
RTP switching context(s) in case of renegotiations (audio+video and/or simulcast)
Definition: ice.h:572
janus_ice_peerconnection * pc
WebRTC PeerConnection this m-line belongs to.
Definition: ice.h:546
guint nack_sent_recent_cnt
Number of NACKs sent since last log message.
Definition: ice.h:620
gint64 first_ntp_ts[3]
First received NTP timestamp.
Definition: ice.h:598
janus_ice_stats out_stats
Stats for outgoing data (audio/video/data)
Definition: ice.h:626
guint32 ssrc
SSRC of the server for this medium.
Definition: ice.h:556
GList * payload_types
List of payload types we can expect.
Definition: ice.h:574
uint16_t nack_queue_ms
Size of the NACK queue (in ms), dynamically updated per the RTT.
Definition: ice.h:592
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: ice.h:632
gboolean send
Media direction.
Definition: ice.h:588
guint32 last_rtp_ts
Last sent RTP timestamp.
Definition: ice.h:604
char * remote_mstid
Definition: ice.h:554
gboolean legacy_rid
Whether we should use the legacy simulcast syntax (a=simulcast:recv rid=..) or the proper one (a=simu...
Definition: ice.h:570
char * mstid
Definition: ice.h:554
guint16 rtx_seq_number
Current sequence number for the RFC4588 rtx SSRC session.
Definition: ice.h:612
char * remote_msid
Definition: ice.h:554
gint64 nack_sent_log_ts
Last time a log message about sending NACKs was printed.
Definition: ice.h:618
gint payload_type
RTP payload types for this medium.
Definition: ice.h:582
guint32 ssrc_peer_orig[3]
Definition: ice.h:560
janus_ice_stats in_stats
Stats for incoming data (audio/video/data)
Definition: ice.h:624
char * mid
Media ID.
Definition: ice.h:552
gint64 last_ntp_ts
Last sent NTP timestamp.
Definition: ice.h:602
janus_mutex mutex
Mutex to lock/unlock this medium.
Definition: ice.h:630
char * codec
Codec used in this medium.
Definition: ice.h:584
Janus handle WebRTC PeerConnection.
Definition: ice.h:434
gint playoutdelay_ext_id
Playout delay extension ID.
Definition: ice.h:476
GHashTable * media
GLib hash table of media (m-line indexes are the keys)
Definition: ice.h:514
gchar * remote_fingerprint
Hashed fingerprint of the peer's certificate, as parsed in SDP.
Definition: ice.h:508
janus_ice_stats dtls_in_stats
Data exchanged for DTLS handshakes and messages.
Definition: ice.h:504
GSList * local_candidates
GLib list of local candidates for this component (summary)
Definition: ice.h:452
GSList * remote_candidates
GLib list of remote candidates for this component (summary)
Definition: ice.h:454
gint audiolevel_ext_id
Audio levels extension ID.
Definition: ice.h:472
janus_ice_stats dtls_out_stats
Definition: ice.h:504
gboolean noerrorlog
Helper flag to avoid flooding the console with the same error all over again.
Definition: ice.h:533
GHashTable * payload_types
List of payload types we can expect.
Definition: ice.h:525
guint state
libnice ICE component state
Definition: ice.h:444
gint transport_wide_cc_ext_id
Transport wide cc rtp ext ID.
Definition: ice.h:486
janus_dtls_role dtls_role
DTLS role of the server for this stream.
Definition: ice.h:502
gint cdone
Whether this stream is ready to be used.
Definition: ice.h:442
GHashTable * media_bymid
GLib hash table of media (mids are the keys)
Definition: ice.h:518
gint dependencydesc_ext_id
Dependency descriptor extension ID.
Definition: ice.h:478
gboolean process_started
Whether the setup of remote candidates for this component has started or not.
Definition: ice.h:458
GSList * candidates
GLib list of libnice remote candidates for this component.
Definition: ice.h:450
gchar * ruser
The ICE username for this stream.
Definition: ice.h:510
gint64 gathered
Monotonic time of when gathering has completed.
Definition: ice.h:446
GHashTable * media_bytype
GLib hash table of media (media types are the keys)
Definition: ice.h:523
janus_ice_handle * handle
Janus ICE handle this stream belongs to.
Definition: ice.h:436
gchar * remote_hashing
Hashing algorhitm used by the peer for the DTLS certificate (e.g., "SHA-256")
Definition: ice.h:506
guint transport_wide_cc_feedback_count
Transport wide cc rtp ext ID.
Definition: ice.h:496
GSList * transport_wide_received_seq_nums
GLib list of transport wide cc stats in reverse received order.
Definition: ice.h:498
guint32 transport_wide_cc_last_feedback_seq_num
Last transport wide seq num sent on feedback.
Definition: ice.h:492
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: ice.h:537
uint32_t remb_bitrate
Latest REMB feedback we received.
Definition: ice.h:500
gboolean do_transport_wide_cc
Whether we do transport wide cc.
Definition: ice.h:484
janus_refcount ref
Reference counter for this instance.
Definition: ice.h:539
janus_dtls_srtp * dtls
DTLS-SRTP stack.
Definition: ice.h:466
guint32 transport_wide_cc_last_seq_num
Last received transport wide seq num.
Definition: ice.h:490
GHashTable * rtx_payload_types
Mapping of rtx payload types to actual media-related packet types.
Definition: ice.h:529
gint64 connected
Monotonic time of when ICE has successfully connected.
Definition: ice.h:448
GHashTable * media_byssrc
GLib hash table of media (SSRCs are the keys)
Definition: ice.h:516
guint16 transport_wide_cc_out_seq_num
Last sent transport wide seq num.
Definition: ice.h:488
GHashTable * clock_rates
Mapping of payload types to their clock rates, as advertised in the SDP.
Definition: ice.h:527
GHashTable * rtx_payload_types_rev
Reverse mapping of rtx payload types to actual media-related packet types.
Definition: ice.h:531
gchar * selected_pair
String representation of the selected pair as notified by libnice (foundations)
Definition: ice.h:456
guint component_id
libnice ICE component ID
Definition: ice.h:440
gint ridrtx_ext_id
Definition: ice.h:470
gint abs_capture_time_ext_id
Absolute Capture Time ext ID.
Definition: ice.h:482
guint16 transport_wide_cc_cycles
Transport wide cc transport seq num wrap cycles.
Definition: ice.h:494
guint stream_id
libnice ICE stream ID
Definition: ice.h:438
gint mid_ext_id
SDES mid RTP extension ID.
Definition: ice.h:468
gint videoorientation_ext_id
Video orientation extension ID.
Definition: ice.h:474
gint rid_ext_id
RTP Stream extension ID, and the related rtx one.
Definition: ice.h:470
janus_mutex mutex
Mutex to lock/unlock this stream.
Definition: ice.h:535
gchar * rpass
The ICE password for this stream.
Definition: ice.h:512
GSource * icestate_source
Timer to check when we should consider ICE as failed.
Definition: ice.h:460
gint64 icefailed_detected
Time of when we first detected an ICE failed (we'll need this for the timer above)
Definition: ice.h:462
gint abs_send_time_ext_id
Absolute Send Time ext ID.
Definition: ice.h:480
GSource * dtlsrt_source
Re-transmission timer for DTLS.
Definition: ice.h:464
Janus media statistics.
Definition: ice.h:300
guint32 bytes_lastsec_temp
Definition: ice.h:306
gint64 updated
Time we last updated the last second counter.
Definition: ice.h:308
guint32 packets
Packets sent or received.
Definition: ice.h:302
guint32 nacks
Number of NACKs sent or received.
Definition: ice.h:312
gboolean notified_lastsec
Whether or not we notified about lastsec issues already.
Definition: ice.h:310
guint64 bytes
Bytes sent or received.
Definition: ice.h:304
guint32 bytes_lastsec
Bytes sent or received in the last second.
Definition: ice.h:306
Janus media statistics container.
Definition: ice.h:317
janus_ice_stats_info info[3]
Media stats info (considering we may be simulcasting)
Definition: ice.h:319
guint sl_lost_count
Last known count of lost packets (for slow_link)
Definition: ice.h:321
Helper to handle pending trickle candidates (e.g., when we're still waiting for an offer)
Definition: ice.h:644
gint64 received
Monotonic time of when this trickle candidate has been received.
Definition: ice.h:648
char * transaction
Janus API transaction ID of the original trickle request.
Definition: ice.h:650
janus_ice_handle * handle
Janus ICE handle this trickle candidate belongs to.
Definition: ice.h:646
json_t * candidate
JSON object of the trickle candidate(s)
Definition: ice.h:652
Structure to hold network addresses in a tagged union which should be IPv4 and IPv6 compatible....
Definition: ip-utils.h:53
Janus plugin data message.
Definition: plugin.h:647
Janus plugin RTCP packet.
Definition: plugin.h:623
Janus plugin RTP packet.
Definition: plugin.h:591
Plugin-Gateway session mapping.
Definition: plugin.h:239
The plugin session and callbacks interface.
Definition: plugin.h:252
Definition: refcount.h:78
RTP context, in order to make sure SSRC changes result in coherent seq/ts increases.
Definition: rtp.h:295
SDP m-line representation.
Definition: sdp-utils.h:131
A helper struct for determining when to send NACKs.
Definition: ice.h:337
guint16 seq
Definition: ice.h:339
gint64 ts
Definition: ice.h:338
guint16 state
Definition: ice.h:340
struct janus_seq_info * next
Definition: ice.h:341
struct janus_seq_info * prev
Definition: ice.h:342
Instance of a text2pcap recorder.
Definition: text2pcap.h:49
Internal RTCP state context (for RR/SR)
Definition: rtcp.h:229
Dumping of RTP/RTCP packets to text2pcap or pcap format (headers)
TURN REST API client.
gsize janus_flags
Janus flags container.
Definition: utils.h:163