Fork me on GitHub
janus_lua_data.h
Go to the documentation of this file.
1 
25 #ifndef _JANUS_LUA_DATA_H
26 #define _JANUS_LUA_DATA_H
27 
28 #include <lua.h>
29 #include <lualib.h>
30 #include <lauxlib.h>
31 
32 #include "plugin.h"
33 
34 #include "debug.h"
35 #include "apierror.h"
36 #include "config.h"
37 #include "mutex.h"
38 #include "rtp.h"
39 #include "rtcp.h"
40 #include "sdp-utils.h"
41 #include "record.h"
42 #include "utils.h"
43 
44 /* Core pointer and related flags */
45 extern volatile gint lua_initialized, lua_stopping;
47 
48 /* Lua state: we define state and mutex as extern */
49 extern lua_State *lua_state;
50 extern janus_mutex lua_mutex;
51 
52 /* Lua session: we keep only the barebone stuff here, the rest will be in the Lua script */
53 typedef struct janus_lua_session {
54  janus_plugin_session *handle; /* Pointer to the core-plugin session */
55  uint32_t id; /* Unique session ID (will be used to correlate with the Lua script) */
56  /* The following are only needed for media manipulation, feedback and routing, and may not all be used */
57  gboolean accept_audio; /* Whether incoming audio can be accepted or must be dropped */
58  gboolean accept_video; /* Whether incoming video can be accepted or must be dropped */
59  gboolean accept_data; /* Whether incoming data can be accepted or must be dropped */
60  gboolean send_audio; /* Whether outgoing audio can be sent or must be dropped */
61  gboolean send_video; /* Whether outgoing video can be sent or must be dropped */
62  gboolean send_data; /* Whether outgoing data can be sent or must be dropped */
63  janus_rtp_switching_context rtpctx; /* Needed in case the source changes (e.g., stale operator/customer) */
64  uint32_t bitrate; /* Bitrate limit */
65  uint16_t pli_freq; /* Regular PLI frequency (0=disabled) */
66  gint64 pli_latest; /* Time of latest sent PLI (to avoid flooding) */
67  GSList *recipients; /* Sessions that should receive media from this session */
68  struct janus_lua_session *sender; /* Other session this session is receiving media from */
69  janus_mutex recipients_mutex; /* Mutex to lock the recipients list */
70  janus_recorder *arc; /* The Janus recorder instance for audio, if enabled */
71  janus_recorder *vrc; /* The Janus recorder instance for video, if enabled */
72  janus_recorder *drc; /* The Janus recorder instance for data, if enabled */
73  janus_mutex rec_mutex; /* Mutex to protect the recorders from race conditions */
74  volatile gint started; /* Whether this session's PeerConnection is ready or not */
75  volatile gint hangingup; /* Whether this session's PeerConnection is hanging up */
76  volatile gint destroyed; /* Whether this session's been marked as destroyed */
77  /* If you need any additional property (e.g., for hooks you added in janus_lua_extra.c) add them below this line */
78 
79  /* Reference counter */
82 extern GHashTable *lua_sessions, *lua_ids;
85 
86 #endif
janus_recorder * drc
Definition: janus_lua_data.h:72
SDP utilities (headers)
janus_mutex lua_mutex
Definition: janus_lua.c:258
Logging and Debugging.
lua_State * lua_state
Definition: janus_lua.c:257
Janus API errors definition.
volatile gint started
Definition: janus_lua_data.h:74
GHashTable * lua_ids
Definition: janus_lua.c:312
gboolean send_data
Definition: janus_lua_data.h:62
gint64 pli_latest
Definition: janus_lua_data.h:66
Plugin-Gateway communication (implementation)
janus_lua_session * janus_lua_lookup_session(janus_plugin_session *handle)
Definition: janus_lua.c:1461
volatile gint lua_stopping
Definition: janus_lua.c:253
janus_rtp_switching_context rtpctx
Definition: janus_lua_data.h:63
Configuration files parsing (headers)
gboolean accept_audio
Definition: janus_lua_data.h:57
gboolean accept_data
Definition: janus_lua_data.h:59
struct janus_lua_session * sender
Definition: janus_lua_data.h:68
janus_recorder * vrc
Definition: janus_lua_data.h:71
janus_mutex rec_mutex
Definition: janus_lua_data.h:73
Definition: refcount.h:78
TURN REST API client.
Definition: janus_lua_data.h:53
struct janus_lua_session janus_lua_session
volatile gint lua_initialized
Definition: janus_lua.c:253
gboolean send_audio
Definition: janus_lua_data.h:60
RTP context, in order to make sure SSRC changes result in coherent seq/ts increases.
Definition: rtp.h:155
RTCP processing (headers)
uint32_t id
Definition: janus_lua_data.h:55
janus_mutex recipients_mutex
Definition: janus_lua_data.h:69
janus_mutex lua_sessions_mutex
Definition: janus_lua.c:313
Structure that represents a recorder.
Definition: record.h:39
janus_refcount ref
Definition: janus_lua_data.h:80
gboolean accept_video
Definition: janus_lua_data.h:58
Callbacks to contact the gateway.
Definition: plugin.h:337
Semaphors, Mutexes and Conditions.
pthread_mutex_t janus_mutex
Janus mutex implementation.
Definition: mutex.h:21
Audio/Video recorder.
GHashTable * lua_sessions
Definition: janus_lua.c:312
uint16_t pli_freq
Definition: janus_lua_data.h:65
Plugin-Gateway session mapping.
Definition: plugin.h:226
janus_callbacks * janus_core
Definition: janus_lua.c:254
janus_recorder * arc
Definition: janus_lua_data.h:70
janus_plugin_session * handle
Definition: janus_lua_data.h:54
GSList * recipients
Definition: janus_lua_data.h:67
RTP processing (headers)
uint32_t bitrate
Definition: janus_lua_data.h:64
volatile gint hangingup
Definition: janus_lua_data.h:75
volatile gint destroyed
Definition: janus_lua_data.h:76
gboolean send_video
Definition: janus_lua_data.h:61