fix workers to work with worker-loader
This commit is contained in:
parent
f7ec12aa8d
commit
d57db886ac
|
@ -15,6 +15,7 @@ import Worker from './worker'
|
|||
class WorkerBasedMumbleConnector {
|
||||
constructor () {
|
||||
this._worker = new Worker() //work(require.resolve('./worker'))
|
||||
console.log(this._worker)
|
||||
this._worker.addEventListener('message', this._onMessage.bind(this))
|
||||
this._reqId = 1
|
||||
this._requests = {}
|
||||
|
|
|
@ -16,13 +16,15 @@ import 'subworkers'
|
|||
// Using require to ensure ordering relative to monkey-patch above
|
||||
//let CodecsBrowser = require('mumble-client-codecs-browser')
|
||||
|
||||
export default function (self) {
|
||||
|
||||
let sampleRate
|
||||
let nextClientId = 1
|
||||
let nextVoiceId = 1
|
||||
let voiceStreams = []
|
||||
let clients = []
|
||||
|
||||
console.log('worker created!')
|
||||
|
||||
function postMessage (msg, transfer) {
|
||||
try {
|
||||
self.postMessage(msg, transfer)
|
||||
|
@ -286,4 +288,5 @@ export default function (self) {
|
|||
console.error('exception during message event', ev.data, ex)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default null
|
|
@ -1,3 +1,33 @@
|
|||
diff --git a/node_modules/mumble-client-codecs-browser/lib/decode-worker.js b/node_modules/mumble-client-codecs-browser/lib/decode-worker.js
|
||||
index 3925f29..be9af92 100644
|
||||
--- a/node_modules/mumble-client-codecs-browser/lib/decode-worker.js
|
||||
+++ b/node_modules/mumble-client-codecs-browser/lib/decode-worker.js
|
||||
@@ -1,10 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
-Object.defineProperty(exports, "__esModule", {
|
||||
- value: true
|
||||
-});
|
||||
|
||||
-exports.default = function (self) {
|
||||
var opusDecoder, celt7Decoder;
|
||||
self.addEventListener('message', function (e) {
|
||||
var data = e.data;
|
||||
@@ -55,10 +51,12 @@ exports.default = function (self) {
|
||||
}, [_decoded.buffer]);
|
||||
}
|
||||
});
|
||||
-};
|
||||
+
|
||||
|
||||
var _libopus = require('libopus.js');
|
||||
|
||||
var _libcelt = require('libcelt7.js');
|
||||
|
||||
var MUMBLE_SAMPLE_RATE = 48000;
|
||||
+
|
||||
+export default null
|
||||
\ No newline at end of file
|
||||
diff --git a/node_modules/mumble-client-codecs-browser/lib/decoder-stream.js b/node_modules/mumble-client-codecs-browser/lib/decoder-stream.js
|
||||
index 6cfda8b..eed6fa3 100644
|
||||
--- a/node_modules/mumble-client-codecs-browser/lib/decoder-stream.js
|
||||
|
@ -42,6 +72,37 @@ index 6cfda8b..eed6fa3 100644
|
|||
+//exports.default = DecoderStream;
|
||||
+export default DecoderStream
|
||||
\ No newline at end of file
|
||||
diff --git a/node_modules/mumble-client-codecs-browser/lib/encode-worker.js b/node_modules/mumble-client-codecs-browser/lib/encode-worker.js
|
||||
index f7187ab..c2ebaa3 100644
|
||||
--- a/node_modules/mumble-client-codecs-browser/lib/encode-worker.js
|
||||
+++ b/node_modules/mumble-client-codecs-browser/lib/encode-worker.js
|
||||
@@ -1,10 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
-Object.defineProperty(exports, "__esModule", {
|
||||
- value: true
|
||||
-});
|
||||
|
||||
-exports.default = function (self) {
|
||||
var opusEncoder, celt7Encoder;
|
||||
var bitrate;
|
||||
self.addEventListener('message', function (e) {
|
||||
@@ -70,7 +66,7 @@ exports.default = function (self) {
|
||||
}, [_buffer]);
|
||||
}
|
||||
});
|
||||
-};
|
||||
+
|
||||
|
||||
var _libopus = require('libopus.js');
|
||||
|
||||
@@ -83,3 +79,5 @@ var _toArraybuffer2 = _interopRequireDefault(_toArraybuffer);
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var MUMBLE_SAMPLE_RATE = 48000;
|
||||
+
|
||||
+export default null
|
||||
\ No newline at end of file
|
||||
diff --git a/node_modules/mumble-client-codecs-browser/lib/encoder-stream.js b/node_modules/mumble-client-codecs-browser/lib/encoder-stream.js
|
||||
index 021f131..853a99e 100644
|
||||
--- a/node_modules/mumble-client-codecs-browser/lib/encoder-stream.js
|
||||
|
|
Loading…
Reference in a new issue