Janus handles and ICE/STUN/TURN processing. More...
#include <ifaddrs.h>
#include <poll.h>
#include <net/if.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netdb.h>
#include <fcntl.h>
#include <stun/usages/bind.h>
#include <nice/debug.h>
#include "janus.h"
#include "debug.h"
#include "ice.h"
#include "turnrest.h"
#include "sdp.h"
#include "rtpsrtp.h"
#include "rtcp.h"
#include "apierror.h"
#include "ip-utils.h"
#include "events.h"
Data Structures | |
struct | janus_ice_static_event_loop |
struct | janus_ice_queued_packet |
struct | janus_ice_nacked_packet |
struct | janus_ice_outgoing_traffic |
Macros | |
#define | JANUS_ICE_PACKET_AUDIO 0 |
#define | JANUS_ICE_PACKET_VIDEO 1 |
#define | JANUS_ICE_PACKET_TEXT 2 |
#define | JANUS_ICE_PACKET_BINARY 3 |
#define | JANUS_ICE_PACKET_SCTP 4 |
#define | DEFAULT_NO_MEDIA_TIMER 1 |
#define | DEFAULT_SLOWLINK_THRESHOLD 0 |
#define | DEFAULT_TWCC_PERIOD 200 |
#define | DEFAULT_MIN_NACK_QUEUE 200 |
#define | DEFAULT_MAX_NACK_QUEUE 1000 |
#define | MAX_NACK_IGNORE 200000 |
#define | SEQ_MISSING_WAIT 12000 /* 12ms */ |
#define | SEQ_NACKED_WAIT 155000 /* 155ms */ |
Typedefs | |
typedef struct janus_ice_static_event_loop | janus_ice_static_event_loop |
typedef struct janus_ice_queued_packet | janus_ice_queued_packet |
typedef struct janus_ice_nacked_packet | janus_ice_nacked_packet |
typedef struct janus_ice_outgoing_traffic | janus_ice_outgoing_traffic |
Functions | |
char * | janus_ice_get_stun_server (void) |
Method to get the STUN server IP address. | |
uint16_t | janus_ice_get_stun_port (void) |
Method to get the STUN server port. | |
char * | janus_ice_get_turn_server (void) |
Method to get the TURN server IP address. | |
uint16_t | janus_ice_get_turn_port (void) |
Method to get the TURN server port. | |
char * | janus_ice_get_turn_rest_api (void) |
Method to get the specified TURN REST API backend, if any. | |
void | janus_ice_allow_force_relay (void) |
Method to enable applications to force Janus to use TURN. | |
gboolean | janus_ice_is_force_relay_allowed (void) |
Method to check whether applications are allowed to force Janus to use TURN. | |
gboolean | janus_ice_is_ice_lite_enabled (void) |
Method to check whether ICE Lite mode is enabled or not (still WIP) | |
gboolean | janus_ice_is_ice_tcp_enabled (void) |
Method to check whether ICE-TCP support is enabled/supported or not (still WIP) | |
gboolean | janus_ice_is_full_trickle_enabled (void) |
Method to check whether full-trickle support is enabled or not. | |
gboolean | janus_ice_is_mdns_enabled (void) |
Method to check whether mDNS resolution is enabled or not. | |
gboolean | janus_ice_is_ipv6_enabled (void) |
Method to check whether IPv6 candidates are enabled/supported or not. | |
gboolean | janus_ice_is_ipv6_linklocal_enabled (void) |
Method to check whether IPv6 link-local candidates will be gathered or not. | |
void | janus_ice_set_consent_freshness_enabled (gboolean enabled) |
Method to enable/disable consent freshness in PeerConnections. | |
gboolean | janus_ice_is_consent_freshness_enabled (void) |
Method to check whether consent fresnhess will be enabled in ICE. | |
void | janus_ice_set_keepalive_conncheck_enabled (gboolean enabled) |
Method to enable/disable connectivity checks as keepalives for PeerConnections. | |
gboolean | janus_ice_is_keepalive_conncheck_enabled (void) |
Method to check whether connectivity checks will be used as keepalives. | |
void | janus_ice_set_hangup_on_failed_enabled (gboolean enabled) |
Method to enable/disable immediate hangups of PeerConnectionss on ICE failures. | |
gboolean | janus_ice_is_hangup_on_failed_enabled (void) |
Method to check whether ICE failures will result in immediate hangups. | |
void | janus_enable_opaqueid_in_api (void) |
Method to enable opaque ID in Janus API responses/events. | |
gboolean | janus_is_opaqueid_in_api_enabled (void) |
Method to check whether opaque ID have to be added to Janus API responses/events. | |
int | janus_ice_get_static_event_loops (void) |
Method to return the number of static event loops, if enabled. | |
gboolean | janus_ice_is_loop_indication_allowed (void) |
Method to check whether loop indication via API is allowed. | |
void | janus_ice_set_static_event_loops (int loops, gboolean allow_api) |
Method to configure the static event loops mechanism at startup. | |
json_t * | janus_ice_static_event_loops_info (void) |
Helper method to return a summary of the static loops activity. | |
void | janus_ice_stop_static_event_loops (void) |
Method to stop all the static event loops, if enabled. | |
gboolean | janus_ice_is_ice_debugging_enabled (void) |
Method to check whether libnice debugging has been enabled (http://nice.freedesktop.org/libnice/libnice-Debug-messages.html) | |
void | janus_ice_debugging_enable (void) |
Method to enable libnice debugging (http://nice.freedesktop.org/libnice/libnice-Debug-messages.html) | |
void | janus_ice_debugging_disable (void) |
Method to disable libnice debugging (the default) | |
void | janus_ice_enable_nat_1_1 (gboolean kph) |
Helper method to force Janus to overwrite all host candidates with the public IP. | |
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 and ignore the others) | |
gboolean | janus_ice_is_enforced (const char *ip) |
Method to check whether an interface is currently in the enforce list for ICE (that is, won't have candidates) | |
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) | |
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, won't have candidates) | |
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 before Janus notifies event handlers about media statistics for a PeerConnection) | |
int | janus_ice_get_event_stats_period (void) |
Method to get the current event handler statistics period (see above) | |
void | janus_ice_event_set_combine_media_stats (gboolean combine_media_stats_to_one_event) |
Method to define whether the media stats shall be dispatched in one event (true) or in dedicated single events (false - default) | |
gboolean | janus_ice_event_get_combine_media_stats (void) |
Method to retrieve whether media statistic events shall be dispatched combined or in single events. | |
int | janus_ice_get_peerconnection_num (void) |
Method to get the number of active PeerConnection (for stats) | |
const char * | janus_media_type_str (janus_media_type type) |
Helper method to get the string associated to a janus_media_mtype value. | |
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 Janus notifies this) | |
uint | janus_get_no_media_timer (void) |
Method to get the current no-media event timer (see above) | |
void | janus_set_slowlink_threshold (uint packets) |
Method to modify the slowlink-threshold property (i.e., the number of lost packets per seconds that should trigger a slow-link event) | |
uint | janus_get_slowlink_threshold (void) |
Method to get the current slowlink-threshold value (see above) | |
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 senders) | |
uint | janus_get_twcc_period (void) |
Method to get the current TWCC period (see above) | |
void | janus_set_dscp (int dscp) |
Method to modify the DSCP value to set, which is disabled by default. | |
int | janus_get_dscp (void) |
Method to get the current DSCP value (see above) | |
void | janus_set_nack_optimizations_enabled (gboolean optimize) |
Method to enable/disable the NACK optimizations on outgoing keyframes: when enabled, the NACK buffer for a PeerConnection is cleaned any time Janus sends a keyframe, as any missing packet won't be needed since the keyframe will allow the media recipient to still restore a complete image anyway. Since this optimization seems to cause some issues in some edge cases, it's disabled by default. | |
gboolean | janus_is_nack_optimizations_enabled (void) |
Method to check whether NACK optimizations on outgoing keyframes are enabled or not. | |
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 retransmissions) | |
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 store for retransmissions) | |
void | janus_seq_list_free (janus_seq_info **head) |
void | janus_ice_relay_rtcp_internal (janus_ice_handle *handle, janus_ice_peerconnection_medium *medium, janus_plugin_rtcp *packet, gboolean filter_rtcp) |
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. | |
void | janus_ice_notify_hangup (janus_ice_handle *handle, const char *reason) |
Quick helper method to notify a WebRTC hangup through the Janus API. | |
janus_ice_trickle * | janus_ice_trickle_new (const char *transaction, json_t *candidate) |
Helper method to allocate a janus_ice_trickle instance. | |
gint | janus_ice_trickle_parse (janus_ice_handle *handle, json_t *candidate, const char **error) |
Helper method to parse trickle candidates. | |
void | janus_ice_trickle_destroy (janus_ice_trickle *trickle) |
Helper method to destroy a janus_ice_trickle instance. | |
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. | |
void | janus_ice_deinit (void) |
ICE stuff de-initialization. | |
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. | |
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. | |
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. | |
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 candidates. The TURN REST API takes precedence over any static credential passed via janus_ice_set_turn_server. | |
const gchar * | janus_get_ice_state_name (gint state) |
Helper method to get a string representation of a libnice ICE state. | |
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. | |
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. | |
gint | janus_ice_handle_destroy (void *core_session, janus_ice_handle *handle) |
Method to destroy a Janus ICE handle. | |
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. | |
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 handle. | |
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. | |
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. | |
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. | |
void | janus_ice_add_remote_candidate (janus_ice_handle *handle, NiceCandidate *c) |
Method to queue a remote candidate for processing. | |
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. | |
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) | |
void | janus_ice_restart (janus_ice_handle *handle) |
Method to restart ICE and the connectivity checks. | |
void | janus_ice_resend_trickles (janus_ice_handle *handle) |
Method to resend all the existing candidates via trickle (e.g., after an ICE restart) | |
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. | |
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. | |
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. | |
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 peer. | |
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. | |
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. | |
void | janus_ice_notify_data_ready (janus_ice_handle *handle) |
Plugin SCTP/DataChannel callback, called by the SCTP stack when data can be written. | |
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. | |
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. | |
Variables | |
GList * | janus_ice_enforce_list = NULL |
GList * | janus_ice_ignore_list = NULL |
janus_mutex | ice_list_mutex |
Janus handles and ICE/STUN/TURN processing.
A Janus handle represents an abstraction of the communication between a user and a specific plugin, within a Janus session. This is particularly important in terms of media connectivity, as each handle can be associated with a single WebRTC PeerConnection. This code also contains the implementation (based on libnice) of a WebRTC PeerConnection. The code handles the whole ICE process, from the gathering of candidates to the final setup of a virtual channel RTP and RTCP can be transported on. Incoming RTP and RTCP packets from peers are relayed to the associated plugins by means of the incoming_rtp and incoming_rtcp callbacks. Packets to be sent to peers are relayed by peers invoking the relay_rtp and relay_rtcp core callbacks instead.
#define DEFAULT_MAX_NACK_QUEUE 1000 |
#define DEFAULT_MIN_NACK_QUEUE 200 |
#define DEFAULT_NO_MEDIA_TIMER 1 |
#define DEFAULT_SLOWLINK_THRESHOLD 0 |
#define DEFAULT_TWCC_PERIOD 200 |
#define JANUS_ICE_PACKET_AUDIO 0 |
#define JANUS_ICE_PACKET_BINARY 3 |
#define JANUS_ICE_PACKET_SCTP 4 |
#define JANUS_ICE_PACKET_TEXT 2 |
#define JANUS_ICE_PACKET_VIDEO 1 |
#define MAX_NACK_IGNORE 200000 |
#define SEQ_MISSING_WAIT 12000 /* 12ms */ |
#define SEQ_NACKED_WAIT 155000 /* 155ms */ |
typedef struct janus_ice_nacked_packet janus_ice_nacked_packet |
typedef struct janus_ice_outgoing_traffic janus_ice_outgoing_traffic |
typedef struct janus_ice_queued_packet janus_ice_queued_packet |
typedef struct janus_ice_static_event_loop janus_ice_static_event_loop |
void janus_enable_opaqueid_in_api | ( | void | ) |
Method to enable opaque ID in Janus API responses/events.
int janus_get_dscp | ( | void | ) |
Method to get the current DSCP value (see above)
const gchar * janus_get_ice_state_name | ( | gint | state | ) |
Helper method to get a string representation of a libnice ICE state.
[in] | state | The libnice ICE state |
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 store for retransmissions)
uint janus_get_no_media_timer | ( | void | ) |
Method to get the current no-media event timer (see above)
uint janus_get_slowlink_threshold | ( | void | ) |
Method to get the current slowlink-threshold value (see above)
uint janus_get_twcc_period | ( | void | ) |
Method to get the current TWCC period (see above)
void janus_ice_add_remote_candidate | ( | janus_ice_handle * | handle, |
NiceCandidate * | c ) |
Method to queue a remote candidate for processing.
[in] | handle | The Janus ICE handle this method refers to |
[in] | c | The remote NiceCandidate to process |
void janus_ice_allow_force_relay | ( | void | ) |
Method to enable applications to force Janus to use TURN.
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.
[in] | handle | The Janus ICE handle this method refers to |
[in] | mline | The Janus SDP m-line object to add candidates to |
[in] | stream_id | The stream ID of the candidate to add to the SDP |
[in] | component_id | The component ID of the candidate to add to the SDP |
void janus_ice_debugging_disable | ( | void | ) |
Method to disable libnice debugging (the default)
void janus_ice_debugging_enable | ( | void | ) |
Method to enable libnice debugging (http://nice.freedesktop.org/libnice/libnice-Debug-messages.html)
void janus_ice_deinit | ( | void | ) |
ICE stuff de-initialization.
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.
This method also decides when to notify attached plugins about the availability of a reliable PeerConnection
[in] | handle | The Janus ICE handle this callback refers to |
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.
[in] | keep_private_host | Whether we should keep the original private host as a separate candidate, or replace it |
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 and ignore the others)
[in] | ip | Interface/IP to enforce (e.g., 192.168. or eth0) |
gboolean janus_ice_event_get_combine_media_stats | ( | void | ) |
Method to retrieve whether media statistic events shall be dispatched combined or in single events.
void janus_ice_event_set_combine_media_stats | ( | gboolean | combine_media_stats_to_one_event | ) |
Method to define whether the media stats shall be dispatched in one event (true) or in dedicated single events (false - default)
[in] | combine_media_stats_to_one_event | true to combine media statistics in on event or false to send dedicated events |
int janus_ice_get_event_stats_period | ( | void | ) |
Method to get the current event handler statistics period (see above)
int janus_ice_get_peerconnection_num | ( | void | ) |
Method to get the number of active PeerConnection (for stats)
int janus_ice_get_static_event_loops | ( | void | ) |
Method to return the number of static event loops, if enabled.
uint16_t janus_ice_get_stun_port | ( | void | ) |
Method to get the STUN server port.
char * janus_ice_get_stun_server | ( | void | ) |
Method to get the STUN server IP address.
uint16_t janus_ice_get_turn_port | ( | void | ) |
Method to get the TURN server port.
char * janus_ice_get_turn_rest_api | ( | void | ) |
Method to get the specified TURN REST API backend, if any.
char * janus_ice_get_turn_server | ( | void | ) |
Method to get the TURN server IP address.
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.
This method is very important, as it allows plugins to send/receive media (RTP/RTCP) to/from a WebRTC peer.
[in] | core_session | The core/peer session this ICE handle belongs to |
[in] | handle | The Janus ICE handle |
[in] | plugin | The plugin the ICE handle needs to be attached to |
[in] | loop_index | In case static event loops are used, an indication on which loop to use for this handle (-1 will let the core pick one; in case API selection is disabled in the settings, this value is ignored) |
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.
[in] | core_session | The core/peer session this ICE handle will belong to |
[in] | opaque_id | The opaque identifier provided by the creator, if any (optional) |
[in] | token | The auth token provided by the creator, if any (optional) |
gint janus_ice_handle_destroy | ( | void * | core_session, |
janus_ice_handle * | handle ) |
Method to destroy a Janus ICE handle.
[in] | core_session | The core/peer session this ICE handle belongs to |
[in] | handle | The Janus ICE handle to destroy |
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)
[in] | ip | Interface/IP to ignore (e.g., 192.168. or eth1) |
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.
[in] | handle | The Janus ICE handle associated with the peer |
[in] | label | The label of the data channel the message is from |
[in] | protocol | The protocol of the data channel to use |
[in] | textdata | Whether the buffer is text (domstring) or binary data |
[in] | buffer | The message data (buffer) |
[in] | length | The buffer length |
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.
[in] | ice_lite | Whether the ICE Lite mode should be enabled or not |
[in] | ice_tcp | Whether ICE-TCP support should be enabled or not (only libnice >= 0.1.8, currently broken) |
[in] | full_trickle | Whether full-trickle must be used (instead of half-trickle) |
[in] | ignore_mdns | Whether mDNS candidates should be ignored, instead of resolved |
[in] | ipv6 | Whether IPv6 candidates must be negotiated or not |
[in] | ipv6_linklocal | Whether IPv6 link-local candidates should be gathered |
[in] | rtp_min_port | Minimum port to use for RTP/RTCP, if a range is to be used |
[in] | rtp_max_port | Maximum port to use for RTP/RTCP, if a range is to be used |
nice_agent_set_port_range
so this is checked by the install.sh script in advance.gboolean janus_ice_is_consent_freshness_enabled | ( | void | ) |
Method to check whether consent fresnhess will be enabled in ICE.
gboolean janus_ice_is_enforced | ( | const char * | ip | ) |
Method to check whether an interface is currently in the enforce list for ICE (that is, won't have candidates)
[in] | ip | Interface/IP to check (e.g., 192.168.244.1 or eth1) |
gboolean janus_ice_is_force_relay_allowed | ( | void | ) |
Method to check whether applications are allowed to force Janus to use TURN.
gboolean janus_ice_is_full_trickle_enabled | ( | void | ) |
Method to check whether full-trickle support is enabled or not.
gboolean janus_ice_is_hangup_on_failed_enabled | ( | void | ) |
Method to check whether ICE failures will result in immediate hangups.
gboolean janus_ice_is_ice_debugging_enabled | ( | void | ) |
Method to check whether libnice debugging has been enabled (http://nice.freedesktop.org/libnice/libnice-Debug-messages.html)
gboolean janus_ice_is_ice_lite_enabled | ( | void | ) |
Method to check whether ICE Lite mode is enabled or not (still WIP)
gboolean janus_ice_is_ice_tcp_enabled | ( | void | ) |
Method to check whether ICE-TCP support is enabled/supported or not (still WIP)
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, won't have candidates)
[in] | ip | Interface/IP to check (e.g., 192.168.244.1 or eth1) |
gboolean janus_ice_is_ipv6_enabled | ( | void | ) |
Method to check whether IPv6 candidates are enabled/supported or not.
gboolean janus_ice_is_ipv6_linklocal_enabled | ( | void | ) |
Method to check whether IPv6 link-local candidates will be gathered or not.
gboolean janus_ice_is_keepalive_conncheck_enabled | ( | void | ) |
Method to check whether connectivity checks will be used as keepalives.
gboolean janus_ice_is_loop_indication_allowed | ( | void | ) |
Method to check whether loop indication via API is allowed.
gboolean janus_ice_is_mdns_enabled | ( | void | ) |
Method to check whether mDNS resolution is enabled or not.
void janus_ice_notify_data_ready | ( | janus_ice_handle * | handle | ) |
Plugin SCTP/DataChannel callback, called by the SCTP stack when data can be written.
[in] | handle | The Janus ICE handle associated with the peer |
void janus_ice_notify_hangup | ( | janus_ice_handle * | handle, |
const char * | reason ) |
Quick helper method to notify a WebRTC hangup through the Janus API.
handle | The janus_ice_handle instance this event refers to |
reason | A description of why this happened |
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.
[in] | handle | The Janus ICE handle associated with the peer |
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 handle.
[in] | pc | The Janus ICE component instance to free |
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.
[in] | handle | The Janus handle instance to add the medium to |
[in] | type | The medium type |
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.
[in] | handle | The Janus ICE handle associated with the peer |
[in] | packet | The RTCP message to send |
void janus_ice_relay_rtcp_internal | ( | janus_ice_handle * | handle, |
janus_ice_peerconnection_medium * | medium, | ||
janus_plugin_rtcp * | packet, | ||
gboolean | filter_rtcp ) |
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.
[in] | handle | The Janus ICE handle associated with the peer |
[in] | packet | The RTP packet to send |
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.
[in] | handle | The Janus ICE handle associated with the peer |
[in] | buffer | The message data (buffer) |
[in] | length | The buffer length |
void janus_ice_resend_trickles | ( | janus_ice_handle * | handle | ) |
Method to resend all the existing candidates via trickle (e.g., after an ICE restart)
[in] | handle | The Janus ICE handle this method refers to |
void janus_ice_restart | ( | janus_ice_handle * | handle | ) |
Method to restart ICE and the connectivity checks.
[in] | handle | The Janus ICE handle this method refers to |
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.
[in] | handle | The Janus ICE handle associated with the peer |
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 peer.
[in] | handle | The Janus ICE handle associated with the peer |
[in] | mindex | Index of the stream to send the PLI to (relative to the SDP) |
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.
[in] | handle | The Janus ICE handle associated with the peer |
[in] | bitrate | The bitrate value to put in the REMB message |
void janus_ice_set_consent_freshness_enabled | ( | gboolean | enabled | ) |
Method to enable/disable consent freshness in PeerConnections.
[in] | enabled | Whether the functionality should be enabled or disabled |
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 before Janus notifies event handlers about media statistics for a PeerConnection)
[in] | period | The new period value, in seconds |
void janus_ice_set_hangup_on_failed_enabled | ( | gboolean | enabled | ) |
Method to enable/disable immediate hangups of PeerConnectionss on ICE failures.
[in] | enabled | Whether the functionality should be enabled or disabled |
void janus_ice_set_keepalive_conncheck_enabled | ( | gboolean | enabled | ) |
Method to enable/disable connectivity checks as keepalives for PeerConnections.
[in] | enabled | Whether the functionality should be enabled or disabled |
void janus_ice_set_static_event_loops | ( | int | loops, |
gboolean | allow_api ) |
Method to configure the static event loops mechanism at startup.
event_loops
property in the janus.jcfg
configuration for an explanation of this feature, and the possible impact on Janus and users [in] | loops | The number of static event loops to start (0 to disable the feature) |
[in] | allow_api | Whether allocation on a specific loop driven via API should be allowed or not (false by default) |
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.
[in] | stun_server | STUN server address to use |
[in] | stun_port | STUN port to use |
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 candidates. The TURN REST API takes precedence over any static credential passed via janus_ice_set_turn_server.
[in] | api_server | TURN REST API backend (NULL to disable the API) |
[in] | api_key | API key to use, if required |
[in] | api_method | HTTP method to use (POST by default) |
[in] | api_timeout | total timeout for HTTP method in seconds |
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.
[in] | turn_server | TURN server address to use |
[in] | turn_port | TURN port to use |
[in] | turn_type | Relay type (udp, tcp or tls) |
[in] | turn_user | TURN username, if needed |
[in] | turn_pwd | TURN password, if needed |
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)
[in] | handle | The Janus ICE handle this method refers to |
[in] | offer | Whether this is for an OFFER or an ANSWER |
[in] | trickle | Whether ICE trickling is supported or not |
[in] | dtls_role | The DTLS role that should be taken for this PeerConnection |
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.
[in] | handle | The Janus ICE handle this method refers to |
[in] | stream_id | The stream ID of the candidate to add to the SDP |
[in] | component_id | The component ID of the candidate to add to the SDP |
json_t * janus_ice_static_event_loops_info | ( | void | ) |
Helper method to return a summary of the static loops activity.
void janus_ice_stop_static_event_loops | ( | void | ) |
Method to stop all the static event loops, if enabled.
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.
[in] | addr | Address of the STUN server as a janus_network_address instance |
[in] | port | Port of the STUN server |
[in] | local_port | Local port to bind to (0 means random choice) |
[out] | public_addr | Public address returned by the STUN server as a janus_network_address instance |
[out] | public_port | Public port returned by the STUN server |
void janus_ice_trickle_destroy | ( | janus_ice_trickle * | trickle | ) |
Helper method to destroy a janus_ice_trickle instance.
[in] | trickle | The janus_ice_trickle instance to destroy |
janus_ice_trickle * janus_ice_trickle_new | ( | const char * | transaction, |
json_t * | candidate ) |
Helper method to allocate a janus_ice_trickle instance.
[in] | transaction | The Janus API ID of the original trickle request |
[in] | candidate | The trickle candidate, as a Jansson object |
gint janus_ice_trickle_parse | ( | janus_ice_handle * | handle, |
json_t * | candidate, | ||
const char ** | error ) |
Helper method to parse trickle candidates.
[in] | handle | The Janus ICE handle this candidate belongs to |
[in] | candidate | The trickle candidate to parse, as a Jansson object |
[in,out] | error | Error string describing the failure, if any |
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.
[in] | handle | The Janus ICE handle instance managing the WebRTC PeerConnection to hangup |
[in] | reason | A description of why this happened |
gboolean janus_is_nack_optimizations_enabled | ( | void | ) |
Method to check whether NACK optimizations on outgoing keyframes are enabled or not.
gboolean janus_is_opaqueid_in_api_enabled | ( | void | ) |
Method to check whether opaque ID have to be added to Janus API responses/events.
const char * janus_media_type_str | ( | janus_media_type | type | ) |
Helper method to get the string associated to a janus_media_mtype value.
[in] | type | The type to stringify |
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.
plugin_session | The janus_plugin_session instance to validate |
void janus_seq_list_free | ( | janus_seq_info ** | head | ) |
void janus_set_dscp | ( | int | dscp | ) |
Method to modify the DSCP value to set, which is disabled by default.
[in] | dscp | The new DSCP value (0 to disable) |
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 retransmissions)
[in] | mnq | The new min NACK value |
void janus_set_nack_optimizations_enabled | ( | gboolean | optimize | ) |
Method to enable/disable the NACK optimizations on outgoing keyframes: when enabled, the NACK buffer for a PeerConnection is cleaned any time Janus sends a keyframe, as any missing packet won't be needed since the keyframe will allow the media recipient to still restore a complete image anyway. Since this optimization seems to cause some issues in some edge cases, it's disabled by default.
[in] | optimize | Whether the optimization should be enabled or disabled |
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 Janus notifies this)
[in] | timer | The new timer value, in seconds |
void janus_set_slowlink_threshold | ( | uint | packets | ) |
Method to modify the slowlink-threshold property (i.e., the number of lost packets per seconds that should trigger a slow-link event)
[in] | packets | The new value, in lost packets per seconds |
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 senders)
[in] | period | The new period value, in milliseconds |
janus_mutex ice_list_mutex |
GList* janus_ice_enforce_list = NULL |
GList * janus_ice_ignore_list = NULL |