Fork me on GitHub
Go to the documentation of this file.
26 #include "duktape-deps/duktape.h"
27 #include "duktape-deps/duk_console.h"
28 #include "duktape-deps/duk_module_duktape.h"
30 #include "plugin.h"
32 #include "debug.h"
33 #include "apierror.h"
34 #include "config.h"
35 #include "mutex.h"
36 #include "rtp.h"
37 #include "rtcp.h"
38 #include "sdp-utils.h"
39 #include "record.h"
40 #include "utils.h"
42 /* Core pointer and related flags */
43 extern volatile gint duktape_initialized, duktape_stopping;
46 /* Duktape context: we define context and mutex as extern */
47 extern duk_context *duktape_ctx;
50 /* Duktape session: we keep only the barebone stuff here, the rest will be in the JavaScript script */
51 typedef struct janus_duktape_session {
52  janus_plugin_session *handle; /* Pointer to the core-plugin session */
53  uint32_t id; /* Unique session ID (will be used to correlate with the JavaScript script) */
54  /* The following are only needed for media manipulation, feedback and routing, and may not all be used */
55  gboolean accept_audio; /* Whether incoming audio can be accepted or must be dropped */
56  gboolean accept_video; /* Whether incoming video can be accepted or must be dropped */
57  gboolean accept_data; /* Whether incoming data can be accepted or must be dropped */
58  gboolean send_audio; /* Whether outgoing audio can be sent or must be dropped */
59  gboolean send_video; /* Whether outgoing video can be sent or must be dropped */
60  gboolean send_data; /* Whether outgoing data can be sent or must be dropped */
61  janus_rtp_switching_context rtpctx; /* Needed in case the source changes (e.g., stale operator/customer) */
62  uint32_t bitrate; /* Bitrate limit */
63  uint16_t pli_freq; /* Regular PLI frequency (0=disabled) */
64  gint64 pli_latest; /* Time of latest sent PLI (to avoid flooding) */
65  GSList *recipients; /* Sessions that should receive media from this session */
66  struct janus_duktape_session *sender; /* Other session this session is receiving media from */
67  janus_mutex recipients_mutex; /* Mutex to lock the recipients list */
68  janus_recorder *arc; /* The Janus recorder instance for audio, if enabled */
69  janus_recorder *vrc; /* The Janus recorder instance for video, if enabled */
70  janus_recorder *drc; /* The Janus recorder instance for data, if enabled */
71  janus_mutex rec_mutex; /* Mutex to protect the recorders from race conditions */
72  volatile gint started; /* Whether this session's PeerConnection is ready or not */
73  volatile gint hangingup; /* Whether this session's PeerConnection is hanging up */
74  volatile gint destroyed; /* Whether this session's been marked as destroyed */
75  /* If you need any additional property (e.g., for hooks you added in janus_duktape_extra.c) add them below this line */
77  /* Reference counter */
80 extern GHashTable *duktape_sessions, *duktape_ids;
84 #endif
SDP utilities (headers)
janus_recorder * vrc
Definition: janus_duktape_data.h:69
janus_mutex duktape_mutex
Definition: janus_duktape.c:264
janus_recorder * arc
Definition: janus_duktape_data.h:68
Logging and Debugging.
volatile gint duktape_stopping
Definition: janus_duktape.c:258
Janus API errors definition.
struct janus_duktape_session janus_duktape_session
gboolean send_audio
Definition: janus_duktape_data.h:58
GMutex janus_mutex
Janus mutex implementation.
Definition: mutex.h:61
duk_context * duktape_ctx
Definition: janus_duktape.c:263
Plugin-Core communication (implementation)
Configuration files parsing (headers)
Definition: refcount.h:78
gboolean send_data
Definition: janus_duktape_data.h:60
janus_refcount ref
Definition: janus_duktape_data.h:78
gboolean accept_data
Definition: janus_duktape_data.h:57
gboolean accept_video
Definition: janus_duktape_data.h:56
janus_duktape_session * janus_duktape_lookup_session(janus_plugin_session *handle)
Definition: janus_duktape.c:1727
struct janus_duktape_session * sender
Definition: janus_duktape_data.h:66
uint32_t bitrate
Definition: janus_duktape_data.h:62
RTP context, in order to make sure SSRC changes result in coherent seq/ts increases.
Definition: rtp.h:223
RTCP processing (headers)
janus_callbacks * janus_core
Definition: janus_duktape.c:259
GHashTable * duktape_ids
Definition: janus_duktape.c:320
janus_plugin_session * handle
Definition: janus_duktape_data.h:52
GHashTable * duktape_sessions
Definition: janus_duktape.c:320
janus_recorder * drc
Definition: janus_duktape_data.h:70
volatile gint started
Definition: janus_duktape_data.h:72
janus_mutex duktape_sessions_mutex
Definition: janus_duktape.c:321
Structure that represents a recorder.
Definition: record.h:40
volatile gint destroyed
Definition: janus_duktape_data.h:74
uint32_t id
Definition: janus_duktape_data.h:53
janus_mutex recipients_mutex
Definition: janus_duktape_data.h:67
volatile gint duktape_initialized
Definition: janus_duktape.c:258
Callbacks to contact the Janus core.
Definition: plugin.h:344
Semaphors, Mutexes and Conditions.
Audio/Video recorder.
volatile gint hangingup
Definition: janus_duktape_data.h:73
GSList * recipients
Definition: janus_duktape_data.h:65
janus_mutex rec_mutex
Definition: janus_duktape_data.h:71
Definition: janus_duktape_data.h:51
gboolean accept_audio
Definition: janus_duktape_data.h:55
Plugin-Gateway session mapping.
Definition: plugin.h:228
uint16_t pli_freq
Definition: janus_duktape_data.h:63
gboolean send_video
Definition: janus_duktape_data.h:59
gint64 pli_latest
Definition: janus_duktape_data.h:64
RTP processing (headers)
janus_rtp_switching_context rtpctx
Definition: janus_duktape_data.h:61