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

Janus Streaming plugin. More...

#include "plugin.h"
#include <errno.h>
#include <netdb.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <jansson.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 "../utils.h"
#include "../sdp-utils.h"
#include "../ip-utils.h"
Include dependency graph for janus_streaming.c:

Data Structures

struct  janus_streaming_rtp_keyframe
 
struct  janus_streaming_rtp_relay_packet
 
struct  janus_streaming_rtp_source
 
struct  janus_streaming_file_source
 
struct  multiple_fds
 
struct  janus_streaming_codecs
 
struct  janus_streaming_mountpoint
 
struct  janus_streaming_helper
 
struct  janus_streaming_message
 
struct  janus_streaming_session
 

Macros

#define JANUS_STREAMING_DEFAULT_SESSION_TIMEOUT   0 /* Overwrite the RTSP session timeout. If set to zero, the RTSP timeout is derived from a session. */
 
#define JANUS_STREAMING_DEFAULT_RECONNECT_DELAY   5 /* Reconnecting delay in seconds. */
 
#define JANUS_STREAMING_DEFAULT_CURL_TIMEOUT   10L /* Communication timeout for cURL. */
 
#define JANUS_STREAMING_DEFAULT_CURL_CONNECT_TIMEOUT   5L /* Connection timeout for cURL. */
 
#define JANUS_STREAMING_VERSION   9
 
#define JANUS_STREAMING_VERSION_STRING   "0.0.9"
 
#define JANUS_STREAMING_DESCRIPTION   "This is a streaming plugin for Janus, allowing WebRTC peers to watch/listen to pre-recorded files or media generated by an external source."
 
#define JANUS_STREAMING_NAME   "JANUS Streaming plugin"
 
#define JANUS_STREAMING_AUTHOR   "Meetecho s.r.l."
 
#define JANUS_STREAMING_PACKAGE   "janus.plugin.streaming"
 
#define DEFAULT_RTP_RANGE_MIN   10000
 
#define DEFAULT_RTP_RANGE_MAX   60000
 
#define JANUS_STREAMING_ERROR_NO_MESSAGE   450
 
#define JANUS_STREAMING_ERROR_INVALID_JSON   451
 
#define JANUS_STREAMING_ERROR_INVALID_REQUEST   452
 
#define JANUS_STREAMING_ERROR_MISSING_ELEMENT   453
 
#define JANUS_STREAMING_ERROR_INVALID_ELEMENT   454
 
#define JANUS_STREAMING_ERROR_NO_SUCH_MOUNTPOINT   455
 
#define JANUS_STREAMING_ERROR_CANT_CREATE   456
 
#define JANUS_STREAMING_ERROR_UNAUTHORIZED   457
 
#define JANUS_STREAMING_ERROR_CANT_SWITCH   458
 
#define JANUS_STREAMING_ERROR_CANT_RECORD   459
 
#define JANUS_STREAMING_ERROR_INVALID_STATE   460
 
#define JANUS_STREAMING_ERROR_INVALID_SDP   461
 
#define JANUS_STREAMING_ERROR_UNKNOWN_ERROR   470
 

Typedefs

typedef enum janus_streaming_type janus_streaming_type
 
typedef enum janus_streaming_source janus_streaming_source
 
typedef struct janus_streaming_rtp_keyframe janus_streaming_rtp_keyframe
 
typedef struct janus_streaming_rtp_relay_packet janus_streaming_rtp_relay_packet
 
typedef struct janus_streaming_rtp_source janus_streaming_rtp_source
 
typedef struct janus_streaming_file_source janus_streaming_file_source
 
typedef struct multiple_fds multiple_fds
 
typedef struct janus_streaming_codecs janus_streaming_codecs
 
typedef struct janus_streaming_mountpoint janus_streaming_mountpoint
 
typedef struct janus_streaming_helper janus_streaming_helper
 
typedef struct janus_streaming_message janus_streaming_message
 
typedef struct janus_streaming_session janus_streaming_session
 

Enumerations

enum  janus_streaming_type { janus_streaming_type_none = 0 , janus_streaming_type_live , janus_streaming_type_on_demand }
 
enum  janus_streaming_source { janus_streaming_source_none = 0 , janus_streaming_source_file , janus_streaming_source_rtp }
 

Functions

janus_plugincreate (void)
 
int janus_streaming_init (janus_callbacks *callback, const char *config_path)
 
