Fork me on GitHub
ice.h
Go to the documentation of this file.
1 
17 #ifndef JANUS_ICE_H
18 #define JANUS_ICE_H
19 
20 #include <glib.h>
21 #include <agent.h>
22 
23 #include "sdp.h"
24 #include "dtls.h"
25 #include "sctp.h"
26 #include "rtcp.h"
27 #include "text2pcap.h"
28 #include "utils.h"
29 #include "ip-utils.h"
30 #include "refcount.h"
31 #include "plugins/plugin.h"
32 
33 
42 void janus_ice_init(gboolean ice_lite, gboolean ice_tcp, gboolean full_trickle, gboolean ignore_mdns,
43  gboolean ipv6, uint16_t rtp_min_port, uint16_t rtp_max_port);
45 void janus_ice_deinit(void);
53 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);
58 int janus_ice_set_stun_server(gchar *stun_server, uint16_t stun_port);
66 int janus_ice_set_turn_server(gchar *turn_server, uint16_t turn_port, gchar *turn_type, gchar *turn_user, gchar *turn_pwd);
75 int janus_ice_set_turn_rest_api(gchar *api_server, gchar *api_key, gchar *api_method, uint api_timeout);
78 char *janus_ice_get_stun_server(void);
81 uint16_t janus_ice_get_stun_port(void);
84 char *janus_ice_get_turn_server(void);
87 uint16_t janus_ice_get_turn_port(void);
90 char *janus_ice_get_turn_rest_api(void);
93 void janus_ice_enable_nat_1_1(gboolean keep_private_host);
100 void janus_ice_enforce_interface(const char *ip);
104 gboolean janus_ice_is_enforced(const char *ip);
112 void janus_ice_ignore_interface(const char *ip);
116 gboolean janus_ice_is_ignored(const char *ip);
119 gboolean janus_ice_is_ice_lite_enabled(void);
122 gboolean janus_ice_is_ice_tcp_enabled(void);
125 gboolean janus_ice_is_full_trickle_enabled(void);
128 gboolean janus_ice_is_mdns_enabled(void);
131 gboolean janus_ice_is_ipv6_enabled(void);
134 void janus_set_min_nack_queue(uint16_t mnq);
137 uint16_t janus_get_min_nack_queue(void);
144 void janus_set_nack_optimizations_enabled(gboolean optimize);
150 void janus_set_no_media_timer(uint timer);
153 uint janus_get_no_media_timer(void);
156 void janus_set_slowlink_threshold(uint packets);
162 void janus_set_twcc_period(uint period);
165 uint janus_get_twcc_period(void);
168 void janus_set_dscp(int dscp);
171 int janus_get_dscp(void);
174 void janus_ice_set_event_stats_period(int period);
182 void janus_ice_debugging_enable(void);
184 void janus_ice_debugging_disable(void);
189 gboolean janus_is_opaqueid_in_api_enabled(void);
190 
191 
195 const gchar *janus_get_ice_state_name(gint state);
196 
197 
199 typedef struct janus_ice_handle janus_ice_handle;
201 typedef struct janus_ice_stream janus_ice_stream;
205 typedef struct janus_ice_trickle janus_ice_trickle;
206 
207 #define JANUS_ICE_HANDLE_WEBRTC_PROCESSING_OFFER (1 << 0)
208 #define JANUS_ICE_HANDLE_WEBRTC_START (1 << 1)
209 #define JANUS_ICE_HANDLE_WEBRTC_READY (1 << 2)
210 #define JANUS_ICE_HANDLE_WEBRTC_STOP (1 << 3)
211 #define JANUS_ICE_HANDLE_WEBRTC_ALERT (1 << 4)
212 #define JANUS_ICE_HANDLE_WEBRTC_NEGOTIATED (1 << 5)
213 #define JANUS_ICE_HANDLE_WEBRTC_TRICKLE (1 << 7)
214 #define JANUS_ICE_HANDLE_WEBRTC_ALL_TRICKLES (1 << 8)
215 #define JANUS_ICE_HANDLE_WEBRTC_TRICKLE_SYNCED (1 << 9)
216 #define JANUS_ICE_HANDLE_WEBRTC_DATA_CHANNELS (1 << 10)
217 #define JANUS_ICE_HANDLE_WEBRTC_CLEANING (1 << 11)
218 #define JANUS_ICE_HANDLE_WEBRTC_HAS_AUDIO (1 << 12)
219 #define JANUS_ICE_HANDLE_WEBRTC_HAS_VIDEO (1 << 13)
220 #define JANUS_ICE_HANDLE_WEBRTC_GOT_OFFER (1 << 14)
221 #define JANUS_ICE_HANDLE_WEBRTC_GOT_ANSWER (1 << 15)
222 #define JANUS_ICE_HANDLE_WEBRTC_HAS_AGENT (1 << 16)
223 #define JANUS_ICE_HANDLE_WEBRTC_ICE_RESTART (1 << 17)
224 #define JANUS_ICE_HANDLE_WEBRTC_RESEND_TRICKLES (1 << 18)
225 #define JANUS_ICE_HANDLE_WEBRTC_RFC4588_RTX (1 << 19)
226 #define JANUS_ICE_HANDLE_WEBRTC_NEW_DATACHAN_SDP (1 << 20)
227 #define JANUS_ICE_HANDLE_WEBRTC_E2EE (1 << 21)
228 
229 
232 typedef struct janus_ice_stats_info {
234  guint32 packets;
236  guint64 bytes;
240  gint64 updated;
244  guint32 nacks;
246 
249 typedef struct janus_ice_stats {
261 
265 void janus_ice_notify_hangup(janus_ice_handle *handle, const char *reason);
266 
267 
271 gboolean janus_plugin_session_is_alive(janus_plugin_session *plugin_session);
272 
273 
275 typedef struct janus_seq_info {
276  gint64 ts;
277  guint16 seq;
278  guint16 state;
283 enum {
287  SEQ_RECVED
288 };
289 
290 
294  void *session;
296  guint64 handle_id;
298  char *opaque_id;
300  char *token;
302  gint64 created;
304  void *app;
310  gint cdone;
312  GMainContext *mainctx;
314  GMainLoop *mainloop;
316  GThread *thread;
320  NiceAgent *agent;
324  gboolean controlling;
326  gchar *audio_mid;
328  gchar *video_mid;
330  gchar *data_mid;
332  gchar *stream_mid;
334  guint stream_id;
338  gchar *rtp_profile;
340  gchar *local_sdp;
342  gchar *remote_sdp;
344  const gchar *hangup_reason;
348  GAsyncQueue *queued_candidates;
350  GAsyncQueue *queued_packets;
358  volatile gint dump_packets;
364  volatile gint closepc;
366  volatile gint destroyed;
369 };
370 
376  guint stream_id;
378  gint cdone:1;
380  guint32 audio_ssrc;
382  guint32 video_ssrc;
384  guint32 video_ssrc_rtx;
392  char *rid[3];
394  gboolean rids_hml;
396  gboolean legacy_rid;
404  GHashTable *rtx_payload_types;
406  GHashTable *clock_rates;
412  gboolean (* video_is_keyframe)(const char* buffer, int len);
420  uint16_t nack_queue_ms;
422  GHashTable *rtx_nacked[3];
432  guint32 video_first_rtp_ts[3];
474  gchar *ruser;
476  gchar *rpass;
478  GHashTable *components;
482  gboolean noerrorlog;
486  volatile gint destroyed;
489 };
490 
491 #define LAST_SEQS_MAX_LEN 160
492 
497  guint stream_id;
501  guint state;
505  GSList *candidates;
513  gboolean process_started;
515  GSource *icestate_source;
519  GSource *dtlsrt_source;
523  gboolean do_audio_nacks;
525  gboolean do_video_nacks;
531  guint16 rtx_seq_number;
549  gboolean noerrorlog;
553  volatile gint destroyed;
556 };
557 
563  gint64 received;
565  char *transaction;
568 };
569 
572 
577 janus_ice_trickle *janus_ice_trickle_new(const char *transaction, json_t *candidate);
583 gint janus_ice_trickle_parse(janus_ice_handle *handle, json_t *candidate, const char **error);
588 
589 
592 
598 janus_ice_handle *janus_ice_handle_create(void *core_session, const char *opaque_id, const char *token);
605 gint janus_ice_handle_attach_plugin(void *core_session, janus_ice_handle *handle, janus_plugin *plugin);
610 gint janus_ice_handle_destroy(void *core_session, janus_ice_handle *handle);
614 void janus_ice_webrtc_hangup(janus_ice_handle *handle, const char *reason);
622 
623 
626 
645 void janus_ice_send_remb(janus_ice_handle *handle, uint32_t bitrate);
653 void janus_ice_incoming_data(janus_ice_handle *handle, char *label, char *protocol, gboolean textdata, char *buffer, int length);
658 void janus_ice_relay_sctp(janus_ice_handle *handle, char *buffer, int length);
663 
664 
667 
676 int janus_ice_setup_local(janus_ice_handle *handle, int offer, int audio, int video, int data, int trickle);
682 void janus_ice_candidates_to_sdp(janus_ice_handle *handle, janus_sdp_mline *mline, guint stream_id, guint component_id);
686 void janus_ice_add_remote_candidate(janus_ice_handle *handle, NiceCandidate *c);
691 void janus_ice_setup_remote_candidates(janus_ice_handle *handle, guint stream_id, guint component_id);
699 void janus_ice_restart(janus_ice_handle *handle);
704 
705 
710 void janus_ice_set_static_event_loops(int loops);
717 
718 #endif
janus_ice_candidates_to_sdp
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:3263
janus_set_no_media_timer
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:417
janus_ice_stream::video_ssrc_peer_orig
guint32 video_ssrc_peer_orig[3]
Definition: ice.h:388
janus_ice_add_remote_candidate
void janus_ice_add_remote_candidate(janus_ice_handle *handle, NiceCandidate *c)
Method to queue a remote candidate for processing.
Definition: ice.c:3322
janus_ice_handle::text2pcap
janus_text2pcap * text2pcap
In case this session must be saved to text2pcap, the instance to dump packets to.
Definition: ice.h:360
janus_ice_trickle::candidate
json_t * candidate
JSON object of the trickle candidate(s)
Definition: ice.h:567
janus_ice_set_stun_server
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:1032
janus_ice_set_static_event_loops
void janus_ice_set_static_event_loops(int loops)
Method to configure the static event loops mechanism at startup.
Definition: ice.c:144
janus_ice_trickle_destroy
void janus_ice_trickle_destroy(janus_ice_trickle *trickle)
Helper method to destroy a janus_ice_trickle instance.
Definition: ice.c:825
janus_ice_send_pli
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:4853
janus_ice_component::component_connected
gint64 component_connected
Monotonic time of when this component has successfully connected.
Definition: ice.h:503
janus_ice_relay_rtcp
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:4825
janus_ice_handle::twcc_source
GSource * twcc_source
Definition: ice.h:318
janus_seq_info::state
guint16 state
Definition: ice.h:278
janus_ice_ignore_interface
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:260
janus_ice_stream::video_payload_type
gint video_payload_type
Definition: ice.h:408
janus_ice_handle::stream
janus_ice_stream * stream
ICE stream.
Definition: ice.h:336
janus_ice_enforce_interface
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:235
janus_ice_stream::video_ssrc_peer_new
guint32 video_ssrc_peer_new[3]
Definition: ice.h:388
janus_plugin
The plugin session and callbacks interface.
Definition: plugin.h:252
janus_ice_component::dtlsrt_source
GSource * dtlsrt_source
Re-transmission timer for DTLS.
Definition: ice.h:519
janus_ice_handle::last_srtp_error
gint last_srtp_error
Count of the recent SRTP replay errors, in order to avoid spamming the logs.
Definition: ice.h:354
janus_ice_handle::closepc
volatile gint closepc
Whether a close_pc was requested recently on the PeerConnection.
Definition: ice.h:364
janus_ice_stream::mutex
janus_mutex mutex
Mutex to lock/unlock this stream.
Definition: ice.h:484
janus_ice_stream::destroyed
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: ice.h:486
janus_ice_stream::legacy_rid
gboolean legacy_rid
Whether we should use the legacy simulcast syntax (a=simulcast:recv rid=..) or the proper one (a=simu...
Definition: ice.h:396
janus_ice_stream::noerrorlog
gboolean noerrorlog
Helper flag to avoid flooding the console with the same error all over again.
Definition: ice.h:482
janus_ice_stats::video
janus_ice_stats_info video[3]
Video info (considering we may be simulcasting)
Definition: ice.h:253
janus_plugin_data
Janus plugin data message.
Definition: plugin.h:606
janus_ice_stats_info::bytes
guint64 bytes
Bytes sent or received.
Definition: ice.h:236
janus_ice_is_ipv6_enabled
gboolean janus_ice_is_ipv6_enabled(void)
Method to check whether IPv6 candidates are enabled/supported or not.
Definition: ice.c:100
janus_ice_stats_info::bytes_lastsec_temp
guint32 bytes_lastsec_temp
Definition: ice.h:238
janus_ice_stream::stream_id
guint stream_id
libnice ICE stream ID
Definition: ice.h:376
janus_ice_dtls_handshake_done
void janus_ice_dtls_handshake_done(janus_ice_handle *handle, janus_ice_component *component)
Callback to be notified when the DTLS handshake for a specific component has been completed.
Definition: ice.c:4922
dtls.h
DTLS/SRTP processing (headers)
janus_ice_stream::video_ssrc_rtx
guint32 video_ssrc_rtx
Video retransmission SSRC of the peer for this stream.
Definition: ice.h:384
janus_ice_stats::sl_lost_count_video
guint sl_lost_count_video
Last known count of lost video packets (for slow_link)
Definition: ice.h:259
janus_ice_setup_local
int janus_ice_setup_local(janus_ice_handle *handle, int offer, int audio, int video, int data, int trickle)
Method to locally set up the ICE candidates (initialization and gathering)
Definition: ice.c:3383
janus_plugin_rtp
Janus plugin RTP packet.
Definition: plugin.h:571
janus_ice_stream
Janus ICE stream.
Definition: ice.h:372
janus_ice_component::audio_retransmit_seqs
GHashTable * audio_retransmit_seqs
HashTable of retransmittable sequence numbers, in case we receive NACKs.
Definition: ice.h:529
janus_ice_handle::mainloop
GMainLoop * mainloop
GLib loop for the handle and libnice.
Definition: ice.h:314
janus_ice_stream::video_first_rtp_ts
guint32 video_first_rtp_ts[3]
First received video NTP RTP timestamp (for all simulcast video streams)
Definition: ice.h:432
janus_ice_deinit
void janus_ice_deinit(void)
ICE stuff de-initialization.
Definition: ice.c:892
janus_ice_is_ice_lite_enabled
gboolean janus_ice_is_ice_lite_enabled(void)
Method to check whether ICE Lite mode is enabled or not (still WIP)
Definition: ice.c:76
janus_ice_handle_destroy
gint janus_ice_handle_destroy(void *core_session, janus_ice_handle *handle)
Method to destroy a Janus ICE handle.
Definition: ice.c:1294
janus_plugin_session_is_alive
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:615
janus_ice_get_stun_port
uint16_t janus_ice_get_stun_port(void)
Method to get the STUN server port.
Definition: ice.c:45
janus_ice_component::last_seqs_audio
janus_seq_info * last_seqs_audio
List of recently received audio sequence numbers (as a support to NACK generation)
Definition: ice.h:541
janus_ice_is_enforced
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:243
janus_ice_stream::rtp_ctx
janus_rtp_switching_context rtp_ctx[3]
RTP switching context(s) in case of renegotiations (audio+video and/or simulcast)
Definition: ice.h:398
janus_ice_trickle::handle
janus_ice_handle * handle
Janus ICE handle this trickle candidate belongs to.
Definition: ice.h:561
janus_ice_component::dtls
janus_dtls_srtp * dtls
DTLS-SRTP stack.
Definition: ice.h:521
janus_ice_relay_data
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.
janus_ice_stream::audio_payload_type
gint audio_payload_type
RTP payload types of this stream.
Definition: ice.h:408
janus_ice_stream::audio_last_rtp_ts
guint32 audio_last_rtp_ts
Last sent audio RTP timestamp.
Definition: ice.h:436
janus_ice_get_static_event_loops
int janus_ice_get_static_event_loops(void)
Method to return the number of static event loops, if enabled.
Definition: ice.c:141
janus_plugin_session
Plugin-Gateway session mapping.
Definition: plugin.h:239
janus_ice_stream::remote_fingerprint
gchar * remote_fingerprint
Hashed fingerprint of the peer's certificate, as parsed in SDP.
Definition: ice.h:472
janus_ice_handle::created
gint64 created
Monotonic time of when the handle has been created.
Definition: ice.h:302
janus_ice_send_remb
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:4861
janus_ice_stream::video_last_rtp_ts
guint32 video_last_rtp_ts
Last sent video RTP timestamp.
Definition: ice.h:440
janus_ice_stream::pending_nacked_cleanup
GHashTable * pending_nacked_cleanup
Map of the pending NACKed cleanup callback.
Definition: ice.h:424
janus_ice_stream::video_ssrc_peer_rtx_new
guint32 video_ssrc_peer_rtx_new[3]
Definition: ice.h:390
janus_ice_get_turn_server
char * janus_ice_get_turn_server(void)
Method to get the TURN server IP address.
Definition: ice.c:56
janus_ice_handle::destroyed
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: ice.h:366
janus_ice_component::do_video_nacks
gboolean do_video_nacks
Whether we should do NACKs (in or out) for video.
Definition: ice.h:525
janus_ice_stream::mid_ext_id
gint mid_ext_id
SDES mid RTP extension ID.
Definition: ice.h:442
janus_ice_component::rtx_seq_number
guint16 rtx_seq_number
Current sequence number for the RFC4588 rtx SSRC session.
Definition: ice.h:531
janus_ice_handle::controlling
gboolean controlling
ICE role (controlling or controlled)
Definition: ice.h:324
janus_ice_stream::transport_wide_cc_last_seq_num
guint32 transport_wide_cc_last_seq_num
Last received transport wide seq num.
Definition: ice.h:458
janus_ice_handle::dump_packets
volatile gint dump_packets
Flag to decide whether or not packets need to be dumped to a text2pcap file.
Definition: ice.h:358
plugin.h
Plugin-Core communication (implementation)
janus_seq_info::ts
gint64 ts
Definition: ice.h:276
janus_ice_component::icestate_source
GSource * icestate_source
Timer to check when we should consider ICE as failed.
Definition: ice.h:515
janus_ice_stats_info::nacks
guint32 nacks
Number of NACKs sent or received.
Definition: ice.h:244
janus_ice_stream::video_codec
char * video_codec
Definition: ice.h:410
janus_ice_stats_info
struct janus_ice_stats_info janus_ice_stats_info
Janus media statistics.
janus_ice_component::state
guint state
libnice ICE component state
Definition: ice.h:501
janus_ice_is_ice_tcp_enabled
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:82
janus_ice_init
void janus_ice_init(gboolean ice_lite, gboolean ice_tcp, gboolean full_trickle, gboolean ignore_mdns, gboolean ipv6, uint16_t rtp_min_port, uint16_t rtp_max_port)
ICE stuff initialization.
Definition: ice.c:838
janus_ice_debugging_disable
void janus_ice_debugging_disable(void)
Method to disable libnice debugging (the default)
Definition: ice.c:216
janus_ice_stream::audio_send
gboolean audio_send
Media direction.
Definition: ice.h:414
janus_ice_stats::data
janus_ice_stats_info data
Data info.
Definition: ice.h:255
janus_ice_handle::data_mid
gchar * data_mid
Data channel mid (media ID)
Definition: ice.h:330
janus_ice_trickle::transaction
char * transaction
Janus API transaction ID of the original trickle request.
Definition: ice.h:565
janus_ice_stream::transport_wide_cc_last_feedback_seq_num
guint32 transport_wide_cc_last_feedback_seq_num
Last transport wide seq num sent on feedback.
Definition: ice.h:460
janus_ice_handle::mutex
janus_mutex mutex
Mutex to lock/unlock the ICE session.
Definition: ice.h:362
janus_ice_handle::queued_candidates
GAsyncQueue * queued_candidates
Queue of remote candidates that still need to be processed.
Definition: ice.h:348
janus_ice_notify_hangup
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:720
janus_ice_trickle_parse
gint janus_ice_trickle_parse(janus_ice_handle *handle, json_t *candidate, const char **error)
Helper method to parse trickle candidates.
Definition: ice.c:763
janus_get_min_nack_queue
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:518
stream
ogg_stream_state * stream
Definition: pp-opus.c:32
janus_ice_component::nack_sent_recent_cnt
guint nack_sent_recent_cnt
Number of NACKs sent since last log message.
Definition: ice.h:539
janus_ice_debugging_enable
void janus_ice_debugging_enable(void)
Method to enable libnice debugging (http://nice.freedesktop.org/libnice/libnice-Debug-messages....
Definition: ice.c:201
janus_ice_set_event_stats_period
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:291
janus_ice_component::noerrorlog
gboolean noerrorlog
Helper flag to avoid flooding the console with the same error all over again.
Definition: ice.h:549
janus_ice_relay_rtp
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:4661
janus_set_twcc_period
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:446
rtcp_context
Internal RTCP state context (for RR/SR)
Definition: rtcp.h:227
janus_ice_stream_destroy
void janus_ice_stream_destroy(janus_ice_stream *stream)
Method to only free resources related to a specific ICE stream allocated by a Janus ICE handle.
Definition: ice.c:1481
janus_ice_component::mutex
janus_mutex mutex
Mutex to lock/unlock this component.
Definition: ice.h:551
janus_ice_stream::transport_wide_cc_feedback_count
guint transport_wide_cc_feedback_count
Transport wide cc rtp ext ID.
Definition: ice.h:464
janus_ice_component::retransmit_log_ts
gint64 retransmit_log_ts
Last time a log message about sending retransmits was printed.
Definition: ice.h:533
janus_ice_stats::audio
janus_ice_stats_info audio
Audio info.
Definition: ice.h:251
janus_ice_component::video_retransmit_seqs
GHashTable * video_retransmit_seqs
Definition: ice.h:529
janus_ice_component::do_audio_nacks
gboolean do_audio_nacks
Whether we should do NACKs (in or out) for audio.
Definition: ice.h:523
janus_ice_get_turn_rest_api
char * janus_ice_get_turn_rest_api(void)
Method to get the specified TURN REST API backend, if any.
Definition: ice.c:65
janus_ice_handle::srtp_errors_count
guint srtp_errors_count
Count of the recent SRTP replay errors, in order to avoid spamming the logs.
Definition: ice.h:352
janus_ice_stats::sl_lost_count_audio
guint sl_lost_count_audio
Last known count of lost audio packets (for slow_link)
Definition: ice.h:257
janus_ice_stream::transport_wide_cc_out_seq_num
guint16 transport_wide_cc_out_seq_num
Last sent transport wide seq num.
Definition: ice.h:456
utils.h
TURN REST API client.
janus_ice_stream::audio_ssrc_peer_orig
guint32 audio_ssrc_peer_orig
Definition: ice.h:386
SEQ_RECVED
@ SEQ_RECVED
Definition: ice.h:287
janus_ice_stream::cdone
gint cdone
Whether this stream is ready to be used.
Definition: ice.h:378
janus_refcount
Definition: refcount.h:78
sctp.h
SCTP processing for data channels (headers)
janus_ice_stream::video_first_ntp_ts
gint64 video_first_ntp_ts[3]
First received video NTP timestamp (for all simulcast video streams)
Definition: ice.h:430
janus_is_nack_optimizations_enabled
gboolean janus_is_nack_optimizations_enabled(void)
Method to check whether NACK optimizations on outgoing keyframes are enabled or not.
Definition: ice.c:506
janus_ice_stream::audiolevel_ext_id
gint audiolevel_ext_id
Audio levels extension ID.
Definition: ice.h:446
janus_dtls_role
janus_dtls_role
DTLS roles.
Definition: dtls.h:51
janus_ice_component::ref
janus_refcount ref
Reference counter for this instance.
Definition: ice.h:555
janus_seq_info::seq
guint16 seq
Definition: ice.h:277
janus_seq_list_free
void janus_seq_list_free(janus_seq_info **head)
Definition: ice.c:587
janus_ice_component::process_started
gboolean process_started
Whether the setup of remote candidates for this component has started or not.
Definition: ice.h:513
SEQ_GIVEUP
@ SEQ_GIVEUP
Definition: ice.h:286
janus_ice_stream::transport_wide_received_seq_nums
GSList * transport_wide_received_seq_nums
GLib list of transport wide cc stats in reverse received order.
Definition: ice.h:466
janus_ice_component::stream
janus_ice_stream * stream
Janus ICE stream this component belongs to.
Definition: ice.h:495
janus_ice_stream::transport_wide_cc_ext_id
gint transport_wide_cc_ext_id
Transport wide cc rtp ext ID.
Definition: ice.h:454
janus_ice_stream::audio_recv
gboolean audio_recv
Definition: ice.h:414
janus_ice_handle
Janus ICE handle.
Definition: ice.h:292
janus_ice_component::component_id
guint component_id
libnice ICE component ID
Definition: ice.h:499
janus_ice_stream::rid
char * rid[3]
Array of RTP Stream IDs (for Firefox simulcasting, if enabled)
Definition: ice.h:392
janus_ice_stream::video_last_ntp_ts
gint64 video_last_ntp_ts
Last sent video NTP timestamp.
Definition: ice.h:438
janus_get_slowlink_threshold
uint janus_get_slowlink_threshold(void)
Method to get the current slowlink-threshold value (see above)
Definition: ice.c:439
janus_ice_trickle_new
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:752
janus_ice_is_mdns_enabled
gboolean janus_ice_is_mdns_enabled(void)
Method to check whether mDNS resolution is enabled or not.
Definition: ice.c:94
janus_ice_handle::video_mid
gchar * video_mid
Video mid (media ID)
Definition: ice.h:328
janus_ice_component::nack_sent_log_ts
gint64 nack_sent_log_ts
Last time a log message about sending NACKs was printed.
Definition: ice.h:537
janus_ice_component::icefailed_detected
gint64 icefailed_detected
Time of when we first detected an ICE failed (we'll need this for the timer above)
Definition: ice.h:517
janus_ice_component::candidates
GSList * candidates
GLib list of libnice remote candidates for this component.
Definition: ice.h:505
janus_ice_handle::stream_id
guint stream_id
ICE Stream ID.
Definition: ice.h:334
janus_ice_handle::agent
NiceAgent * agent
libnice ICE agent
Definition: ice.h:320
janus_ice_handle::queued_packets
GAsyncQueue * queued_packets
Queue of events in the loop and outgoing packets to send.
Definition: ice.h:350
janus_ice_stream::component
janus_ice_component * component
ICE component.
Definition: ice.h:480
janus_ice_handle::remote_sdp
gchar * remote_sdp
SDP received by the peer (just for debugging purposes)
Definition: ice.h:342
janus_ice_enable_nat_1_1
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:226
text2pcap.h
Dumping of RTP/RTCP packets to text2pcap or pcap format (headers)
janus_ice_stream::video_rtcp_ctx
janus_rtcp_context * video_rtcp_ctx[3]
RTCP context(s) for the video stream (may be simulcasting)
Definition: ice.h:418
janus_set_slowlink_threshold
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:432
janus_ice_restart
void janus_ice_restart(janus_ice_handle *handle)
Method to restart ICE and the connectivity checks.
Definition: ice.c:3701
janus_ice_handle::mainctx
GMainContext * mainctx
GLib context for the handle and libnice.
Definition: ice.h:312
janus_ice_stream::ridrtx_ext_id
gint ridrtx_ext_id
Definition: ice.h:444
janus_enable_opaqueid_in_api
void janus_enable_opaqueid_in_api(void)
Method to enable opaque ID in Janus API responses/events.
Definition: ice.c:108
janus_ice_handle::token
char * token
Token that was used to attach the handle, if required.
Definition: ice.h:300
janus_is_opaqueid_in_api_enabled
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:111
janus_ice_component::selected_pair
gchar * selected_pair
String representation of the selected pair as notified by libnice (foundations)
Definition: ice.h:511
janus_ice_stream::rpass
gchar * rpass
The ICE password for this stream.
Definition: ice.h:476
janus_ice_stream::ruser
gchar * ruser
The ICE username for this stream.
Definition: ice.h:474
janus_ice_handle::handle_id
guint64 handle_id
Handle identifier, guaranteed to be non-zero.
Definition: ice.h:296
janus_ice_stream::handle
janus_ice_handle * handle
Janus ICE handle this stream belongs to.
Definition: ice.h:374
janus_get_dscp
int janus_get_dscp(void)
Method to get the current DSCP value (see above)
Definition: ice.c:467
janus_ice_component::last_seqs_video
janus_seq_info * last_seqs_video[3]
List of recently received video sequence numbers (as a support to NACK generation,...
Definition: ice.h:543
janus_get_twcc_period
uint janus_get_twcc_period(void)
Method to get the current TWCC period (see above)
Definition: ice.c:455
janus_ice_handle_create
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:1183
janus_ice_stats
Janus media statistics container.
Definition: ice.h:249
janus_ice_get_turn_port
uint16_t janus_ice_get_turn_port(void)
Method to get the TURN server port.
Definition: ice.c:59
janus_ice_handle::stats_source
GSource * stats_source
Definition: ice.h:318
janus_ice_stream::do_transport_wide_cc
gboolean do_transport_wide_cc
Whether we do transport wide cc for video.
Definition: ice.h:452
janus_ice_test_stun_server
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:898
janus_ice_handle::session
void * session
Opaque pointer to the core/peer session.
Definition: ice.h:294
janus_seq_info::next
struct janus_seq_info * next
Definition: ice.h:279
janus_rtp_switching_context
RTP context, in order to make sure SSRC changes result in coherent seq/ts increases.
Definition: rtp.h:236
janus_ice_stream::video_ssrc_peer
guint32 video_ssrc_peer[3]
Video SSRC(s) of the peer for this stream (may be simulcasting)
Definition: ice.h:388
janus_ice_stream::rid_ext_id
gint rid_ext_id
RTP Stream extension ID, and the related rtx one.
Definition: ice.h:444
janus_ice_handle::local_sdp
gchar * local_sdp
SDP generated locally (just for debugging purposes)
Definition: ice.h:340
janus_ice_component::audio_retransmit_buffer
GQueue * audio_retransmit_buffer
List of previously sent janus_rtp_packet RTP packets, in case we receive NACKs.
Definition: ice.h:527
janus_ice_stream::audio_ssrc
guint32 audio_ssrc
Audio SSRC of the server for this stream.
Definition: ice.h:380
json_t
struct json_t json_t
Definition: plugin.h:236
janus_ice_set_turn_rest_api
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:1128
janus_ice_component_destroy
void janus_ice_component_destroy(janus_ice_component *component)
Method to only free resources related to a specific ICE component allocated by a Janus ICE handle.
Definition: ice.c:1574
sdp.h
SDP processing (headers)
janus_ice_stream::video_ssrc
guint32 video_ssrc
Video SSRC of the server for this stream.
Definition: ice.h:382
janus_flags
gsize janus_flags
Janus flags container.
Definition: utils.h:116
janus_ice_handle::last_srtp_summary
gint last_srtp_summary
Definition: ice.h:354
janus_ice_handle::app_handle
janus_plugin_session * app_handle
Opaque core/plugin session pointer.
Definition: ice.h:306
janus_ice_stream::transport_wide_cc_cycles
guint16 transport_wide_cc_cycles
Transport wide cc transport seq num wrap cycles.
Definition: ice.h:462
janus_ice_stream::video_rtx_payload_type
gint video_rtx_payload_type
Definition: ice.h:408
janus_ice_stream::audio_last_ntp_ts
gint64 audio_last_ntp_ts
Last sent audio NTP timestamp.
Definition: ice.h:434
janus_seq_info
A helper struct for determining when to send NACKs.
Definition: ice.h:275
janus_dtls_srtp
Janus DTLS-SRTP handle.
Definition: dtls.h:66
janus_ice_stream::remote_hashing
gchar * remote_hashing
Hashing algorhitm used by the peer for the DTLS certificate (e.g., "SHA-256")
Definition: ice.h:470
janus_ice_stream::audio_ssrc_peer_new
guint32 audio_ssrc_peer_new
Definition: ice.h:386
janus_ice_stream::audio_first_ntp_ts
gint64 audio_first_ntp_ts
First received audio NTP timestamp.
Definition: ice.h:426
janus_ice_component::retransmit_recent_cnt
guint retransmit_recent_cnt
Number of retransmitted packets since last log message.
Definition: ice.h:535
janus_ice_stream::video_recv
gboolean video_recv
Definition: ice.h:414
janus_network_address
Structure to hold network addresses in a tagged union which should be IPv4 and IPv6 compatible....
Definition: ip-utils.h:53
janus_ice_component::destroyed
volatile gint destroyed
Atomic flag to check if this instance has been destroyed.
Definition: ice.h:553
janus_ice_stream::videoorientation_ext_id
gint videoorientation_ext_id
Video orientation extension ID.
Definition: ice.h:448
janus_ice_stats_info::packets
guint32 packets
Packets sent or received.
Definition: ice.h:234
janus_set_min_nack_queue
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:511
janus_seq_info
struct janus_seq_info janus_seq_info
A helper struct for determining when to send NACKs.
janus_ice_handle::audio_mid
gchar * audio_mid
Audio mid (media ID)
Definition: ice.h:326
janus_ice_trickle
Helper to handle pending trickle candidates (e.g., when we're still waiting for an offer)
Definition: ice.h:559
janus_ice_handle::stream_mid
gchar * stream_mid
Main mid (will be a pointer to one of the above)
Definition: ice.h:332
janus_ice_incoming_data
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:3085
janus_ice_webrtc_hangup
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:1392
SEQ_MISSING
@ SEQ_MISSING
Definition: ice.h:284
janus_ice_is_ice_debugging_enabled
gboolean janus_ice_is_ice_debugging_enabled(void)
Method to check whether libnice debugging has been enabled (http://nice.freedesktop....
Definition: ice.c:198
janus_ice_component::local_candidates
GSList * local_candidates
GLib list of local candidates for this component (summary)
Definition: ice.h:507
janus_ice_is_full_trickle_enabled
gboolean janus_ice_is_full_trickle_enabled(void)
Method to check whether full-trickle support is enabled or not.
Definition: ice.c:88
janus_ice_component::in_stats
janus_ice_stats in_stats
Stats for incoming data (audio/video/data)
Definition: ice.h:545
janus_ice_stream::video_payload_types
GList * video_payload_types
List of payload types we can expect for video.
Definition: ice.h:402
janus_ice_component::video_retransmit_buffer
GQueue * video_retransmit_buffer
Definition: ice.h:527
janus_get_no_media_timer
uint janus_get_no_media_timer(void)
Method to get the current no-media event timer (see above)
Definition: ice.c:424
janus_ice_component
Janus ICE component.
Definition: ice.h:493
janus_ice_handle::pending_trickles
GList * pending_trickles
List of pending trickle candidates (those we received before getting the JSEP offer)
Definition: ice.h:346
janus_ice_is_ignored
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:271
janus_ice_stream::audio_ssrc_peer
guint32 audio_ssrc_peer
Audio SSRC of the peer for this stream.
Definition: ice.h:386
janus_ice_setup_remote_candidates
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:3336
janus_ice_stream::framemarking_ext_id
gint framemarking_ext_id
Frame marking extension ID.
Definition: ice.h:450
janus_ice_stream::rtx_nacked
GHashTable * rtx_nacked[3]
Map(s) of the NACKed packets (to track retransmissions and avoid duplicates)
Definition: ice.h:422
janus_plugin_rtcp
Janus plugin RTCP packet.
Definition: plugin.h:589
janus_ice_handle::agent_created
gint64 agent_created
Monotonic time of when the ICE agent has been created.
Definition: ice.h:322
janus_ice_handle_attach_plugin
gint janus_ice_handle_attach_plugin(void *core_session, janus_ice_handle *handle, janus_plugin *plugin)
Method to attach a Janus ICE handle to a plugin.
Definition: ice.c:1218
janus_ice_component::out_stats
janus_ice_stats out_stats
Stats for outgoing data (audio/video/data)
Definition: ice.h:547
janus_ice_notify_data_ready
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:4908
refcount.h
Reference counter mechanism.
janus_ice_stats_info::updated
gint64 updated
Time we last updated the last second counter.
Definition: ice.h:240
janus_ice_handle::rtp_profile
gchar * rtp_profile
RTP profile set by caller (so that we can match it)
Definition: ice.h:338
janus_ice_stream::audio_rtcp_ctx
janus_rtcp_context * audio_rtcp_ctx
RTCP context for the audio stream.
Definition: ice.h:416
janus_ice_stream::audio_codec
char * audio_codec
Codecs used by this stream.
Definition: ice.h:410
janus_ice_trickle::received
gint64 received
Monotonic time of when this trickle candidate has been received.
Definition: ice.h:563
janus_ice_stream::audio_payload_types
GList * audio_payload_types
List of payload types we can expect for audio.
Definition: ice.h:400
janus_ice_stream::ref
janus_refcount ref
Reference counter for this instance.
Definition: ice.h:488
janus_ice_get_stun_server
char * janus_ice_get_stun_server(void)
Method to get the STUN server IP address.
Definition: ice.c:42
janus_ice_get_event_stats_period
int janus_ice_get_event_stats_period(void)
Method to get the current event handler statistics period (see above)
Definition: ice.c:294
janus_ice_stats_info::bytes_lastsec
guint32 bytes_lastsec
Bytes sent or received in the last second.
Definition: ice.h:238
janus_seq_info::prev
struct janus_seq_info * prev
Definition: ice.h:280
rtcp.h
RTCP processing (headers)
janus_ice_handle::rtp_source
GSource * rtp_source
GLib sources for outgoing traffic, recurring RTCP, and stats (and optionally TWCC)
Definition: ice.h:318
janus_ice_stream::dtls_role
janus_dtls_role dtls_role
DTLS role of the server for this stream.
Definition: ice.h:468
janus_ice_handle::cdone
gint cdone
Number of gathered candidates.
Definition: ice.h:310
janus_ice_stats_info::notified_lastsec
gboolean notified_lastsec
Whether or not we notified about lastsec issues already.
Definition: ice.h:242
janus_ice_stream::nack_queue_ms
uint16_t nack_queue_ms
Size of the NACK queue (in ms), dynamically updated per the RTT.
Definition: ice.h:420
janus_ice_stream::rtx_payload_types
GHashTable * rtx_payload_types
Mapping of rtx payload types to actual media-related packet types.
Definition: ice.h:404
janus_sdp_mline
SDP m-line representation.
Definition: sdp-utils.h:128
janus_ice_stream::video_is_keyframe
gboolean(* video_is_keyframe)(const char *buffer, int len)
Pointer to function to check if a packet is a keyframe (depends on negotiated codec)
Definition: ice.h:412
janus_ice_stream::video_ssrc_peer_rtx
guint32 video_ssrc_peer_rtx[3]
Video retransmissions SSRC(s) of the peer for this stream.
Definition: ice.h:390
janus_ice_stream::rids_hml
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:394
janus_ice_stream::video_ssrc_peer_temp
guint32 video_ssrc_peer_temp
Definition: ice.h:388
janus_ice_stream::clock_rates
GHashTable * clock_rates
Mapping of payload types to their clock rates, as advertised in the SDP.
Definition: ice.h:406
janus_set_dscp
void janus_set_dscp(int dscp)
Method to modify the DSCP value to set, which is disabled by default.
Definition: ice.c:461
janus_ice_stream::video_ssrc_peer_rtx_orig
guint32 video_ssrc_peer_rtx_orig[3]
Definition: ice.h:390
SEQ_NACKED
@ SEQ_NACKED
Definition: ice.h:285
ip-utils.h
IP address related utility functions (headers)
janus_get_ice_state_name
const gchar * janus_get_ice_state_name(gint state)
Helper method to get a string representation of a libnice ICE state.
Definition: ice.c:1155
janus_ice_relay_sctp
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:4888
janus_mutex
GMutex janus_mutex
Janus mutex implementation.
Definition: mutex.h:61
janus_ice_handle::last_event_stats
gint last_event_stats
Count of how many seconds passed since the last stats passed to event handlers.
Definition: ice.h:356
janus_ice_stats
struct janus_ice_stats janus_ice_stats
Janus media statistics container.
janus_ice_handle::rtcp_source
GSource * rtcp_source
Definition: ice.h:318
janus_ice_handle::thread
GThread * thread
GLib thread for the handle and libnice.
Definition: ice.h:316
janus_ice_stream::components
GHashTable * components
GLib hash table of components (IDs are the keys)
Definition: ice.h:478
janus_ice_resend_trickles
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:3711
janus_ice_set_turn_server
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:1078
janus_ice_stats_info
Janus media statistics.
Definition: ice.h:232
janus_ice_handle::app
void * app
Opaque application (plugin) pointer.
Definition: ice.h:304
janus_ice_handle::ref
janus_refcount ref
Reference counter for this instance.
Definition: ice.h:368
janus_ice_component::remote_candidates
GSList * remote_candidates
GLib list of remote candidates for this component (summary)
Definition: ice.h:509
janus_ice_handle::webrtc_flags
janus_flags webrtc_flags
Mask of WebRTC-related flags for this handle.
Definition: ice.h:308
janus_ice_stop_static_event_loops
void janus_ice_stop_static_event_loops(void)
Method to stop all the static event loops, if enabled.
Definition: ice.c:179
janus_ice_stream::audio_first_rtp_ts
guint32 audio_first_rtp_ts
First received audio RTP timestamp.
Definition: ice.h:428
janus_text2pcap
Instance of a text2pcap recorder.
Definition: text2pcap.h:49
janus_ice_handle::opaque_id
char * opaque_id
Opaque identifier, e.g., to provide inter-handle relationships to external tools.
Definition: ice.h:298
janus_ice_stream::video_send
gboolean video_send
Definition: ice.h:414
janus_set_nack_optimizations_enabled
void janus_set_nack_optimizations_enabled(gboolean optimize)
Method to enable/disable the NACK optimizations on outgoing keyframes: when enabled,...
Definition: ice.c:503
janus_ice_handle::hangup_reason
const gchar * hangup_reason
Reason this handle has been hung up.
Definition: ice.h:344
janus_ice_component::stream_id
guint stream_id
libnice ICE stream ID
Definition: ice.h:497