Fork me on GitHub
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
janus_audiobridge.c File Reference

Janus AudioBridge plugin. More...

#include "plugin.h"
#include <jansson.h>
#include <opus/opus.h>
#include "audiobridge-deps/speex/speex_jitter.h"
#include "audiobridge-deps/speex/speex_resampler.h"
#include <arpa/inet.h>
#include <net/if.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/time.h>
#include <poll.h>
#include "../debug.h"
#include "../apierror.h"
#include "../config.h"
#include "../mutex.h"
#include "../rtp.h"
#include "../rtpsrtp.h"
#include "../rtcp.h"
#include "../record.h"
#include "../sdp-utils.h"
#include "../utils.h"
#include "../ip-utils.h"
Include dependency graph for janus_audiobridge.c:

Data Structures

struct  janus_audiobridge_message
 
struct  janus_audiobridge_room
 
struct  janus_audiobridge_session
 
struct  janus_audiobridge_plainrtp_media
 
struct  janus_audiobridge_participant
 
struct  janus_audiobridge_rtp_relay_packet
 
struct  janus_audiobridge_buffer_packet
 
struct  janus_audiobridge_rtp_forwarder
 
struct  wav_header
 

Macros

#define JANUS_AUDIOBRIDGE_VERSION   13
 
#define JANUS_AUDIOBRIDGE_VERSION_STRING   "0.0.13"
 
#define JANUS_AUDIOBRIDGE_DESCRIPTION   "This is a plugin implementing an audio conference bridge for Janus, mixing Opus streams."
 
#define JANUS_AUDIOBRIDGE_NAME   "JANUS AudioBridge plugin"
 
#define JANUS_AUDIOBRIDGE_AUTHOR   "Meetecho s.r.l."
 
#define JANUS_AUDIOBRIDGE_PACKAGE   "janus.plugin.audiobridge"
 
#define MIN_SEQUENTIAL   2
 
#define MAX_MISORDER   50
 
#define JANUS_AUDIOBRIDGE_MAX_GROUPS   5
 
#define JANUS_AUDIOBRIDGE_DEFAULT_RTP_RANGE_MIN   10000
 
#define JANUS_AUDIOBRIDGE_DEFAULT_RTP_RANGE_MAX   60000
 
#define OPUS_SAMPLES   960
 
#define G711_SAMPLES   160
 
#define BUFFER_SAMPLES   OPUS_SAMPLES*12
 
#define DEFAULT_COMPLEXITY   4
 
#define JITTER_BUFFER_MIN_PACKETS   2
 
#define JITTER_BUFFER_MAX_PACKETS   50
 
#define JITTER_BUFFER_CHECK_USECS   1*G_USEC_PER_SEC
 
#define QUEUE_IN_MAX_PACKETS   4
 
#define JANUS_AUDIOBRIDGE_ERROR_UNKNOWN_ERROR   499
 
#define JANUS_AUDIOBRIDGE_ERROR_NO_MESSAGE   480
 
#define JANUS_AUDIOBRIDGE_ERROR_INVALID_JSON   481
 
#define JANUS_AUDIOBRIDGE_ERROR_INVALID_REQUEST   482
 
#define JANUS_AUDIOBRIDGE_ERROR_MISSING_ELEMENT   483
 
#define JANUS_AUDIOBRIDGE_ERROR_INVALID_ELEMENT   484
 
#define JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_ROOM   485
 
#define JANUS_AUDIOBRIDGE_ERROR_ROOM_EXISTS   486
 
#define JANUS_AUDIOBRIDGE_ERROR_NOT_JOINED   487
 
#define JANUS_AUDIOBRIDGE_ERROR_LIBOPUS_ERROR   488
 
#define JANUS_AUDIOBRIDGE_ERROR_UNAUTHORIZED   489
 
#define JANUS_AUDIOBRIDGE_ERROR_ID_EXISTS   490
 
#define JANUS_AUDIOBRIDGE_ERROR_ALREADY_JOINED   491
 
#define JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_USER   492
 
#define JANUS_AUDIOBRIDGE_ERROR_INVALID_SDP   493
 
#define JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_GROUP   494
 

Typedefs

typedef struct janus_audiobridge_message janus_audiobridge_message
 
typedef struct janus_audiobridge_room janus_audiobridge_room
 
typedef struct janus_audiobridge_session janus_audiobridge_session
 
typedef struct janus_audiobridge_plainrtp_media janus_audiobridge_plainrtp_media
 
typedef struct janus_audiobridge_participant janus_audiobridge_participant
 
typedef struct janus_audiobridge_rtp_relay_packet janus_audiobridge_rtp_relay_packet
 
typedef struct janus_audiobridge_buffer_packet janus_audiobridge_buffer_packet
 
typedef struct janus_audiobridge_rtp_forwarder janus_audiobridge_rtp_forwarder
 
typedef struct wav_header wav_header
 

Functions

janus_plugincreate (void)
 
int janus_audiobridge_init (janus_callbacks *callback, const char *config_path)
 