void janus_streaming_destroy (void)
 
int janus_streaming_get_api_compatibility (void)
 
int janus_streaming_get_version (void)
 
const char * janus_streaming_get_version_string (void)
 
const char * janus_streaming_get_description (void)
 
const char * janus_streaming_get_name (void)
 
const char * janus_streaming_get_author (void)
 
const char * janus_streaming_get_package (void)
 
void janus_streaming_create_session (janus_plugin_session *handle, int *error)
 
struct janus_plugin_resultjanus_streaming_handle_message (janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep)
 
json_tjanus_streaming_handle_admin_message (json_t *message)
 
void janus_streaming_setup_media (janus_plugin_session *handle)
 
void janus_streaming_incoming_rtp (janus_plugin_session *handle, janus_plugin_rtp *packet)
 
void janus_streaming_incoming_rtcp (janus_plugin_session *handle, janus_plugin_rtcp *packet)
 
void janus_streaming_data_ready (janus_plugin_session *handle)
 
void janus_streaming_hangup_media (janus_plugin_session *handle)
 
void janus_streaming_destroy_session (janus_plugin_session *handle, int *error)
 
json_tjanus_streaming_query_session (janus_plugin_session *handle)
 
janus_streaming_mountpointjanus_streaming_create_rtp_source (uint64_t id, char *id_str, char *name, char *desc, char *metadata, int srtpsuite, char *srtpcrypto, int threads, gboolean e2ee, gboolean playoutdelay_ext, gboolean doaudio, gboolean doaudiortcp, char *amcast, const janus_network_address *aiface, uint16_t aport, uint16_t artcpport, uint8_t acodec, char *artpmap, char *afmtp, gboolean doaskew, gboolean dovideo, gboolean dovideortcp, char *vmcast, const janus_network_address *viface, uint16_t vport, uint16_t vrtcpport, uint8_t vcodec, char *vrtpmap, char *vfmtp, char *sprop, gboolean bufferkf, gboolean simulcast, uint16_t vport2, uint16_t vport3, gboolean svc, gboolean dovskew, int rtp_collision, gboolean dodata, const janus_network_address *diface, uint16_t dport, gboolean textdata, gboolean buffermsg)
 
janus_streaming_mountpointjanus_streaming_create_file_source (uint64_t id, char *id_str, char *name, char *desc, char *metadata, char *filename, gboolean live, gboolean doaudio, uint8_t acodec, char *artpmap, char *afmtp, gboolean dovideo)
 
janus_streaming_mountpointjanus_streaming_create_rtsp_source (uint64_t id, char *id_str, char *name, char *desc, char *metadata, char *url, char *username, char *password, gboolean quirk, gboolean doaudio, int audiopt, char *artpmap, char *afmtp, gboolean dovideo, int videopt, char *vrtpmap, char *vfmtp, gboolean bufferkf, const janus_network_address *iface, int threads, gint64 reconnect_delay, gint64 session_timeout, int rtsp_timeout, int rtsp_conn_timeout, gboolean error_on_failure)
 

Variables

GHashTable * mountpoints = NULL
 
GHashTable * mountpoints_temp = NULL
 
janus_mutex mountpoints_mutex = JANUS_MUTEX_INITIALIZER
 

Detailed Description

Janus Streaming plugin.

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

Check the Streaming plugin documentation for more details.

Plugins

Macro Definition Documentation

◆ DEFAULT_RTP_RANGE_MAX

#define DEFAULT_RTP_RANGE_MAX   60000

◆ DEFAULT_RTP_RANGE_MIN

#define DEFAULT_RTP_RANGE_MIN   10000

◆ JANUS_STREAMING_AUTHOR

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

◆ JANUS_STREAMING_DEFAULT_CURL_CONNECT_TIMEOUT

#define JANUS_STREAMING_DEFAULT_CURL_CONNECT_TIMEOUT   5L /* Connection timeout for cURL. */

◆ JANUS_STREAMING_DEFAULT_CURL_TIMEOUT

#define JANUS_STREAMING_DEFAULT_CURL_TIMEOUT   10L /* Communication timeout for cURL. */

◆ JANUS_STREAMING_DEFAULT_RECONNECT_DELAY

#define JANUS_STREAMING_DEFAULT_RECONNECT_DELAY   5 /* Reconnecting delay in seconds. */

◆ JANUS_STREAMING_DEFAULT_SESSION_TIMEOUT

