Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for strings as unique IDs in AudioBridge, VideoRoom, TextRoom #1880

Merged
merged 14 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions conf/janus.plugin.audiobridge.jcfg.sample
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ general: {
# .wav --> .wav.tmp until the file is closed
#events = false # Whether events should be sent to event
# handlers (default=true)

# By default, integers are used as a unique ID for both rooms and participants.
# In case you want to use strings instead (e.g., a UUID), set string_ids to true.
#string_ids = true
}

room-1234: {
Expand Down
4 changes: 4 additions & 0 deletions conf/janus.plugin.textroom.jcfg.sample
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ general: {
# plain (no indentation) or compact (no indentation and no spaces)
#events = false # Whether events should be sent to event
# handlers (default=true)

# By default, integers are used as a unique ID for rooms. In case you
# want to use strings instead (e.g., a UUID), set string_ids to true.
#string_ids = true
}

room-1234: {
Expand Down
4 changes: 4 additions & 0 deletions conf/janus.plugin.videoroom.jcfg.sample
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ general: {
# enforced for RTP forwarding requests too
#events = false # Whether events should be sent to event
# handlers (default=true)

# By default, integers are used as a unique ID for both rooms and participants.
# In case you want to use strings instead (e.g., a UUID), set string_ids to true.
#string_ids = true
}

room-1234: {
Expand Down
1,069 changes: 780 additions & 289 deletions plugins/janus_audiobridge.c

Large diffs are not rendered by default.

551 changes: 413 additions & 138 deletions plugins/janus_textroom.c

Large diffs are not rendered by default.

952 changes: 685 additions & 267 deletions plugins/janus_videoroom.c

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ guint64 janus_random_uint64(void) {
return num;
}

char *janus_random_uuid(void) {
return g_uuid_string_random();
}

guint64 *janus_uint64_dup(guint64 num) {
guint64 *numdup = g_malloc(sizeof(guint64));
*numdup = num;
Expand Down
4 changes: 4 additions & 0 deletions utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ guint32 janus_random_uint32(void);
* @returns A random 64-bit unsigned integer */
guint64 janus_random_uint64(void);

/*! \brief Helper to generate random UUIDs (needed by some plugins)
* @returns A random UUID string, which must be deallocated with \c g_free */
char *janus_random_uuid(void);

/*! \brief Helper to generate an allocated copy of a guint64 number
* @note While apparently silly, this is needed in order to make sure guint64 values
* used as keys in GHashTable operations are not lost: using temporary guint64 numbers
Expand Down