void janus_audiobridge_destroy (void)
 
int janus_audiobridge_get_api_compatibility (void)
 
int janus_audiobridge_get_version (void)
 
const char * janus_audiobridge_get_version_string (void)
 
const char * janus_audiobridge_get_description (void)
 
const char * janus_audiobridge_get_name (void)
 
const char * janus_audiobridge_get_author (void)
 
const char * janus_audiobridge_get_package (void)
 
void janus_audiobridge_create_session (janus_plugin_session *handle, int *error)
 
struct janus_plugin_resultjanus_audiobridge_handle_message (janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep)
 
json_tjanus_audiobridge_handle_admin_message (json_t *message)
 
void janus_audiobridge_setup_media (janus_plugin_session *handle)
 
void janus_audiobridge_incoming_rtp (janus_plugin_session *handle, janus_plugin_rtp *packet)
 
void janus_audiobridge_incoming_rtcp (janus_plugin_session *handle, janus_plugin_rtcp *packet)
 
void janus_audiobridge_hangup_media (janus_plugin_session *handle)
 
void janus_audiobridge_destroy_session (janus_plugin_session *handle, int *error)
 
json_tjanus_audiobridge_query_session (janus_plugin_session *handle)
 

Detailed Description

Janus AudioBridge plugin.

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

Check the AudioBridge plugin documentation for more details.

Plugins

Macro Definition Documentation

◆ BUFFER_SAMPLES

#define BUFFER_SAMPLES   OPUS_SAMPLES*12

◆ DEFAULT_COMPLEXITY

#define DEFAULT_COMPLEXITY   4

◆ G711_SAMPLES

#define G711_SAMPLES   160

◆ JANUS_AUDIOBRIDGE_AUTHOR

#define JANUS_AUDIOBRIDGE_AUTHOR   "Meetecho s.r.l."

◆ JANUS_AUDIOBRIDGE_DEFAULT_RTP_RANGE_MAX

#define JANUS_AUDIOBRIDGE_DEFAULT_RTP_RANGE_MAX   60000

◆ JANUS_AUDIOBRIDGE_DEFAULT_RTP_RANGE_MIN

#define JANUS_AUDIOBRIDGE_DEFAULT_RTP_RANGE_MIN   10000

◆ JANUS_AUDIOBRIDGE_DESCRIPTION

#define JANUS_AUDIOBRIDGE_DESCRIPTION   "This is a plugin implementing an audio conference bridge for Janus, mixing Opus streams."

◆ JANUS_AUDIOBRIDGE_ERROR_ALREADY_JOINED

#define JANUS_AUDIOBRIDGE_ERROR_ALREADY_JOINED   491

◆ JANUS_AUDIOBRIDGE_ERROR_ID_EXISTS

#define JANUS_AUDIOBRIDGE_ERROR_ID_EXISTS   490

◆ JANUS_AUDIOBRIDGE_ERROR_INVALID_ELEMENT

#define JANUS_AUDIOBRIDGE_ERROR_INVALID_ELEMENT   484

◆ JANUS_AUDIOBRIDGE_ERROR_INVALID_JSON

#define JANUS_AUDIOBRIDGE_ERROR_INVALID_JSON   481

◆ JANUS_AUDIOBRIDGE_ERROR_INVALID_REQUEST

#define JANUS_AUDIOBRIDGE_ERROR_INVALID_REQUEST   482

◆ JANUS_AUDIOBRIDGE_ERROR_INVALID_SDP

#define JANUS_AUDIOBRIDGE_ERROR_INVALID_SDP   493

◆ JANUS_AUDIOBRIDGE_ERROR_LIBOPUS_ERROR

#define JANUS_AUDIOBRIDGE_ERROR_LIBOPUS_ERROR   488

◆ JANUS_AUDIOBRIDGE_ERROR_MISSING_ELEMENT

#define JANUS_AUDIOBRIDGE_ERROR_MISSING_ELEMENT   483

◆ JANUS_AUDIOBRIDGE_ERROR_NO_MESSAGE

#define JANUS_AUDIOBRIDGE_ERROR_NO_MESSAGE   480

◆ JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_GROUP

#define JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_GROUP   494

◆ JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_ROOM

#define JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_ROOM   485

◆ JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_USER

#define JANUS_AUDIOBRIDGE_ERROR_NO_SUCH_USER   492

◆ JANUS_AUDIOBRIDGE_ERROR_NOT_JOINED

#define JANUS_AUDIOBRIDGE_ERROR_NOT_JOINED   487

◆ JANUS_AUDIOBRIDGE_ERROR_ROOM_EXISTS

#define JANUS_AUDIOBRIDGE_ERROR_ROOM_EXISTS   486

◆ JANUS_AUDIOBRIDGE_ERROR_UNAUTHORIZED

#define JANUS_AUDIOBRIDGE_ERROR_UNAUTHORIZED   489

◆ JANUS_AUDIOBRIDGE_ERROR_UNKNOWN_ERROR