#define JANUS_STREAMING_DEFAULT_SESSION_TIMEOUT   0 /* Overwrite the RTSP session timeout. If set to zero, the RTSP timeout is derived from a session. */

◆ JANUS_STREAMING_DESCRIPTION

#define JANUS_STREAMING_DESCRIPTION   "This is a streaming plugin for Janus, allowing WebRTC peers to watch/listen to pre-recorded files or media generated by an external source."

◆ JANUS_STREAMING_ERROR_CANT_CREATE

#define JANUS_STREAMING_ERROR_CANT_CREATE   456

◆ JANUS_STREAMING_ERROR_CANT_RECORD

#define JANUS_STREAMING_ERROR_CANT_RECORD   459

◆ JANUS_STREAMING_ERROR_CANT_SWITCH

#define JANUS_STREAMING_ERROR_CANT_SWITCH   458

◆ JANUS_STREAMING_ERROR_INVALID_ELEMENT

#define JANUS_STREAMING_ERROR_INVALID_ELEMENT   454

◆ JANUS_STREAMING_ERROR_INVALID_JSON

#define JANUS_STREAMING_ERROR_INVALID_JSON   451

◆ JANUS_STREAMING_ERROR_INVALID_REQUEST

#define JANUS_STREAMING_ERROR_INVALID_REQUEST   452

◆ JANUS_STREAMING_ERROR_INVALID_SDP

#define JANUS_STREAMING_ERROR_INVALID_SDP   461

◆ JANUS_STREAMING_ERROR_INVALID_STATE

#define JANUS_STREAMING_ERROR_INVALID_STATE   460

◆ JANUS_STREAMING_ERROR_MISSING_ELEMENT

#define JANUS_STREAMING_ERROR_MISSING_ELEMENT   453

◆ JANUS_STREAMING_ERROR_NO_MESSAGE

#define JANUS_STREAMING_ERROR_NO_MESSAGE   450

◆ JANUS_STREAMING_ERROR_NO_SUCH_MOUNTPOINT

#define JANUS_STREAMING_ERROR_NO_SUCH_MOUNTPOINT   455

◆ JANUS_STREAMING_ERROR_UNAUTHORIZED

#define JANUS_STREAMING_ERROR_UNAUTHORIZED   457

◆ JANUS_STREAMING_ERROR_UNKNOWN_ERROR

#define JANUS_STREAMING_ERROR_UNKNOWN_ERROR   470

◆ JANUS_STREAMING_NAME

#define JANUS_STREAMING_NAME   "JANUS Streaming plugin"

◆ JANUS_STREAMING_PACKAGE

#define JANUS_STREAMING_PACKAGE   "janus.plugin.streaming"

◆ JANUS_STREAMING_VERSION

#define JANUS_STREAMING_VERSION   9

◆ JANUS_STREAMING_VERSION_STRING

#define JANUS_STREAMING_VERSION_STRING   "0.0.9"

Typedef Documentation

◆ janus_streaming_codecs

typedef struct janus_streaming_codecs janus_streaming_codecs

◆ janus_streaming_file_source

typedef struct janus_streaming_file_source janus_streaming_file_source

◆ janus_streaming_helper

typedef struct janus_streaming_helper janus_streaming_helper

◆ janus_streaming_message

typedef struct janus_streaming_message janus_streaming_message

◆ janus_streaming_mountpoint

typedef struct janus_streaming_mountpoint janus_streaming_mountpoint

◆ janus_streaming_rtp_keyframe

typedef struct janus_streaming_rtp_keyframe janus_streaming_rtp_keyframe

◆ janus_streaming_rtp_relay_packet

typedef struct janus_streaming_rtp_relay_packet janus_streaming_rtp_relay_packet

◆ janus_streaming_rtp_source

typedef struct janus_streaming_rtp_source janus_streaming_rtp_source

◆ janus_streaming_session

typedef struct janus_streaming_session janus_streaming_session

◆ janus_streaming_source

◆ janus_streaming_type

◆ multiple_fds

typedef struct multiple_fds multiple_fds

Enumeration Type Documentation

◆ janus_streaming_source

Enumerator
janus_streaming_source_none 
janus_streaming_source_file 
janus_streaming_source_rtp 

◆ janus_streaming_type

Enumerator
janus_streaming_type_none 
janus_streaming_type_live 
janus_streaming_type_on_demand 

