Skip to content

Commit 793982a

Browse files
committed
Initial commit
Change-Id: I62e26c8497f76edbb9a05d8e4a3aa4dfeb68b2b6
1 parent 021bf2f commit 793982a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+18154
-0
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "scripts"]
2+
path = scripts
3+
url = https://github.com/EricssonResearch/openwebrtc-build-scripts.git

AUTHORS

Whitespace-only changes.

COPYING

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2014, Ericsson AB. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice, this
7+
list of conditions and the following disclaimer.
8+
9+
2. Redistributions in binary form must reproduce the above copyright notice, this
10+
list of conditions and the following disclaimer in the documentation and/or other
11+
materials provided with the distribution.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
19+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
22+
OF SUCH DAMAGE.

ChangeLog

Whitespace-only changes.

Makefile.am

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Process this file with automake to produce Makefile.in
2+
3+
SUBDIRS = transport local owr bridge docs
4+
5+
if OWR_DEBUG
6+
DEBUG_CFLAGS = "-g"
7+
else
8+
DEBUG_CFLAGS =
9+
endif
10+
export DEBUG_CFLAGS
11+
12+
openwebrtcdocdir = ${prefix}/share/doc/libopenwebrtc
13+
openwebrtcdoc_DATA = \
14+
README \
15+
COPYING \
16+
AUTHORS \
17+
ChangeLog \
18+
INSTALL \
19+
NEWS
20+
21+
EXTRA_DIST = $(openwebrtcdoc_DATA)
22+
23+
GITIGNOREFILES = openwebrtc-deps-* build out .build_successful_tag_file.txt
24+
25+
DISTCLEANFILES = aclocal.m4 config.guess config.h.in config.sub \
26+
depcomp gtk-doc.make m4 install-sh ltmain.sh missing
27+
28+
# Remove doc directory on uninstall
29+
uninstall-local:
30+
-rm -r $(openwebrtcdocdir)
31+
32+
-include $(top_srcdir)/git.mk

NEWS

Whitespace-only changes.

README

Whitespace-only changes.

autogen.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# you can either set the environment variables AUTOCONF, AUTOHEADER, AUTOMAKE,
3+
# ACLOCAL, AUTOPOINT and/or LIBTOOLIZE to the right versions, or leave them
4+
# unset and get the defaults
5+
6+
srcdir=`dirname $0`
7+
(test -d $srcdir/m4) || mkdir $srcdir/m4
8+
9+
pushd $srcdir > /dev/null
10+
gtkdocize && \
11+
autoreconf --verbose --force --install --make || {
12+
echo 'autogen.sh failed';
13+
exit 1;
14+
}
15+
16+
popd > /dev/null
17+
18+
$srcdir/configure $* || {
19+
echo 'configure failed';
20+
exit 1;
21+
}
22+
23+
echo
24+
echo "Now type 'make' to compile this module."
25+
echo

bridge/Makefile.am

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
## Process this file with automake to produce Makefile.in
2+
3+
SUBDIRS = client seed shared worker
4+
5+
AM_CPPFLAGS = \
6+
-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
7+
-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
8+
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
9+
$(GLIB_CFLAGS) \
10+
$(SEED_CFLAGS) \
11+
-I$(top_srcdir)/owr \
12+
-I$(top_builddir)/owr \
13+
-I$(top_builddir)/bridge
14+
15+
AM_CFLAGS = \
16+
-Wall \
17+
-Wextra \
18+
-Werror \
19+
-pedantic \
20+
$(DEBUG_CFLAGS)
21+
22+
lib_LTLIBRARIES = libopenwebrtc_bridge.la
23+
24+
libopenwebrtc_bridge_la_SOURCES = \
25+
owr_bridge.c
26+
27+
libopenwebrtc_bridge_la_LIBADD = \
28+
$(GLIB_LIBS) \
29+
$(SEED_LIBS) \
30+
$(top_builddir)/owr/libopenwebrtc.la
31+
32+
libopenwebrtc_bridge_la_DEPENDENCIES = \
33+
$(top_builddir)/owr/libopenwebrtc.la
34+
35+
libopenwebrtc_bridge_la_CFLAGS = $(AM_CFLAGS) -ansi
36+
libopenwebrtc_bridge_la_LDFLAGS = -export-dynamic
37+
38+
bin_PROGRAMS = daemon
39+
daemon_SOURCES = daemon.c
40+
daemon_LDFLAGS = -static -export-dynamic $(SEED_LIBS) libopenwebrtc_bridge.la
41+
42+
includedir = $(prefix)/include/owr
43+
include_HEADERS = \
44+
owr_bridge.h
45+
46+
pkgconfigdir = $(libdir)/pkgconfig
47+
pkgconfig_DATA = openwebrtc-bridge-0.1.pc
48+
49+
EXTRA_DIST = \
50+
openwebrtc-bridge-0.1.pc.in
51+
52+
-include $(top_srcdir)/git.mk

bridge/client/Makefile.am

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Process this file with automake to produce Makefile.in
2+
3+
BUILT_SOURCES = \
4+
domutils.js.h \
5+
sdp.js.h \
6+
webrtc.js.h
7+
8+
%.js_: %.js
9+
cp $< $@
10+
11+
%.js.h: %.js_
12+
xxd -i $< > $@
13+
14+
-include $(top_srcdir)/git.mk

bridge/client/domutils.js

