Fork me on GitHub
Data Structures | Typedefs | Functions | Variables
janus_duktape_data.h File Reference

Janus Duktape data/session definition (headers) More...

#include <duktape.h>
#include "duktape-deps/duk_console.h"
#include "duktape-deps/duk_module_duktape.h"
#include "plugin.h"
#include "debug.h"
#include "apierror.h"
#include "config.h"
#include "mutex.h"
#include "rtp.h"
#include "rtcp.h"
#include "sdp-utils.h"
#include "record.h"
#include "utils.h"
Include dependency graph for janus_duktape_data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  janus_duktape_session


typedef struct janus_duktape_session janus_duktape_session


janus_duktape_sessionjanus_duktape_lookup_session (janus_plugin_session *handle)


volatile gint duktape_initialized
volatile gint duktape_stopping
duk_context * duktape_ctx
janus_mutex duktape_mutex
GHashTable * duktape_sessions
GHashTable * duktape_ids
janus_mutex duktape_sessions_mutex

Detailed Description

Janus Duktape data/session definition (headers)

Lorenzo Miniero

The Janus Duktape plugin implements all the mandatory hooks to allow the C code to interact with a custom JavaScript script, and viceversa. That said, the janus_duktape_extra.c code allows for custom hooks to be added in C, to expose additional JavaScript functions and implement more complex media management than the one provided by the stock plugin. For this to work, though, the janus_duktape_session object and its indexing in the hashtable need to be defined externally, which is what this file is for.

Notice that all the management associated to sessions (creating or destroying sessions, locking their global mutex, updating the hashtable) is done in the core of the JavaScript plugin: here we only define them, so that they can be accessed/used by the extra code too.

Duktape plugin API

Typedef Documentation

◆ janus_duktape_session

Function Documentation

◆ janus_duktape_lookup_session()

janus_duktape_session* janus_duktape_lookup_session ( janus_plugin_session handle)

Variable Documentation

◆ duktape_ctx

duk_context* duktape_ctx

◆ duktape_ids

GHashTable * duktape_ids

◆ duktape_initialized

volatile gint duktape_initialized

◆ duktape_janus_core

janus_callbacks* duktape_janus_core

◆ duktape_mutex

janus_mutex duktape_mutex

◆ duktape_sessions

GHashTable* duktape_sessions

◆ duktape_sessions_mutex

janus_mutex duktape_sessions_mutex

◆ duktape_stopping

volatile gint duktape_stopping