#define JANUS_AUDIOBRIDGE_ERROR_UNKNOWN_ERROR   499

◆ JANUS_AUDIOBRIDGE_MAX_GROUPS

#define JANUS_AUDIOBRIDGE_MAX_GROUPS   5

◆ JANUS_AUDIOBRIDGE_NAME

#define JANUS_AUDIOBRIDGE_NAME   "JANUS AudioBridge plugin"

◆ JANUS_AUDIOBRIDGE_PACKAGE

#define JANUS_AUDIOBRIDGE_PACKAGE   "janus.plugin.audiobridge"

◆ JANUS_AUDIOBRIDGE_VERSION

#define JANUS_AUDIOBRIDGE_VERSION   13

◆ JANUS_AUDIOBRIDGE_VERSION_STRING

#define JANUS_AUDIOBRIDGE_VERSION_STRING   "0.0.13"

◆ JITTER_BUFFER_CHECK_USECS

#define JITTER_BUFFER_CHECK_USECS   1*G_USEC_PER_SEC

◆ JITTER_BUFFER_MAX_PACKETS

#define JITTER_BUFFER_MAX_PACKETS   50

◆ JITTER_BUFFER_MIN_PACKETS

#define JITTER_BUFFER_MIN_PACKETS   2

◆ MAX_MISORDER

#define MAX_MISORDER   50

◆ MIN_SEQUENTIAL

#define MIN_SEQUENTIAL   2

◆ OPUS_SAMPLES

#define OPUS_SAMPLES   960

◆ QUEUE_IN_MAX_PACKETS

#define QUEUE_IN_MAX_PACKETS   4

Typedef Documentation

◆ janus_audiobridge_buffer_packet

typedef struct janus_audiobridge_buffer_packet janus_audiobridge_buffer_packet

◆ janus_audiobridge_message

typedef struct janus_audiobridge_message janus_audiobridge_message

◆ janus_audiobridge_participant

typedef struct janus_audiobridge_participant janus_audiobridge_participant

◆ janus_audiobridge_plainrtp_media

typedef struct janus_audiobridge_plainrtp_media janus_audiobridge_plainrtp_media

◆ janus_audiobridge_room

typedef struct janus_audiobridge_room janus_audiobridge_room

◆ janus_audiobridge_rtp_forwarder

typedef struct janus_audiobridge_rtp_forwarder janus_audiobridge_rtp_forwarder

◆ janus_audiobridge_rtp_relay_packet

typedef struct janus_audiobridge_rtp_relay_packet janus_audiobridge_rtp_relay_packet

◆ janus_audiobridge_session

typedef struct janus_audiobridge_session janus_audiobridge_session

◆ wav_header

typedef struct wav_header wav_header

Function Documentation

◆ create()

janus_logger * create ( void )

◆ janus_audiobridge_create_session()

void janus_audiobridge_create_session ( janus_plugin_session * handle,
int * error )

◆ janus_audiobridge_destroy()

void janus_audiobridge_destroy ( void )

◆ janus_audiobridge_destroy_session()

void janus_audiobridge_destroy_session ( janus_plugin_session * handle,
int * error )

◆ janus_audiobridge_get_api_compatibility()

int janus_audiobridge_get_api_compatibility ( void )

◆ janus_audiobridge_get_author()

const char * janus_audiobridge_get_author ( void )

◆ janus_audiobridge_get_description()

const char * janus_audiobridge_get_description ( void )

◆ janus_audiobridge_get_name()

const char * janus_audiobridge_get_name ( void )

◆ janus_audiobridge_get_package()

const char * janus_audiobridge_get_package ( void )

◆ janus_audiobridge_get_version()

int janus_audiobridge_get_version ( void )

◆ janus_audiobridge_get_version_string()

const char * janus_audiobridge_get_version_string ( void )

◆ janus_audiobridge_handle_admin_message()

json_t * janus_audiobridge_handle_admin_message ( json_t * message)

◆ janus_audiobridge_handle_message()

struct janus_plugin_result * janus_audiobridge_handle_message ( janus_plugin_session * handle,
char * transaction,
json_t * message,
json_t * jsep )

◆ janus_audiobridge_hangup_media()

void janus_audiobridge_hangup_media ( janus_plugin_session * handle)

◆ janus_audiobridge_incoming_rtcp()

void janus_audiobridge_incoming_rtcp ( janus_plugin_session * handle,
janus_plugin_rtcp * packet )

◆ janus_audiobridge_incoming_rtp()

void janus_audiobridge_incoming_rtp ( janus_plugin_session * handle,
janus_plugin_rtp * packet )

◆ janus_audiobridge_init()

int janus_audiobridge_init ( janus_callbacks * callback,
const char * config_path )

◆ janus_audiobridge_query_session()

json_t * janus_audiobridge_query_session ( janus_plugin_session * handle)

◆ janus_audiobridge_setup_media()

void janus_audiobridge_setup_media ( janus_plugin_session * handle)