aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/package.json2
-rw-r--r--client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts2
-rw-r--r--client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts17
-rw-r--r--client/yarn.lock104
4 files changed, 93 insertions, 32 deletions
diff --git a/client/package.json b/client/package.json
index ac881d64c..ddb3eb06a 100644
--- a/client/package.json
+++ b/client/package.json
@@ -100,7 +100,7 @@
100 "ngx-pipes": "^2.1.7", 100 "ngx-pipes": "^2.1.7",
101 "node-sass": "^4.9.3", 101 "node-sass": "^4.9.3",
102 "npm-font-source-sans-pro": "^1.0.2", 102 "npm-font-source-sans-pro": "^1.0.2",
103 "p2p-media-loader-hlsjs": "^0.6.1", 103 "p2p-media-loader-hlsjs": "^0.6.2",
104 "path-browserify": "^1.0.0", 104 "path-browserify": "^1.0.0",
105 "primeng": "^8.0.2", 105 "primeng": "^8.0.2",
106 "process": "^0.11.10", 106 "process": "^0.11.10",
diff --git a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts
index 0c8c612ee..c44c184d5 100644
--- a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts
+++ b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts
@@ -92,7 +92,7 @@ class P2pMediaLoaderPlugin extends Plugin {
92 this.p2pEngine.on(Events.SegmentError, (segment: Segment, err) => { 92 this.p2pEngine.on(Events.SegmentError, (segment: Segment, err) => {
93 console.error('Segment error.', segment, err) 93 console.error('Segment error.', segment, err)
94 94
95 this.options.redundancyUrlManager.removeByOriginUrl(segment.url) 95 this.options.redundancyUrlManager.removeBySegmentUrl(segment.requestUrl)
96 }) 96 })
97 97
98 this.statsP2PBytes.numPeers = 1 + this.options.redundancyUrlManager.countBaseUrls() 98 this.statsP2PBytes.numPeers = 1 + this.options.redundancyUrlManager.countBaseUrls()
diff --git a/client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts b/client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts
index 7fc2b6ab1..abab8aa99 100644
--- a/client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts
+++ b/client/src/assets/player/p2p-media-loader/redundancy-url-manager.ts
@@ -2,9 +2,6 @@ import { basename, dirname } from 'path'
2 2
3class RedundancyUrlManager { 3class RedundancyUrlManager {
4 4
5 // Remember by what new URL we replaced an origin URL
6 private replacedSegmentUrls: { [originUrl: string]: string } = {}
7
8 constructor (private baseUrls: string[] = []) { 5 constructor (private baseUrls: string[] = []) {
9 // empty 6 // empty
10 } 7 }
@@ -17,16 +14,7 @@ class RedundancyUrlManager {
17 this.baseUrls = this.baseUrls.filter(u => u !== baseUrl && u !== baseUrl + '/') 14 this.baseUrls = this.baseUrls.filter(u => u !== baseUrl && u !== baseUrl + '/')
18 } 15 }
19 16
20 removeByOriginUrl (originUrl: string) {
21 const replaced = this.replacedSegmentUrls[originUrl]
22 if (!replaced) return
23
24 return this.removeBySegmentUrl(replaced)
25 }
26
27 buildUrl (url: string) { 17 buildUrl (url: string) {
28 delete this.replacedSegmentUrls[url]
29
30 const max = this.baseUrls.length + 1 18 const max = this.baseUrls.length + 1
31 const i = this.getRandomInt(max) 19 const i = this.getRandomInt(max)
32 20
@@ -35,10 +23,7 @@ class RedundancyUrlManager {
35 const newBaseUrl = this.baseUrls[i] 23 const newBaseUrl = this.baseUrls[i]
36 const slashPart = newBaseUrl.endsWith('/') ? '' : '/' 24 const slashPart = newBaseUrl.endsWith('/') ? '' : '/'
37 25
38 const newUrl = newBaseUrl + slashPart + basename(url) 26 return newBaseUrl + slashPart + basename(url)
39 this.replacedSegmentUrls[url] = newUrl
40
41 return newUrl
42 } 27 }
43 28
44 countBaseUrls () { 29 countBaseUrls () {
diff --git a/client/yarn.lock b/client/yarn.lock
index a67ffe6d1..6755d7e64 100644
--- a/client/yarn.lock
+++ b/client/yarn.lock
@@ -1139,6 +1139,11 @@ async-foreach@^0.1.3:
1139 resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542" 1139 resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542"
1140 integrity sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI= 1140 integrity sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=
1141 1141
1142async-limiter@^1.0.0:
1143 version "1.0.1"
1144 resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
1145 integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==
1146
1142async-limiter@~1.0.0: 1147async-limiter@~1.0.0:
1143 version "1.0.0" 1148 version "1.0.0"
1144 resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" 1149 resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
@@ -1433,7 +1438,7 @@ bittorrent-protocol@^3.0.0:
1433 speedometer "^1.0.0" 1438 speedometer "^1.0.0"
1434 unordered-array-remove "^1.0.2" 1439 unordered-array-remove "^1.0.2"
1435 1440
1436bittorrent-tracker@^9.0.0, bittorrent-tracker@^9.11.0: 1441bittorrent-tracker@^9.0.0:
1437 version "9.11.0" 1442 version "9.11.0"
1438 resolved "https://registry.yarnpkg.com/bittorrent-tracker/-/bittorrent-tracker-9.11.0.tgz#9911f9c14e5a29f84990a0c31b3d83dd16eb2876" 1443 resolved "https://registry.yarnpkg.com/bittorrent-tracker/-/bittorrent-tracker-9.11.0.tgz#9911f9c14e5a29f84990a0c31b3d83dd16eb2876"
1439 integrity sha512-T1zvW/kSeEnWT4I3JE+6c7aZbO5jtleZyQe911SyzIxFF9DvtUNWXud3p5ZUkXaoI2xXwfpvlks5VFj5SKEB+A== 1444 integrity sha512-T1zvW/kSeEnWT4I3JE+6c7aZbO5jtleZyQe911SyzIxFF9DvtUNWXud3p5ZUkXaoI2xXwfpvlks5VFj5SKEB+A==
@@ -1463,6 +1468,36 @@ bittorrent-tracker@^9.0.0, bittorrent-tracker@^9.11.0:
1463 bufferutil "^4.0.0" 1468 bufferutil "^4.0.0"
1464 utf-8-validate "^5.0.1" 1469 utf-8-validate "^5.0.1"
1465 1470
1471bittorrent-tracker@^9.14.4:
1472 version "9.14.4"
1473 resolved "https://registry.yarnpkg.com/bittorrent-tracker/-/bittorrent-tracker-9.14.4.tgz#0d9661560e6fec37689dfc5045142772eac05536"
1474 integrity sha512-2Y/MNRjYhysD6t4r38z7l1WTT7g23IAqRWZRsj7xnnpciFn4xE4qiKmyFwA4gtbFGAZ14K3DdaqZbiQsC3PEfQ==
1475 dependencies:
1476 bencode "^2.0.0"
1477 bittorrent-peerid "^1.0.2"
1478 bn.js "^5.0.0"
1479 chrome-dgram "^3.0.2"
1480 compact2string "^1.2.0"
1481 debug "^4.0.1"
1482 ip "^1.0.1"
1483 lru "^3.0.0"
1484 minimist "^1.1.1"
1485 once "^1.3.0"
1486 random-iterate "^1.0.1"
1487 randombytes "^2.0.3"
1488 run-parallel "^1.1.2"
1489 run-series "^1.0.2"
1490 simple-get "^3.0.0"
1491 simple-peer "^9.0.0"
1492 simple-websocket "^8.0.0"
1493 string2compact "^1.1.1"
1494 uniq "^1.0.1"
1495 unordered-array-remove "^1.0.2"
1496 ws "^7.0.0"
1497 optionalDependencies:
1498 bufferutil "^4.0.0"
1499 utf-8-validate "^5.0.1"
1500
1466blob-to-buffer@^1.2.6: 1501blob-to-buffer@^1.2.6:
1467 version "1.2.8" 1502 version "1.2.8"
1468 resolved "https://registry.yarnpkg.com/blob-to-buffer/-/blob-to-buffer-1.2.8.tgz#78eeeb332f1280ed0ca6fb2b60693a8c6d36903a" 1503 resolved "https://registry.yarnpkg.com/blob-to-buffer/-/blob-to-buffer-1.2.8.tgz#78eeeb332f1280ed0ca6fb2b60693a8c6d36903a"
@@ -1506,6 +1541,11 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
1506 resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" 1541 resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
1507 integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== 1542 integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==
1508 1543
1544bn.js@^5.0.0:
1545 version "5.0.0"
1546 resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.0.0.tgz#5c3d398021b3ddb548c1296a16f857e908f35c70"
1547 integrity sha512-bVwDX8AF+72fIUNuARelKAlQUNtPOfG2fRxorbVvFk4zpHbqLrPdOGfVg5vrKwVzLLePqPBiATaOZNELQzmS0A==
1548
1509body-parser@1.19.0, body-parser@^1.16.1: 1549body-parser@1.19.0, body-parser@^1.16.1:
1510 version "1.19.0" 1550 version "1.19.0"
1511 resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" 1551 resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a"
@@ -1959,6 +1999,14 @@ chownr@^1.1.1:
1959 resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.2.tgz#a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6" 1999 resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.2.tgz#a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6"
1960 integrity sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A== 2000 integrity sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==
1961 2001
2002chrome-dgram@^3.0.2:
2003 version "3.0.2"
2004 resolved "https://registry.yarnpkg.com/chrome-dgram/-/chrome-dgram-3.0.2.tgz#7e0e00084b57971714214372368ad18a7785ad52"
2005 integrity sha512-Ay741EHF/Ib18un+LUtBNK43NrabD6GOuwVaka7uUbV0gFRLEPULm2Q05YSzRNBtSrbaO4eErmDdniiy/u8Lig==
2006 dependencies:
2007 inherits "^2.0.1"
2008 run-series "^1.1.2"
2009
1962chrome-trace-event@^1.0.0: 2010chrome-trace-event@^1.0.0:
1963 version "1.0.2" 2011 version "1.0.2"
1964 resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4" 2012 resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4"
@@ -6488,26 +6536,26 @@ p-try@^2.0.0:
6488 resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" 6536 resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
6489 integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== 6537 integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
6490 6538
6491p2p-media-loader-core@^0.6.1: 6539p2p-media-loader-core@^0.6.2:
6492 version "0.6.1" 6540 version "0.6.2"
6493 resolved "https://registry.yarnpkg.com/p2p-media-loader-core/-/p2p-media-loader-core-0.6.1.tgz#90cc05460cb5207897953e92059b32930f06a56f" 6541 resolved "https://registry.yarnpkg.com/p2p-media-loader-core/-/p2p-media-loader-core-0.6.2.tgz#7e46cf8fc4357596f389e106bee850908cc974ef"
6494 integrity sha512-bTyOdTVxbjzr1GCt6bOIxXlw7U6gPvYXOGo07EU0wufabKscn/TNyuTH4fDhVtw6NGMISn18G06td3V049tOBw== 6542 integrity sha512-yspgCOrVVYitVNece5CA6W/kcVA0UybvbD4kyBE5ooyhCAXQK5/q6JsIpXiVQ3VkQw8Qs4mfZjU39Vt6vEk6aw==
6495 dependencies: 6543 dependencies:
6496 bittorrent-tracker "^9.11.0" 6544 bittorrent-tracker "^9.14.4"
6497 debug "^4.1.1" 6545 debug "^4.1.1"
6498 events "^3.0.0" 6546 events "^3.0.0"
6499 get-browser-rtc "^1.0.2" 6547 get-browser-rtc "^1.0.2"
6500 sha.js "^2.4.11" 6548 sha.js "^2.4.11"
6501 simple-peer "^9.4.0" 6549 simple-peer "^9.5.0"
6502 6550
6503p2p-media-loader-hlsjs@^0.6.1: 6551p2p-media-loader-hlsjs@^0.6.2:
6504 version "0.6.1" 6552 version "0.6.2"
6505 resolved "https://registry.yarnpkg.com/p2p-media-loader-hlsjs/-/p2p-media-loader-hlsjs-0.6.1.tgz#558e1737241f3c17810cddafde0e992c20656886" 6553 resolved "https://registry.yarnpkg.com/p2p-media-loader-hlsjs/-/p2p-media-loader-hlsjs-0.6.2.tgz#b66f977a5d28986c8f6e62d2ffa297aec3c05186"
6506 integrity sha512-JadTwrxNNKXyO4MyiK7i5zT1zOSFmaiIOlE4Gr6NjxDg8v3+Q8q09YHJPXumXexUWDNpw5vw8eHTpBdQClJ9lQ== 6554 integrity sha512-5LgqWPDsgyST9rxoHGDpExZU1rIDZIT0qft2wAnlg8Cb8aVeaBxUsmF4Sj692Qb5/GBDsi8vLE03LW8gpvlh1g==
6507 dependencies: 6555 dependencies:
6508 events "^3.0.0" 6556 events "^3.0.0"
6509 m3u8-parser "^4.4.0" 6557 m3u8-parser "^4.4.0"
6510 p2p-media-loader-core "^0.6.1" 6558 p2p-media-loader-core "^0.6.2"
6511 6559
6512package-json-versionify@^1.0.2: 6560package-json-versionify@^1.0.2:
6513 version "1.0.4" 6561 version "1.0.4"
@@ -7624,7 +7672,7 @@ run-queue@^1.0.0, run-queue@^1.0.3:
7624 dependencies: 7672 dependencies:
7625 aproba "^1.1.1" 7673 aproba "^1.1.1"
7626 7674
7627run-series@^1.0.2: 7675run-series@^1.0.2, run-series@^1.1.2:
7628 version "1.1.8" 7676 version "1.1.8"
7629 resolved "https://registry.yarnpkg.com/run-series/-/run-series-1.1.8.tgz#2c4558f49221e01cd6371ff4e0a1e203e460fc36" 7677 resolved "https://registry.yarnpkg.com/run-series/-/run-series-1.1.8.tgz#2c4558f49221e01cd6371ff4e0a1e203e460fc36"
7630 integrity sha512-+GztYEPRpIsQoCSraWHDBs9WVy4eVME16zhOtDB4H9J4xN0XRhknnmLOl+4gRgZtu8dpp9N/utSPjKH/xmDzXg== 7678 integrity sha512-+GztYEPRpIsQoCSraWHDBs9WVy4eVME16zhOtDB4H9J4xN0XRhknnmLOl+4gRgZtu8dpp9N/utSPjKH/xmDzXg==
@@ -7985,7 +8033,7 @@ simple-get@^2.8.1, simple-get@^3.0.0, simple-get@^3.0.1:
7985 once "^1.3.1" 8033 once "^1.3.1"
7986 simple-concat "^1.0.0" 8034 simple-concat "^1.0.0"
7987 8035
7988simple-peer@^9.0.0, simple-peer@^9.4.0: 8036simple-peer@^9.0.0:
7989 version "9.4.0" 8037 version "9.4.0"
7990 resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-9.4.0.tgz#eb82ef1181e10ec0c014a94953e2eb278f3d9025" 8038 resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-9.4.0.tgz#eb82ef1181e10ec0c014a94953e2eb278f3d9025"
7991 integrity sha512-8qF32uq6SSSVXoBq9g31uGqZYupwRD3Ta/QK9fV04U/IbnIS6mictLb8/kjFyLVa3JrD7QYyKrw3nvJJ+lNFDw== 8039 integrity sha512-8qF32uq6SSSVXoBq9g31uGqZYupwRD3Ta/QK9fV04U/IbnIS6mictLb8/kjFyLVa3JrD7QYyKrw3nvJJ+lNFDw==
@@ -7996,6 +8044,17 @@ simple-peer@^9.0.0, simple-peer@^9.4.0:
7996 randombytes "^2.0.3" 8044 randombytes "^2.0.3"
7997 readable-stream "^2.3.4" 8045 readable-stream "^2.3.4"
7998 8046
8047simple-peer@^9.5.0:
8048 version "9.5.0"
8049 resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-9.5.0.tgz#67ba8bd4b54efc3acf19aceafdc118b27e24fcbc"
8050 integrity sha512-3tROq3nBo/CIZI8PWlXGbAxQIlQF6KQ/zcd4lQ2pAC4+rPiV7E721hI22nTO54uw/nzb2HKbvmDtZ4Wr173+vA==
8051 dependencies:
8052 debug "^4.0.1"
8053 get-browser-rtc "^1.0.0"
8054 inherits "^2.0.1"
8055 randombytes "^2.0.3"
8056 readable-stream "^3.4.0"
8057
7999simple-sha1@^2.0.0, simple-sha1@^2.0.8, simple-sha1@^2.1.0: 8058simple-sha1@^2.0.0, simple-sha1@^2.0.8, simple-sha1@^2.1.0:
8000 version "2.1.2" 8059 version "2.1.2"
8001 resolved "https://registry.yarnpkg.com/simple-sha1/-/simple-sha1-2.1.2.tgz#de40cbd5aae278fde8e3bb3250a35d74c67326b1" 8060 resolved "https://registry.yarnpkg.com/simple-sha1/-/simple-sha1-2.1.2.tgz#de40cbd5aae278fde8e3bb3250a35d74c67326b1"
@@ -8014,6 +8073,16 @@ simple-websocket@^7.0.1:
8014 readable-stream "^2.0.5" 8073 readable-stream "^2.0.5"
8015 ws "^6.0.0" 8074 ws "^6.0.0"
8016 8075
8076simple-websocket@^8.0.0:
8077 version "8.0.1"
8078 resolved "https://registry.yarnpkg.com/simple-websocket/-/simple-websocket-8.0.1.tgz#c28af779034b329d0cf1448a45fdd311d21fa289"
8079 integrity sha512-2QKSRjf+tqFXLVmOQjf95gHeKhuyx2k1ouDjtnE0uKCYw84HfN85HsXo+GmPH+2PIh5BQql++g2AIbHgGAZU4w==
8080 dependencies:
8081 debug "^4.1.1"
8082 randombytes "^2.0.3"
8083 readable-stream "^3.1.1"
8084 ws "^7.0.0"
8085
8017slash@^1.0.0: 8086slash@^1.0.0:
8018 version "1.0.0" 8087 version "1.0.0"
8019 resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" 8088 resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
@@ -9710,6 +9779,13 @@ ws@^6.0.0:
9710 dependencies: 9779 dependencies:
9711 async-limiter "~1.0.0" 9780 async-limiter "~1.0.0"
9712 9781
9782ws@^7.0.0:
9783 version "7.1.2"
9784 resolved "https://registry.yarnpkg.com/ws/-/ws-7.1.2.tgz#c672d1629de8bb27a9699eb599be47aeeedd8f73"
9785 integrity sha512-gftXq3XI81cJCgkUiAVixA0raD9IVmXqsylCrjRygw4+UOOGzPoxnQ6r/CnVL9i+mDncJo94tSkyrtuuQVBmrg==
9786 dependencies:
9787 async-limiter "^1.0.0"
9788
9713ws@~3.3.1: 9789ws@~3.3.1:
9714 version "3.3.3" 9790 version "3.3.3"
9715 resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" 9791 resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2"