+190
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
/*
2+
* Copyright (C) 2014 Ericsson AB. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright
11+
* notice, this list of conditions and the following disclaimer
12+
* in the documentation and/or other materials provided with the
13+
* distribution.
14+
*
15+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
"use strict";
29+
30+
var domObject = (function () {
31+
32+
function createAttributeDescriptor(name, attributes) {
33+
return {
34+
"get": function () {
35+
var attribute = attributes[name];
36+
return typeof attribute == "function" ? attribute() : attribute;
37+
},
38+
"enumerable": true
39+
};
40+
}
41+
42+
return {
43+
"addReadOnlyAttributes": function (target, attributes) {
44+
for (var name in attributes)
45+
Object.defineProperty(target, name, createAttributeDescriptor(name, attributes));
46+
},
47+
48+
"addConstants": function (target, constants) {
49+
for (var name in constants)
50+
Object.defineProperty(target, name, {
51+
"value": constants[name],
52+
"enumerable": true
53+
});
54+
}
55+
};
56+
})();
57+
58+
function EventTarget(attributes) {
59+
var _this = this;
60+
var listenersMap = {};
61+
62+
if (attributes)
63+
addEventListenerAttributes(this, attributes);
64+
65+
this.addEventListener = function (type, listener, useCapture) {
66+
if (typeof(listener) != "function")
67+
throw new TypeError("listener argument (" + listener + ") is not a function");
68+
var listeners = listenersMap[type];
69+
if (!listeners)
70+
listeners = listenersMap[type] = [];
71+
72+
if (listeners.indexOf(listener) < 0)
73+
listeners.push(listener);
74+
};
75+
76+
this.removeEventListener = function (type, listener, useCapture) {
77+
var listeners = listenersMap[type];
78+
if (!listeners)
79+
return;
80+
81+
var i = listeners.indexOf(listener);
82+
if (i >= 0)
83+
listeners.splice(i, 1);
84+
};
85+
86+
this.dispatchEvent = function (evt) {
87+
var listeners = [];
88+
89+
var attributeListener = _this["on" + evt.type];
90+
if (attributeListener)
91+
listeners.push(attributeListener);
92+
93+
if (listenersMap[evt.type])
94+
Array.prototype.push.apply(listeners, listenersMap[evt.type]);
95+
96+
var errors = [];
97+
var result = true;
98+
listeners.forEach(function (listener) {
99+
try {
100+
result = !(listener(evt) === false) && result;
101+
} catch (e) {
102+
errors.push(e);
103+
}
104+
});
105+
106+
errors.forEach(function (e) {
107+
setTimeout(function () {
108+
throw e;
109+
});
110+
});
111+
112+
return result;
113+
};
114+
115+
function addEventListenerAttributes(target, attributes) {
116+
for (var name in attributes)
117+
Object.defineProperty(target, name, createEventListenerDescriptor(name, attributes));
118+
}
119+
120+
function createEventListenerDescriptor(name, attributes) {
121+
return {
122+
"get": function () { return attributes[name]; },
123+
"set": function (cb) { attributes[name] = (typeof(cb) == "function") ? cb : null; },
124+
"enumerable": true
125+
};
126+
}
127+
}
128+
129+
function checkDictionary(name, dict, typeMap) {
130+
for (var memberName in dict) {
131+
if (!dict.hasOwnProperty(memberName) || !typeMap.hasOwnProperty(memberName))
132+
continue;
133+
134+
var message = name + ": Dictionary member " + memberName;
135+
checkType(message, dict[memberName], typeMap[memberName]);
136+
}
137+
}
138+
139+
function checkArguments(name, argsTypeTemplate, numRequired, args) {
140+
if (args.length < numRequired) {
141+
throw new TypeError(name + ": Too few arguments (got " + args.length + " expected " +
142+
numRequired + ")");
143+
}
144+
145+
var typeTemplates = argsTypeTemplate.split(/\s*,\s*/);
146+
147+
for (var i = 0; i < args.length && i < typeTemplates.length; i++) {
148+
var message = name + ": Argument " + (i + 1);
149+
checkType(message, args[i], typeTemplates[i]);
150+
}
151+
}
152+
153+
function checkType(name, value, typeTemplate) {
154+
var expetedTypes = typeTemplate.split(/\s*\|\s*/);
155+
if (!canConvert(value, expetedTypes)) {
156+
throw new TypeError(name + " is of wrong type (expected " +
157+
expetedTypes.join(" or ") + ")");
158+
}
159+
}
160+
161+
function canConvert(value, expetedTypes) {
162+
var type = typeof value;
163+
for (var i = 0; i < expetedTypes.length; i++) {
164+
var expetedType = expetedTypes[i];
165+
if (expetedType == "string" || expetedType == "boolean")
166+
return true; // type conversion will never throw
167+
if (expetedType == "number") {
168+
var asNumber = +value;
169+
if (!isNaN(asNumber) && asNumber != -Infinity && asNumber != Infinity)
170+
return true;
171+
}
172+
if (type == "object") {
173+
if (expetedType == "object")
174+
return true;
175+
// could be a specific object type or host object (e.g. Array)
176+
var constructor = self[expetedType];
177+
if (constructor && value instanceof constructor)
178+
return true;
179+
}
180+
if (type == expetedType && expetedType == "function")
181+
return true;
182+
}
183+
return false;
184+
}
185+
186+
function randomString() {
187+
var randomValues = new Uint8Array(27);
188+
crypto.getRandomValues(randomValues);
189+
return btoa(String.fromCharCode.apply(null, randomValues));
190+
}

0 commit comments

Comments
 (0)