Function Documentation

◆ create()

janus_plugin * create ( void )

◆ janus_streaming_create_file_source()

janus_streaming_mountpoint * janus_streaming_create_file_source ( uint64_t id,
char * id_str,
char * name,
char * desc,
char * metadata,
char * filename,
gboolean live,
gboolean doaudio,
uint8_t acodec,
char * artpmap,
char * afmtp,
gboolean dovideo )

◆ janus_streaming_create_rtp_source()

janus_streaming_mountpoint * janus_streaming_create_rtp_source ( uint64_t id,
char * id_str,
char * name,
char * desc,
char * metadata,
int srtpsuite,
char * srtpcrypto,
int threads,
gboolean e2ee,
gboolean playoutdelay_ext,
gboolean doaudio,
gboolean doaudiortcp,
char * amcast,
const janus_network_address * aiface,
uint16_t aport,
uint16_t artcpport,
uint8_t acodec,
char * artpmap,
char * afmtp,
gboolean doaskew,
gboolean dovideo,
gboolean dovideortcp,
char * vmcast,
const janus_network_address * viface,
uint16_t vport,
uint16_t vrtcpport,
uint8_t vcodec,
char * vrtpmap,
char * vfmtp,
char * sprop,
gboolean bufferkf,
gboolean simulcast,
uint16_t vport2,
uint16_t vport3,
gboolean svc,
gboolean dovskew,
int rtp_collision,
gboolean dodata,
const janus_network_address * diface,
uint16_t dport,
gboolean textdata,
gboolean buffermsg )

◆ janus_streaming_create_rtsp_source()

janus_streaming_mountpoint * janus_streaming_create_rtsp_source ( uint64_t id,
char * id_str,
char * name,
char * desc,
char * metadata,
char * url,
char * username,
char * password,
gboolean quirk,
gboolean doaudio,
int audiopt,
char * artpmap,
char * afmtp,
gboolean dovideo,
int videopt,
char * vrtpmap,
char * vfmtp,
gboolean bufferkf,
const janus_network_address * iface,
int threads,
gint64 reconnect_delay,
gint64 session_timeout,
int rtsp_timeout,
int rtsp_conn_timeout,
gboolean error_on_failure )

◆ janus_streaming_create_session()

void janus_streaming_create_session ( janus_plugin_session * handle,
int * error )

◆ janus_streaming_data_ready()

void janus_streaming_data_ready ( janus_plugin_session * handle)

◆ janus_streaming_destroy()

void janus_streaming_destroy ( void )

◆ janus_streaming_destroy_session()

void janus_streaming_destroy_session ( janus_plugin_session * handle,
int * error )

◆ janus_streaming_get_api_compatibility()

int janus_streaming_get_api_compatibility ( void )

◆ janus_streaming_get_author()

const char * janus_streaming_get_author ( void )

◆ janus_streaming_get_description()

const char * janus_streaming_get_description ( void )

◆ janus_streaming_get_name()

const char * janus_streaming_get_name ( void )

◆ janus_streaming_get_package()

const char * janus_streaming_get_package ( void )

◆ janus_streaming_get_version()

int janus_streaming_get_version ( void )

◆ janus_streaming_get_version_string()

const char * janus_streaming_get_version_string ( void )

◆ janus_streaming_handle_admin_message()

json_t * janus_streaming_handle_admin_message ( json_t * message)

◆ janus_streaming_handle_message()

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

◆ janus_streaming_hangup_media()

void janus_streaming_hangup_media ( janus_plugin_session * handle)

◆ janus_streaming_incoming_rtcp()

void janus_streaming_incoming_rtcp ( janus_plugin_session * handle,
janus_plugin_rtcp * packet )

◆ janus_streaming_incoming_rtp()

void janus_streaming_incoming_rtp ( janus_plugin_session * handle,
janus_plugin_rtp * packet )

◆ janus_streaming_init()

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

◆ janus_streaming_query_session()

json_t * janus_streaming_query_session ( janus_plugin_session * handle)

◆ janus_streaming_setup_media()

void janus_streaming_setup_media ( janus_plugin_session * handle)

Variable Documentation

◆ mountpoints

GHashTable* mountpoints = NULL

◆ mountpoints_mutex

janus_mutex mountpoints_mutex = JANUS_MUTEX_INITIALIZER

◆ mountpoints_temp

GHashTable * mountpoints_temp = NULL