Commit b16f2f95 authored by NzSN's avatar NzSN

Redo project structure.

parent 0b8246a6
......@@ -28,7 +28,8 @@ module.exports = function(config) {
files: [
{ pattern: 'src/**/*.js', included: false, served: true },
{ pattern: 'tests/**/*.js', included: true },
{ pattern: 'resources/**/*.js', included: false, served: true }
{ pattern: 'resources/**/*.js', included: false, served: true },
{ pattern: 'resources/**/*.wasm', included: false, served: true }
],
// list of files / patterns to exclude
......
......@@ -8,13 +8,17 @@
},
"devDependencies": {
"@babel/core": "^7.17.9",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"babel": "^6.23.0",
"babel-loader": "^8.2.5",
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"jasmine": "^4.1.0",
"jasmine-browser-runner": "^1.0.0",
"jasmine-core": "^4.1.0",
"karma": "^6.3.18",
"karma-browserify": "^8.1.0",
"karma-chrome-launcher": "^3.1.1",
"karma-firefox-launcher": "^2.1.2",
"karma-jasmine": "^5.0.0",
......@@ -35,6 +39,7 @@
"author": "Linshizhi",
"license": "ISC",
"dependencies": {
"@babel/runtime": "^7.17.9",
"karma-cli": "^2.0.0",
"karma-webpack": "^5.0.0",
"rxjs": "^7.5.5"
......
onmessage = e => {
console.log(e.data);
postMessage(e.data);
}
......@@ -13,10 +13,10 @@ const SLEEP_INTERVAL = 100;
const SPIN_TIMEOUT = 500;
// Read H264 Encode Group definitions
self.importScripts('/src/workers/defs.js');
self.importScripts('defs.js');
// Load wasm encoder
self.importScripts('/src/mp4encoder.js');
self.importScripts('mp4encoder.js');
createMP4Encoder().then(m => {
encoder = m;
});
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,10 +7,10 @@ const SLEEP_INTERVAL = 100;
const SPIN_TIMEOUT = 500;
// Read H264 Encode Group definitions
self.importScripts('/src/workers/defs.js');
self.importScripts('defs.js');
// Load wasm encoder
self.importScripts('/src/mp4encoder.js');
self.importScripts('mp4encoder.js');
createMP4Encoder().then(m => {
encoder = m;
});
......
......@@ -90,11 +90,11 @@ export class H264EncWWGroup extends WWGroup {
// in order.
// Create Muxer
this.#muxWorker = new WW("MUX", './workers/muxWW.js');
this.#muxWorker = new WW("MUX", '../resources/workers/muxWW.js');
// Create Encoder
for (let i = 0; i < this.#numOfEncWorker; ++i) {
let worker = new WW("ENC_" + i, './workers/encWW.js');
let worker = new WW("ENC_" + i, '../resources/workers/encWW.js');
this.#encWorkers.push(worker);
}
}
......
import { WW } from '../src/WW.js';
// For Webpack 5
let url = '../resources/worker.js';
let url = '../resources/tests/worker.js';
describe("WW Spec", () => {
it("Instantiation", async () => {
......@@ -47,8 +47,8 @@ describe("WW Spec", () => {
// of an input number.
it("Worker Connect", async () => {
let src = new WW('SRC', '../resources/workerSRC.js');
let dst = new WW('DST', '../resources/workerDST.js');
let src = new WW('SRC', '../resources/tests/workerSRC.js');
let dst = new WW('DST', '../resources/tests/workerDST.js');
src.connect(dst, async ()=>{}, (data)=>{
......
......@@ -130,7 +130,7 @@ describe("Channel Spec", () => {
it("Transfer 64 MB to WebWorker", async () => {
let ret = true;
let channel = new Channel(Math.pow(2,16));
let worker = new Worker('./workers/channelWW.js', { type: 'module' });
let worker = new Worker('../resources/tests/channelWW.js');
let sended = 0;
let dataToWrite = new Uint8Array(
......
......@@ -4,7 +4,7 @@
WORKPATH=$(cd $(dirname $0); pwd)
DEMO_PATH=$WORKPATH/src
DEMO_PATH=$WORKPATH
echo "WORKPATH"=$WORKPATH
......@@ -28,11 +28,11 @@ if [[ "$FFMPEG_ST" != "yes" ]]; then
-pthread
-s USE_PTHREADS=1 # enable pthreads support
-s PROXY_TO_PTHREAD=1 # detach main() from browser/UI main thread
-o ${DEMO_PATH}/mp4encoder.js
-o ${DEMO_PATH}/resources/workers/mp4encoder.js
)
else
EXTRA_FLAGS=(
-o ${DEMO_PATH}/mp4encoder.js
-o ${DEMO_PATH}/resources/workers/mp4encoder.js
)
fi
......
const path = require('path');
const webpack = require("webpack");
module.exports = {
entry: './specs.js',
mode: 'development',
output: {
filename: 'spec_bundle.js',
path: path.resolve(__dirname, 'tmp'),
},
mode: 'development',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader']
},
]
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
})
]
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment