From 09d92c57eddff1a6bd72696c31d3e143661d8ef4 Mon Sep 17 00:00:00 2001 From: xiewenlong1202 Date: Tue, 2 Jul 2019 10:14:09 +0800 Subject: [PATCH 01/52] improve publish method (#177) 1. when no 'options' publish stream as it is. 2. allow disable audio/video when stream has both --- src/sdk/conference/channel.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sdk/conference/channel.js b/src/sdk/conference/channel.js index 2c2d2a2a..25a8f236 100644 --- a/src/sdk/conference/channel.js +++ b/src/sdk/conference/channel.js @@ -77,20 +77,20 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { publish(stream, options) { if (options === undefined) { - options = {audio: !!stream.mediaStream.getAudioTracks(), video: !!stream - .mediaStream.getVideoTracks()}; + options = {audio: !!stream.mediaStream.getAudioTracks().length, video: !!stream + .mediaStream.getVideoTracks().length}; } if (typeof options !== 'object') { return Promise.reject(new TypeError('Options should be an object.')); } if (options.audio === undefined) { - options.audio = !!stream.mediaStream.getAudioTracks(); + options.audio = !!stream.mediaStream.getAudioTracks().length; } if (options.video === undefined) { - options.video = !!stream.mediaStream.getVideoTracks(); + options.video = !!stream.mediaStream.getVideoTracks().length; } - if (!!options.audio === !stream.mediaStream.getAudioTracks().length || !! - options.video === !stream.mediaStream.getVideoTracks().length) { + if ((!!options.audio && !stream.mediaStream.getAudioTracks().length) || + (!!options.video && !stream.mediaStream.getVideoTracks().length)) { return Promise.reject(new ConferenceError( 'options.audio/video is inconsistent with tracks presented in the ' + 'MediaStream.' From 496f416d5072543c26a71cf7751116ccca2e7302 Mon Sep 17 00:00:00 2001 From: zhangyihui1 <42208024+zhangyihui1@users.noreply.github.com> Date: Thu, 11 Jul 2019 13:38:41 +0800 Subject: [PATCH 02/52] Test p2p js with chrome headless mode. (#183) --- test/p2ptest/karma_config/chrome-start.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/p2ptest/karma_config/chrome-start.sh b/test/p2ptest/karma_config/chrome-start.sh index a6732dd4..a945cd2c 100755 --- a/test/p2ptest/karma_config/chrome-start.sh +++ b/test/p2ptest/karma_config/chrome-start.sh @@ -17,4 +17,5 @@ fi # Execute the command export DISPLAY=:0 -exec "$CMD" --user-data-dir="$USER_DIR" --proxy-auto-detect --window-size=950,450 --use-fake-ui-for-media-stream --disable-user-media-security --no-default-browser-check --no-first-run --disable-default-apps --use-fake-device-for-media-stream "$@" +exec "$CMD" --user-data-dir="$USER_DIR" --enable-logging --v=1 --allow-file-access-from-files --no-proxy-server --no-sandbox --use-fake-ui-for-media-stream --disable-user-media-security --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --use-fake-device-for-media-stream --headless --remote-debugging-port=9222 "$@" +#exec "$CMD" --user-data-dir="$USER_DIR" --proxy-auto-detect --window-size=950,450 --use-fake-ui-for-media-stream --disable-user-media-security --no-default-browser-check --no-first-run --disable-default-apps --use-fake-device-for-media-stream "$@" From 7bfd3db4ed57211d2717a2d1ad1df2ffe13af8b9 Mon Sep 17 00:00:00 2001 From: Jianjun Zhu Date: Mon, 15 Jul 2019 13:38:03 +0800 Subject: [PATCH 03/52] Upgrade npm dependencies. --- package-lock.json | 131 ++++++++++++---------------------------------- 1 file changed, 34 insertions(+), 97 deletions(-) diff --git a/package-lock.json b/package-lock.json index c43a8ea1..72288170 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1097,8 +1097,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true, - "optional": true + "dev": true }, "archiver": { "version": "1.3.0", @@ -1147,7 +1146,6 @@ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, - "optional": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -1308,8 +1306,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true, - "optional": true + "dev": true }, "assign-symbols": { "version": "1.0.0", @@ -1319,7 +1316,7 @@ }, "async": { "version": "1.5.2", - "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, @@ -2090,8 +2087,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true + "dev": true }, "coffeescript": { "version": "1.10.0", @@ -2155,7 +2151,6 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", "dev": true, - "optional": true, "requires": { "delayed-stream": "~1.0.0" } @@ -2233,8 +2228,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true + "dev": true }, "constants-browserify": { "version": "1.0.0", @@ -2526,15 +2520,13 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true, - "optional": true + "dev": true }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true, - "optional": true + "dev": true }, "depd": { "version": "1.1.2", @@ -3244,8 +3236,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true, - "optional": true + "dev": true }, "eyes": { "version": "0.1.8", @@ -3496,8 +3487,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -3518,14 +3508,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3540,20 +3528,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -3670,8 +3655,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -3683,7 +3667,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3698,7 +3681,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3706,14 +3688,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3732,7 +3712,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -3813,8 +3792,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -3826,7 +3804,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -3912,8 +3889,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -3949,7 +3925,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3969,7 +3944,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4013,14 +3987,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -4029,7 +4001,6 @@ "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", "dev": true, - "optional": true, "requires": { "graceful-fs": "^4.1.2", "inherits": "~2.0.0", @@ -4054,7 +4025,6 @@ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, - "optional": true, "requires": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -4651,8 +4621,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true, - "optional": true + "dev": true }, "has-value": { "version": "1.0.0", @@ -5178,7 +5147,6 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5335,8 +5303,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true, - "optional": true + "dev": true }, "js-levenshtein": { "version": "1.1.4", @@ -5373,8 +5340,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true + "dev": true }, "jsdoc": { "version": "3.6.2", @@ -6268,9 +6234,9 @@ "dev": true }, "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "dev": true, "requires": { "for-in": "^1.0.2", @@ -6587,7 +6553,6 @@ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, - "optional": true, "requires": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -7769,13 +7734,12 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true, - "optional": true + "dev": true }, "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -8241,7 +8205,6 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -8591,7 +8554,6 @@ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.0.1" } @@ -8600,8 +8562,7 @@ "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true + "dev": true }, "type-check": { "version": "0.3.2", @@ -8729,38 +8690,15 @@ "dev": true }, "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "dev": true, "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } + "set-value": "^2.0.1" } }, "unpipe": { @@ -8995,7 +8933,6 @@ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, - "optional": true, "requires": { "string-width": "^1.0.2 || 2" } From a9c6e36a3729b8576c4ed4f6796270588de29920 Mon Sep 17 00:00:00 2001 From: cisco6 <44567104+cisco6@users.noreply.github.com> Date: Tue, 16 Jul 2019 14:23:12 +0800 Subject: [PATCH 04/52] Enhancement for Conference CI process (#187) * CIjsupdate * CIjsupdatejenkinsfile --- test/conference.jenkinsfile | 63 ++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/test/conference.jenkinsfile b/test/conference.jenkinsfile index fd43352d..24da8a0d 100644 --- a/test/conference.jenkinsfile +++ b/test/conference.jenkinsfile @@ -1,56 +1,63 @@ void setBuildStatus(String message, String state) { - step([ - $class: "GitHubCommitStatusSetter", - reposSource: [$class: "ManuallyEnteredRepositorySource", url: "${REPO_URL}/owt-client-javascript"], - contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/conference"], - errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], - statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] - ]); + step([ + $class: "GitHubCommitStatusSetter", + reposSource: [$class: "ManuallyEnteredRepositorySource", url: "${REPO_URL}/owt-client-javascript"], + contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/conference"], + errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], + statusResultSource: [$class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]]] + ]); } + + pipeline { agent any + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) + } stages { stage('Unit test') { steps { podTemplate(name: 'unit-test', label: 'unit-test', cloud: 'kubernetes', containers: [ - containerTemplate(name: 'unit-test', image: "$env.TEST_IMAGE", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '500m', resourceLimitCpu: '1000m', network: 'host', command: 'cat') - ]) { + containerTemplate(name: 'unit-test', image: "$env.JSMCU_TEST_IMAGE", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '500m', resourceLimitCpu: '1000m', resourceLimitMemory: '1.0Gi', resourceRequestMemory: '0.5Gi', network: 'host', command: 'cat') + ]) { node('unit-test') { container('unit-test') { - sh "cd /root/oms-client-javascript/test/unit/karma-test/ && ./start.sh" + sh "cd /root/oms-client-javascript/test/unit/karma-test/ && ./start.sh" } } } } } stage('Build package') { + options { timeout(time: 10, unit: 'MINUTES') } steps { podTemplate(name: 'pack', label: 'pack-mcu', containers: [ - containerTemplate(name: 'pack-on-centos', image: "$env.PACK_IMAGE", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '7000m', resourceLimitCpu: '8000m', network: 'host', command: 'cat') + containerTemplate(name: 'pack-on-centos', image: "$env.JS_MCU_BUILD", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '1000m', resourceLimitCpu: '1500m', resourceLimitMemory: '1.5Gi', resourceRequestMemory: '1.0Gi', network: 'host', command: 'cat') ]){ - node ('pack-mcu') { - container ('pack-on-centos') { - sh "/root/packSDKInDocker.sh software $env.GIT_COMMIT $env.GIT_BRANCH $env.CHANGE_ID" - } + node('pack-mcu') { + container('pack-on-centos') { + sh "/root/packSDKInDocker.sh $env.GIT_COMMIT $env.GIT_BRANCH $env.CHANGE_ID" + } } } } } stage('Start test') { + options { timeout(time: 60, unit: 'MINUTES') } parallel { stage('API test') { steps { podTemplate(name: 'api-test', label: 'api-test', cloud: 'kubernetes', containers: [ - containerTemplate(name: 'api-test', image: "$env.TEST_IMAGE", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '3000m', resourceLimitCpu: '4000m', network: 'host', command: 'cat'), - ]) { - + containerTemplate(name: 'api-test', image: "$env.JSMCU_TEST_IMAGE", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '8000m', resourceLimitCpu: '9000m', resourceLimitMemory: '10.0Gi', resourceRequestMemory: '9.0Gi', network: 'host', command: 'cat'), + ]) { + node('api-test') { - container('api-test') { - sh "/root/start.sh ${env.GIT_COMMIT}1 ConferenceClient_api" - } + container('api-test') { + sh "/root/start.sh ${env.GIT_COMMIT}1 ConferenceClient_api" + } } } } @@ -58,14 +65,14 @@ pipeline { stage('Subscribe test') { steps { - podTemplate(name:'subscribe-test', label: 'subscribe-test', cloud: 'kubernetes', containers: [ - containerTemplate(name: 'subscribe-test', image: "$env.TEST_IMAGE", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '3000m', resourceLimitCpu: '4000m', network: 'host', command: 'cat'), - ]) { - + podTemplate(name: 'subscribe-test', label: 'subscribe-test', cloud: 'kubernetes', containers: [ + containerTemplate(name: 'subscribe-test', image: "$env.JSMCU_TEST_IMAGE", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '8000m', resourceLimitCpu: '9000m', resourceLimitMemory: '10.0Gi', resourceRequestMemory: '9.0Gi', network: 'host', command: 'cat'), + ]) { + node('subscribe-test') { - container('subscribe-test') { - sh "/root/start.sh ${env.GIT_COMMIT}2 ConferenceClient_subscribe" - } + container('subscribe-test') { + sh "/root/start.sh ${env.GIT_COMMIT}2 ConferenceClient_subscribe" + } } } } From 8779ba12305ff19d8b39485ff86413c8200d17b5 Mon Sep 17 00:00:00 2001 From: cisco66666 <52657199+cisco66666@users.noreply.github.com> Date: Mon, 22 Jul 2019 13:35:01 +0800 Subject: [PATCH 05/52] fix unit test (#190) --- test/conference.jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/conference.jenkinsfile b/test/conference.jenkinsfile index 24da8a0d..504b5a13 100644 --- a/test/conference.jenkinsfile +++ b/test/conference.jenkinsfile @@ -24,7 +24,7 @@ pipeline { ]) { node('unit-test') { container('unit-test') { - sh "cd /root/oms-client-javascript/test/unit/karma-test/ && ./start.sh" + sh "cd /root/owt-client-javascript/test/unit/karma-test/ && ./start.sh" } } } From 69423f5cb805c524696daf0d5f8012d705add787 Mon Sep 17 00:00:00 2001 From: cisco66666 <52657199+cisco66666@users.noreply.github.com> Date: Fri, 26 Jul 2019 16:20:25 +0800 Subject: [PATCH 06/52] Add ubuntu jenkinsfile with js (#195) --- test/ubuntuconference.jenkinsfile | 92 +++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 test/ubuntuconference.jenkinsfile diff --git a/test/ubuntuconference.jenkinsfile b/test/ubuntuconference.jenkinsfile new file mode 100644 index 00000000..0874d742 --- /dev/null +++ b/test/ubuntuconference.jenkinsfile @@ -0,0 +1,92 @@ +void setBuildStatus(String message, String state) { + step([ + $class: "GitHubCommitStatusSetter", + reposSource: [$class: "ManuallyEnteredRepositorySource", url: "${REPO_URL}/owt-client-javascript"], + contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/conference"], + errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], + statusResultSource: [$class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]]] + ]); +} + + + + +pipeline { + agent any + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) + } + stages { + stage('Unit test') { + steps { + podTemplate(name: 'unit-test', label: 'unit-test', cloud: 'kubernetes', containers: [ + containerTemplate(name: 'unit-test', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '500m', resourceLimitCpu: '1000m', resourceLimitMemory: '1.0Gi', resourceRequestMemory: '0.5Gi', network: 'host', command: 'cat') + ]) { + node('unit-test') { + container('unit-test') { + sh "cd /root/owt-client-javascript/test/unit/karma-test/ && ./start.sh" + } + } + } + } + } + stage('Build package') { + options { timeout(time: 20, unit: 'MINUTES') } + steps { + podTemplate(name: 'pack', label: 'pack-mcu', containers: [ + containerTemplate(name: 'pack-on-centos', image: "$env.JS_MCU_BUILD_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '1000m', resourceLimitCpu: '1500m', resourceLimitMemory: '1.5Gi', resourceRequestMemory: '1.0Gi', network: 'host', command: 'cat') + ]){ + node('pack-mcu') { + container('pack-on-centos') { + sh "/root/packSDKInDocker.sh $env.GIT_COMMIT $env.GIT_BRANCH $env.CHANGE_ID" + } + } + } + } + } + + stage('Start test') { + options { timeout(time: 100, unit: 'MINUTES') } + parallel { + stage('API test') { + steps { + podTemplate(name: 'api-test', label: 'api-test', cloud: 'kubernetes', containers: [ + containerTemplate(name: 'api-test', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '8000m', resourceLimitCpu: '9000m', resourceLimitMemory: '10.0Gi', resourceRequestMemory: '9.0Gi', network: 'host', command: 'cat'), + ]) { + + node('api-test') { + container('api-test') { + sh "/root/start.sh ${env.GIT_COMMIT}1 ConferenceClient_api" + } + } + } + } + } + + stage('Subscribe test') { + steps { + podTemplate(name: 'subscribe-test', label: 'subscribe-test', cloud: 'kubernetes', containers: [ + containerTemplate(name: 'subscribe-test', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '8000m', resourceLimitCpu: '9000m', resourceLimitMemory: '10.0Gi', resourceRequestMemory: '9.0Gi', network: 'host', command: 'cat'), + ]) { + + node('subscribe-test') { + container('subscribe-test') { + sh "/root/start.sh ${env.GIT_COMMIT}2 ConferenceClient_subscribe" + } + } + } + } + } + } + } + } + + post { + success { + setBuildStatus("Build succeeded", "SUCCESS"); + } + failure { + setBuildStatus("Build failed", "FAILURE"); + } + } +} From 5ce7796cef429c496459e6f9e2cc962fe8b47ba0 Mon Sep 17 00:00:00 2001 From: cisco66666 <52657199+cisco66666@users.noreply.github.com> Date: Mon, 29 Jul 2019 15:48:49 +0800 Subject: [PATCH 07/52] Update ubuntu's Jenkins file on JS to create a new podTemplate (#198) * Update ubuntu's Jenkins file on JS to create a new podTemplate and not conflict with centos's podTemplate * fix timeout --- test/conference.jenkinsfile | 4 ++-- test/ubuntuconference.jenkinsfile | 35 ++++++++++++++++--------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/test/conference.jenkinsfile b/test/conference.jenkinsfile index 504b5a13..cdc69413 100644 --- a/test/conference.jenkinsfile +++ b/test/conference.jenkinsfile @@ -31,7 +31,7 @@ pipeline { } } stage('Build package') { - options { timeout(time: 10, unit: 'MINUTES') } + options { timeout(time: 20, unit: 'MINUTES') } steps { podTemplate(name: 'pack', label: 'pack-mcu', containers: [ containerTemplate(name: 'pack-on-centos', image: "$env.JS_MCU_BUILD", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '1000m', resourceLimitCpu: '1500m', resourceLimitMemory: '1.5Gi', resourceRequestMemory: '1.0Gi', network: 'host', command: 'cat') @@ -46,7 +46,7 @@ pipeline { } stage('Start test') { - options { timeout(time: 60, unit: 'MINUTES') } + options { timeout(time: 40, unit: 'MINUTES') } parallel { stage('API test') { steps { diff --git a/test/ubuntuconference.jenkinsfile b/test/ubuntuconference.jenkinsfile index 0874d742..68eee9f2 100644 --- a/test/ubuntuconference.jenkinsfile +++ b/test/ubuntuconference.jenkinsfile @@ -19,11 +19,11 @@ pipeline { stages { stage('Unit test') { steps { - podTemplate(name: 'unit-test', label: 'unit-test', cloud: 'kubernetes', containers: [ - containerTemplate(name: 'unit-test', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '500m', resourceLimitCpu: '1000m', resourceLimitMemory: '1.0Gi', resourceRequestMemory: '0.5Gi', network: 'host', command: 'cat') + podTemplate(name: 'unit-test-ubuntu', label: 'unit-test-ubuntu', cloud: 'kubernetes', containers: [ + containerTemplate(name: 'unit-test-ubuntu', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '500m', resourceLimitCpu: '1000m', resourceLimitMemory: '1.0Gi', resourceRequestMemory: '0.5Gi', network: 'host', command: 'cat') ]) { - node('unit-test') { - container('unit-test') { + node('unit-test-ubuntu') { + container('unit-test-ubuntu') { sh "cd /root/owt-client-javascript/test/unit/karma-test/ && ./start.sh" } } @@ -33,11 +33,11 @@ pipeline { stage('Build package') { options { timeout(time: 20, unit: 'MINUTES') } steps { - podTemplate(name: 'pack', label: 'pack-mcu', containers: [ - containerTemplate(name: 'pack-on-centos', image: "$env.JS_MCU_BUILD_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '1000m', resourceLimitCpu: '1500m', resourceLimitMemory: '1.5Gi', resourceRequestMemory: '1.0Gi', network: 'host', command: 'cat') + podTemplate(name: 'pack-ubuntu', label: 'pack-mcu-ubuntu', containers: [ + containerTemplate(name: 'pack-on-ubuntu', image: "$env.JS_MCU_BUILD_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '1000m', resourceLimitCpu: '1500m', resourceLimitMemory: '1.5Gi', resourceRequestMemory: '1.0Gi', network: 'host', command: 'cat') ]){ - node('pack-mcu') { - container('pack-on-centos') { + node('pack-mcu-ubuntu') { + container('pack-on-ubuntu') { sh "/root/packSDKInDocker.sh $env.GIT_COMMIT $env.GIT_BRANCH $env.CHANGE_ID" } } @@ -46,16 +46,16 @@ pipeline { } stage('Start test') { - options { timeout(time: 100, unit: 'MINUTES') } + options { timeout(time: 40, unit: 'MINUTES') } parallel { stage('API test') { steps { - podTemplate(name: 'api-test', label: 'api-test', cloud: 'kubernetes', containers: [ - containerTemplate(name: 'api-test', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '8000m', resourceLimitCpu: '9000m', resourceLimitMemory: '10.0Gi', resourceRequestMemory: '9.0Gi', network: 'host', command: 'cat'), + podTemplate(name: 'api-test-ubuntu', label: 'api-test-ubuntu', cloud: 'kubernetes', containers: [ + containerTemplate(name: 'api-test-ubuntu', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '8000m', resourceLimitCpu: '9000m', resourceLimitMemory: '10.0Gi', resourceRequestMemory: '9.0Gi', network: 'host', command: 'cat'), ]) { - node('api-test') { - container('api-test') { + node('api-test-ubuntu') { + container('api-test-ubuntu') { sh "/root/start.sh ${env.GIT_COMMIT}1 ConferenceClient_api" } } @@ -65,12 +65,12 @@ pipeline { stage('Subscribe test') { steps { - podTemplate(name: 'subscribe-test', label: 'subscribe-test', cloud: 'kubernetes', containers: [ - containerTemplate(name: 'subscribe-test', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '8000m', resourceLimitCpu: '9000m', resourceLimitMemory: '10.0Gi', resourceRequestMemory: '9.0Gi', network: 'host', command: 'cat'), + podTemplate(name: 'subscribe-test-ubuntu', label: 'subscribe-test-ubuntu', cloud: 'kubernetes', containers: [ + containerTemplate(name: 'subscribe-test-ubuntu', image: "$env.JSMCU_TEST_IMAGE_UBUNTU", ttyEnabled: true, alwaysPullImage: true, privileged: true, resourceRequestCpu: '8000m', resourceLimitCpu: '9000m', resourceLimitMemory: '10.0Gi', resourceRequestMemory: '9.0Gi', network: 'host', command: 'cat'), ]) { - node('subscribe-test') { - container('subscribe-test') { + node('subscribe-test-ubuntu') { + container('subscribe-test-ubuntu') { sh "/root/start.sh ${env.GIT_COMMIT}2 ConferenceClient_subscribe" } } @@ -90,3 +90,4 @@ pipeline { } } } + From b1c112269e2bf217eff96e5e60a82445d14bb8ca Mon Sep 17 00:00:00 2001 From: archer <2232502139@qq.com> Date: Fri, 2 Aug 2019 16:36:36 +0800 Subject: [PATCH 08/52] add checks function (#199) * add checks function * add ubutun config --- test/conference.jenkinsfile | 5 +++++ test/ubuntuconference.jenkinsfile | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/conference.jenkinsfile b/test/conference.jenkinsfile index cdc69413..832de0c7 100644 --- a/test/conference.jenkinsfile +++ b/test/conference.jenkinsfile @@ -82,6 +82,11 @@ pipeline { } post { + always { + script { + sh "curl -H \"Content-Type: application/json\" -X POST --data '{\"commit_id\":\"'$GIT_COMMIT'\",\"job_path\":\"'${env.JS_CHECK_PATH}'\",\"job_name\":\"'$JOB_BASE_NAME'\",\"build_num\":\"'$BUILD_NUMBER'\",\"os_version\":\"'$env.CENTOS_VERSION'\"}' '${env.checkServerUrl}'/runServer/JS_BUILD_CONFERENCE_STEPS" + } + } success { setBuildStatus("Build succeeded", "SUCCESS"); } diff --git a/test/ubuntuconference.jenkinsfile b/test/ubuntuconference.jenkinsfile index 68eee9f2..394b9a28 100644 --- a/test/ubuntuconference.jenkinsfile +++ b/test/ubuntuconference.jenkinsfile @@ -2,7 +2,7 @@ void setBuildStatus(String message, String state) { step([ $class: "GitHubCommitStatusSetter", reposSource: [$class: "ManuallyEnteredRepositorySource", url: "${REPO_URL}/owt-client-javascript"], - contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/conference"], + contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/ubuntuconference"], errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], statusResultSource: [$class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]]] ]); @@ -82,6 +82,12 @@ pipeline { } post { + + always { + script { + sh "curl -H \"Content-Type: application/json\" -X POST --data '{\"commit_id\":\"'$GIT_COMMIT'\",\"job_path\":\"'${env.JS_CHECK_UBUNTU_PATH}'\",\"job_name\":\"'$JOB_BASE_NAME'\",\"build_num\":\"'$BUILD_NUMBER'\",\"os_version\":\"'$env.UBUTUN_VERSION'\"}' '${env.checkServerUrl}'/runServer/JS_BUILD_CONFERENCE_STEPS" + } + } success { setBuildStatus("Build succeeded", "SUCCESS"); } From 120f9ae9a01f665176d93275a69624d0ae061454 Mon Sep 17 00:00:00 2001 From: Jianjun Zhu Date: Mon, 12 Aug 2019 17:51:48 +0800 Subject: [PATCH 09/52] Publish method accepts RTCRtpEncodingParameters as options. This change makes simulcast possibile. --- docs/mdfiles/changelog.md | 3 ++ src/sdk/base/publication.js | 6 ++- src/sdk/conference/channel.js | 91 ++++++++++++++++++++++++++--------- 3 files changed, 76 insertions(+), 24 deletions(-) diff --git a/docs/mdfiles/changelog.md b/docs/mdfiles/changelog.md index 00560c03..47374314 100644 --- a/docs/mdfiles/changelog.md +++ b/docs/mdfiles/changelog.md @@ -1,5 +1,8 @@ Change Log ========== +# 4.3 +* The type of `conferenceClient.publish` method's option is changed from `AudioEncodingParameters` and `VideoEncodingParameters` to `RTCRtpSendParameters`. + # 4.0.2 * Fix a compatibility issue for Chrome 69 beta. diff --git a/src/sdk/base/publication.js b/src/sdk/base/publication.js index 8775986a..fa52d595 100644 --- a/src/sdk/base/publication.js +++ b/src/sdk/base/publication.js @@ -171,15 +171,17 @@ export class PublishOptions { // eslint-disable-next-line require-jsdoc constructor(audio, video) { /** - * @member {?Array} audio + * @member {?Array | ?Array} audio * @instance * @memberof Owt.Base.PublishOptions + * @desc Parameters for audio RtpSender. */ this.audio = audio; /** - * @member {?Array} video + * @member {?Array | ?Array} video * @instance * @memberof Owt.Base.PublishOptions + * @desc Parameters for video RtpSender. */ this.video = video; } diff --git a/src/sdk/conference/channel.js b/src/sdk/conference/channel.js index 25a8f236..7dedd9ca 100644 --- a/src/sdk/conference/channel.js +++ b/src/sdk/conference/channel.js @@ -83,6 +83,13 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { if (typeof options !== 'object') { return Promise.reject(new TypeError('Options should be an object.')); } + if ((this._isRtpEncodingParameters(options.audio) && + this._isOwtEncodingParameters(options.video)) || + (this._isOwtEncodingParameters(options.audio) && + this._isRtpEncodingParameters(options.video))) { + return Promise.reject(new ConferenceError( + 'Mixing RTCRtpEncodingParameters and AudioEncodingParameters/VideoEncodingParameters is not allowed.')) + } if (options.audio === undefined) { options.audio = !!stream.mediaStream.getAudioTracks().length; } @@ -115,18 +122,20 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { } } } - if (typeof options.video === 'object') { - if (!Array.isArray(options.video)) { - return Promise.reject(new TypeError( - 'options.video should be a boolean or an array.')); - } + if (typeof options.video === 'object' && !Array.isArray(options.video)) { + return Promise.reject(new TypeError( + 'options.video should be a boolean or an array.')); + } + if (this._isOwtEncodingParameters(options.video)) { for (const parameters of options.video) { - if (!parameters.codec || typeof parameters.codec.name !== 'string' || ( - parameters.maxBitrate !== undefined && typeof parameters.maxBitrate - !== 'number') || (parameters.codec.profile !== undefined - && typeof parameters.codec.profile !== 'string')) { + if (!parameters.codec || typeof parameters.codec.name !== 'string' || + ( + parameters.maxBitrate !== undefined && typeof parameters + .maxBitrate !== + 'number') || (parameters.codec.profile !== undefined && + typeof parameters.codec.profile !== 'string')) { return Promise.reject(new TypeError( - 'options.video has incorrect parameters.')); + 'options.video has incorrect parameters.')); } } } @@ -149,9 +158,6 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { } mediaOptions.audio = {}; mediaOptions.audio.source = stream.source.audio; - for (const track of stream.mediaStream.getAudioTracks()) { - this._pc.addTrack(track, stream.mediaStream); - } } else { mediaOptions.audio = false; } @@ -174,9 +180,6 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { }, framerate: trackSettings.frameRate, }; - for (const track of stream.mediaStream.getVideoTracks()) { - this._pc.addTrack(track, stream.mediaStream); - } } else { mediaOptions.video = false; } @@ -197,15 +200,31 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { }; if (typeof this._pc.addTransceiver === 'function') { // |direction| seems not working on Safari. - if (mediaOptions.audio && stream.mediaStream.getAudioTracks() > 0) { - this._pc.addTransceiver('audio', {direction: 'sendonly'}); + if (mediaOptions.audio && stream.mediaStream.getAudioTracks().length > + 0) { + const transceiverInit = { + direction: 'sendonly' + }; + if (this._isRtpEncodingParameters(options.audio)) { + transceiverInit.sendEncodings = options.audio; + } + this._pc.addTransceiver(stream.mediaStream.getAudioTracks()[0], + transceiverInit); } - if (mediaOptions.video && stream.mediaStream.getVideoTracks() > 0) { - this._pc.addTransceiver('video', {direction: 'sendonly'}); + if (mediaOptions.video && stream.mediaStream.getVideoTracks().length > + 0) { + const transceiverInit = { + direction: 'sendonly' + }; + if (this._isRtpEncodingParameters(options.video)) { + transceiverInit.sendEncodings = options.video; + } + this._pc.addTransceiver(stream.mediaStream.getVideoTracks()[0], + transceiverInit); } } let localDesc; - this._pc.createOffer(offerOptions).then((desc) => { + this._pc.createOffer().then((desc) => { if (options) { desc.sdp = this._setRtpReceiverOptions(desc.sdp, options); } @@ -332,7 +351,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { this._pc.addTransceiver('video', {direction: 'recvonly'}); } } - this._pc.createOffer(offerOptions).then((desc) => { + this._pc.createOffer().then((desc) => { if (options) { desc.sdp = this._setRtpReceiverOptions(desc.sdp, options); } @@ -645,11 +664,20 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { } _setRtpSenderOptions(sdp, options) { + // SDP mugling is deprecated, moving to `setParameters`. + if (this._isRtpEncodingParameters(options.audio) || + this._isRtpEncodingParameters(options.video)) { + return sdp; + } sdp = this._setMaxBitrate(sdp, options); return sdp; } _setRtpReceiverOptions(sdp, options) { + if (this._isRtpEncodingParameters(options.audio) || + this._isRtpEncodingParameters(options.video)) { + return sdp; + } sdp = this._setCodecOrder(sdp, options); return sdp; } @@ -683,4 +711,23 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { Logger.warning('Invalid data value for stream update info.'); } } + + _isRtpEncodingParameters(obj) { + if (!Array.isArray(obj)) { + return false; + } + // Only check the first one. + const param = obj[0]; + return param.codecPayloadType || param.dtx || param.active || param + .ptime || param.maxFramerate || param.scaleResolutionDownBy || param.rid; + } + + _isOwtEncodingParameters(obj) { + if (!Array.isArray(obj)) { + return false; + } + // Only check the first one. + const param = obj[0]; + return !!param.codec; + } } From 2e81905d960ca97ed51ef6e136d0edbdb69f5519 Mon Sep 17 00:00:00 2001 From: Jianjun Zhu Date: Fri, 16 Aug 2019 16:18:57 +0800 Subject: [PATCH 10/52] Upgrade conference protocol version to 1.1. --- docs/mdfiles/changelog.md | 1 + src/sdk/base/publication.js | 13 ++++++-- src/sdk/conference/client.js | 2 +- src/sdk/conference/streamutils.js | 51 +++++++++++++++---------------- 4 files changed, 36 insertions(+), 31 deletions(-) diff --git a/docs/mdfiles/changelog.md b/docs/mdfiles/changelog.md index 47374314..26d613c4 100644 --- a/docs/mdfiles/changelog.md +++ b/docs/mdfiles/changelog.md @@ -2,6 +2,7 @@ Change Log ========== # 4.3 * The type of `conferenceClient.publish` method's option is changed from `AudioEncodingParameters` and `VideoEncodingParameters` to `RTCRtpSendParameters`. +* `audio` and `video` of `PublicationSettings` is changed from `AudioPublicationSettings` and `VideoPublicationSettings` to `AudioPublicationSettings` array and `VideoPublicationSettings` array. # 4.0.2 * Fix a compatibility issue for Chrome 69 beta. diff --git a/src/sdk/base/publication.js b/src/sdk/base/publication.js index fa52d595..889cefaa 100644 --- a/src/sdk/base/publication.js +++ b/src/sdk/base/publication.js @@ -34,7 +34,7 @@ export class AudioPublicationSettings { */ export class VideoPublicationSettings { // eslint-disable-next-line require-jsdoc - constructor(codec, resolution, frameRate, bitrate, keyFrameInterval) { + constructor(codec, resolution, frameRate, bitrate, keyFrameInterval, rid) { /** * @member {?Owt.Base.VideoCodecParameters} codec * @instance @@ -67,6 +67,13 @@ export class VideoPublicationSettings { * @memberof Owt.Base.VideoPublicationSettings */ this.keyFrameInterval=keyFrameInterval; + /** + * @member {?number} rid + * @instance + * @classDesc Restriction identifier to identify the RTP Streams within an RTP session. + * @memberof Owt.Base.VideoPublicationSettings + */ + this.rid=rid; } } @@ -80,13 +87,13 @@ export class PublicationSettings { // eslint-disable-next-line require-jsdoc constructor(audio, video) { /** - * @member {Owt.Base.AudioPublicationSettings} audio + * @member {Owt.Base.AudioPublicationSettings[]} audio * @instance * @memberof Owt.Base.PublicationSettings */ this.audio=audio; /** - * @member {Owt.Base.VideoPublicationSettings} video + * @member {Owt.Base.VideoPublicationSettings[]} video * @instance * @memberof Owt.Base.PublicationSettings */ diff --git a/src/sdk/conference/client.js b/src/sdk/conference/client.js index 6237482a..7fe29a00 100644 --- a/src/sdk/conference/client.js +++ b/src/sdk/conference/client.js @@ -29,7 +29,7 @@ const SignalingState = { CONNECTED: 3, }; -const protocolVersion = '1.0'; +const protocolVersion = '1.1'; /* eslint-disable valid-jsdoc */ /** diff --git a/src/sdk/conference/streamutils.js b/src/sdk/conference/streamutils.js index 40207cd0..0f44941d 100644 --- a/src/sdk/conference/streamutils.js +++ b/src/sdk/conference/streamutils.js @@ -47,41 +47,38 @@ function sortResolutions(x, y) { * @private */ export function convertToPublicationSettings(mediaInfo) { - let audio; - let audioCodec; - let video; - let videoCodec; - let resolution; - let framerate; - let bitrate; - let keyFrameInterval; + let audio = [], + video = []; + let audioCodec, videoCodec, resolution, framerate, bitrate, keyFrameInterval, + rid; if (mediaInfo.audio) { if (mediaInfo.audio.format) { audioCodec = new CodecModule.AudioCodecParameters( - mediaInfo.audio.format.codec, mediaInfo.audio.format.channelNum, - mediaInfo.audio.format.sampleRate - ); + mediaInfo.audio.format.codec, mediaInfo.audio.format.channelNum, + mediaInfo.audio.format.sampleRate); } - audio = new PublicationModule.AudioPublicationSettings(audioCodec); + audio.push(new PublicationModule.AudioPublicationSettings(audioCodec)); } if (mediaInfo.video) { - if (mediaInfo.video.format) { - videoCodec = new CodecModule.VideoCodecParameters( - mediaInfo.video.format.codec, mediaInfo.video.format.profile); - } - if (mediaInfo.video.parameters) { - if (mediaInfo.video.parameters.resolution) { - resolution = new MediaFormatModule.Resolution( - mediaInfo.video.parameters.resolution.width, - mediaInfo.video.parameters.resolution.height); + for (const videoInfo of mediaInfo.video.original) { + if (videoInfo.format) { + videoCodec = new CodecModule.VideoCodecParameters( + videoInfo.format.codec, videoInfo.format.profile); + } + if (videoInfo.parameters) { + if (videoInfo.parameters.resolution) { + resolution = new MediaFormatModule.Resolution( + videoInfo.parameters.resolution.width, + videoInfo.parameters.resolution.height); + } + framerate = videoInfo.parameters.framerate; + bitrate = videoInfo.parameters.bitrate * 1000; + keyFrameInterval = videoInfo.parameters.keyFrameInterval; + rid = videoInfo.parameters.simulcastRid; } - framerate = mediaInfo.video.parameters.framerate; - bitrate = mediaInfo.video.parameters.bitrate * 1000; - keyFrameInterval = mediaInfo.video.parameters.keyFrameInterval; + video.push(new PublicationModule.VideoPublicationSettings( + videoCodec, resolution, framerate, bitrate, keyFrameInterval, rid)); } - video = new PublicationModule.VideoPublicationSettings(videoCodec, - resolution, framerate, bitrate, keyFrameInterval - ); } return new PublicationModule.PublicationSettings(audio, video); } From 54924a6eba77adc2b6bbd5be6f5c6603fcc9f2bf Mon Sep 17 00:00:00 2001 From: jianjunz Date: Mon, 19 Aug 2019 10:14:46 +0800 Subject: [PATCH 11/52] Remove offerToReceiveAudio/offerToReceiveVideo. (#174) These are legacy configurations. --- src/sdk/conference/channel.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/sdk/conference/channel.js b/src/sdk/conference/channel.js index 25a8f236..64dc268c 100644 --- a/src/sdk/conference/channel.js +++ b/src/sdk/conference/channel.js @@ -191,10 +191,6 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { }); this.dispatchEvent(messageEvent); this._internalId = data.id; - const offerOptions = { - offerToReceiveAudio: false, - offerToReceiveVideo: false, - }; if (typeof this._pc.addTransceiver === 'function') { // |direction| seems not working on Safari. if (mediaOptions.audio && stream.mediaStream.getAudioTracks() > 0) { @@ -205,7 +201,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { } } let localDesc; - this._pc.createOffer(offerOptions).then((desc) => { + this._pc.createOffer().then((desc) => { if (options) { desc.sdp = this._setRtpReceiverOptions(desc.sdp, options); } @@ -319,10 +315,6 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { this.dispatchEvent(messageEvent); this._internalId = data.id; this._createPeerConnection(); - const offerOptions = { - offerToReceiveAudio: !!options.audio, - offerToReceiveVideo: !!options.video, - }; if (typeof this._pc.addTransceiver === 'function') { // |direction| seems not working on Safari. if (mediaOptions.audio) { @@ -332,7 +324,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { this._pc.addTransceiver('video', {direction: 'recvonly'}); } } - this._pc.createOffer(offerOptions).then((desc) => { + this._pc.createOffer().then((desc) => { if (options) { desc.sdp = this._setRtpReceiverOptions(desc.sdp, options); } From 92a8a17da670235553b87d02c562da8085c81b57 Mon Sep 17 00:00:00 2001 From: jianjunz Date: Mon, 19 Aug 2019 10:16:29 +0800 Subject: [PATCH 12/52] Add a test case for removeEventListener. (#188) --- test/unit/resources/scripts/conference.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unit/resources/scripts/conference.js b/test/unit/resources/scripts/conference.js index f28e3be1..1a4af0b6 100644 --- a/test/unit/resources/scripts/conference.js +++ b/test/unit/resources/scripts/conference.js @@ -35,5 +35,17 @@ describe('Unit tests for ConferenceClient', function() { }); conf2.dispatchEvent(new EventModule.OwtEvent('test')); }); + + it('Event listener should not be triggered after removeEventListener.', + done => { + const conf1 = new ConferenceClient({}); + const listener = () => { + done('Event listener should not be fired.'); + }; + conf1.addEventListener('test', listener); + conf1.removeEventListener('test', listener); + conf1.dispatchEvent(new EventModule.OwtEvent('test')); + done(); + }); }); }); From 68dc9c08a066311ad4f3a2fd0a7c587be4b9a340 Mon Sep 17 00:00:00 2001 From: jianjunz Date: Mon, 19 Aug 2019 10:17:09 +0800 Subject: [PATCH 13/52] Upgrade npm dependencies. (#189) --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 72288170..23f94a70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5917,9 +5917,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", + "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==", "dev": true }, "lodash.clonedeep": { @@ -5965,9 +5965,9 @@ "dev": true }, "lodash.mergewith": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", - "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", + "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==", "dev": true }, "lolex": { From ca9d28db342e7f1148b452bf43753d99187cbf4a Mon Sep 17 00:00:00 2001 From: zhangyihui1 <42208024+zhangyihui1@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:26:31 +0800 Subject: [PATCH 14/52] Using more-accurate method --git-branch to get PR ID. (#184) --- test/p2p.jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/p2p.jenkinsfile b/test/p2p.jenkinsfile index 1908cb57..2f2d17e6 100644 --- a/test/p2p.jenkinsfile +++ b/test/p2p.jenkinsfile @@ -27,7 +27,7 @@ pipeline { withEnv(['JENKINS_NODE_COOKIE=dontkill']) { sh "python ${env.startServerScript} --p2p-server-path ${env.p2pServerPath} \ --owner open-webrtc-toolkit --repo owt-client-javascript --commit-id ${GIT_COMMIT} \ - --github-script ${env.serverGithubScriptPath} --mode p2p" + --git-branch ${GIT_BRANCH} --github-script ${env.serverGithubScriptPath} --mode p2p --workspace ${WORKSPACE}" } } } @@ -43,7 +43,7 @@ pipeline { steps { sh "python ${env.jsCiScriptPath}/runTest.py --mode ci --source-path ${env.jsSourcePath} \ --browsers chrome --mode ci --owner open-webrtc-toolkit --repo owt-client-javascript \ - --commit-id ${GIT_COMMIT} --github-script ${env.jsP2PTestGithubScriptPath}" + --git-branch ${GIT_BRANCH} --github-script ${env.jsP2PTestGithubScriptPath}" } } } @@ -56,4 +56,4 @@ pipeline { setBuildStatus("${env.jsUrl}", "Build failed", "FAILURE"); } } -} +} \ No newline at end of file From f1146bcd35edcb9956ef6848089e3b7cb7ae50d0 Mon Sep 17 00:00:00 2001 From: Jianjun Zhu Date: Fri, 16 Aug 2019 16:57:12 +0800 Subject: [PATCH 15/52] Add rid to VideoSubscriptionConstraints. --- docs/mdfiles/changelog.md | 1 + src/sdk/conference/channel.js | 1 + src/sdk/conference/subscription.js | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/mdfiles/changelog.md b/docs/mdfiles/changelog.md index 26d613c4..572a7ef3 100644 --- a/docs/mdfiles/changelog.md +++ b/docs/mdfiles/changelog.md @@ -3,6 +3,7 @@ Change Log # 4.3 * The type of `conferenceClient.publish` method's option is changed from `AudioEncodingParameters` and `VideoEncodingParameters` to `RTCRtpSendParameters`. * `audio` and `video` of `PublicationSettings` is changed from `AudioPublicationSettings` and `VideoPublicationSettings` to `AudioPublicationSettings` array and `VideoPublicationSettings` array. +* Add `rid` to `VideoSubscriptionConstraints`. When `rid` is specified, other constraints will be ignored. # 4.0.2 * Fix a compatibility issue for Chrome 69 beta. diff --git a/src/sdk/conference/channel.js b/src/sdk/conference/channel.js index 7dedd9ca..adc679f5 100644 --- a/src/sdk/conference/channel.js +++ b/src/sdk/conference/channel.js @@ -322,6 +322,7 @@ export class ConferencePeerConnectionChannel extends EventDispatcher { bitrate: options.video.bitrateMultiplier ? 'x' + options.video.bitrateMultiplier.toString() : undefined, keyFrameInterval: options.video.keyFrameInterval, + simulcastRid: options.video.rid }; } } else { diff --git a/src/sdk/conference/subscription.js b/src/sdk/conference/subscription.js index 347d7052..21e269a4 100644 --- a/src/sdk/conference/subscription.js +++ b/src/sdk/conference/subscription.js @@ -121,7 +121,7 @@ export class AudioSubscriptionConstraints { export class VideoSubscriptionConstraints { // eslint-disable-next-line require-jsdoc constructor(codecs, resolution, frameRate, bitrateMultiplier, - keyFrameInterval) { + keyFrameInterval, rid) { /** * @member {?Array.} codecs * @instance @@ -157,6 +157,13 @@ export class VideoSubscriptionConstraints { * @desc Only keyFrameIntervals listed in Owt.Conference.VideoSubscriptionCapabilities are allowed. */ this.keyFrameInterval = keyFrameInterval; + /** + * @member {?number} rid + * @instance + * @memberof Owt.Conference.VideoSubscriptionConstraints + * @desc Restriction identifier to identify the RTP Streams within an RTP session. When rid is specified, other constraints will be ignored. + */ + this.rid = rid; } } From 34861f09432b338465f7a679f450947ada240420 Mon Sep 17 00:00:00 2001 From: Jianjun Zhu Date: Fri, 16 Aug 2019 18:43:36 +0800 Subject: [PATCH 16/52] Enable simulcast in conference sample. --- src/samples/conference/public/scripts/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/samples/conference/public/scripts/index.js b/src/samples/conference/public/scripts/index.js index 82eca356..085bcdcc 100644 --- a/src/samples/conference/public/scripts/index.js +++ b/src/samples/conference/public/scripts/index.js @@ -147,7 +147,11 @@ const runSocketIOSample = function() { mediaStream, new Owt.Base.StreamSourceInfo( 'mic', 'camera')); $('.local video').get(0).srcObject = stream; - conference.publish(localStream).then(publication => { + conference.publish(localStream, {video:[ + {rid: 'q', active: true, scaleResolutionDownBy: 4.0}, + {rid: 'h', active: true, scaleResolutionDownBy: 2.0}, + {rid: 'f', active: true} + ]}).then(publication => { publicationGlobal = publication; mixStream(myRoom, publication.id, 'common') publication.addEventListener('error', (err) => { From 3bb7ed7160f34cd3495f1237eca623e31f9622d4 Mon Sep 17 00:00:00 2001 From: Jianjun Zhu Date: Mon, 19 Aug 2019 17:34:43 +0800 Subject: [PATCH 17/52] Replace capabilities with extraCapabilities. The relationship of each properties in capabilities is OR. When simulcast is enabled, transcoding will be disabled. In this case, capabilities cannot represent a stream's settings, which should be included in capabilites. extraCapabilities doesn't include settings, it only includes transcoding formats for now. "Transcoding formats" means the formats described in optional property of a stream. --- .../conference/public/scripts/index.js | 6 +++-- src/sdk/base/stream.js | 6 ++--- src/sdk/conference/channel.js | 12 +++++----- src/sdk/conference/client.js | 6 +++-- src/sdk/conference/mixedstream.js | 3 ++- src/sdk/conference/streamutils.js | 23 ------------------- 6 files changed, 19 insertions(+), 37 deletions(-) diff --git a/src/samples/conference/public/scripts/index.js b/src/samples/conference/public/scripts/index.js index 085bcdcc..ff62b4fc 100644 --- a/src/samples/conference/public/scripts/index.js +++ b/src/samples/conference/public/scripts/index.js @@ -65,7 +65,8 @@ const runSocketIOSample = function() { }); } let $p = $(`
`) - for (const resolution of stream.capabilities.video.resolutions) { + // TODO: Add resolutions from settings. + for (const resolution of stream.extraCapabilities.video.resolutions) { const button = $('