aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-25 16:19:35 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitfb7194043d0486ce0a6a40b2ffbdf32878c33a6f (patch)
tree6ed304a5d730a75da0a4460b3009df88684fa598 /server/initializers
parenta5cf76afa378aae81af2a9b0ce548e5d2582f832 (diff)
downloadPeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.tar.gz
PeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.tar.zst
PeerTube-fb7194043d0486ce0a6a40b2ffbdf32878c33a6f.zip
Check live duration and size
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker-after-init.ts7
-rw-r--r--server/initializers/checker-before-init.ts7
-rw-r--r--server/initializers/config.ts3
-rw-r--r--server/initializers/constants.ts7
-rw-r--r--server/initializers/migrations/0535-video-live.ts2
5 files changed, 22 insertions, 4 deletions
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts
index b49ab6bca..979c97a8b 100644
--- a/server/initializers/checker-after-init.ts
+++ b/server/initializers/checker-after-init.ts
@@ -135,6 +135,13 @@ function checkConfig () {
135 } 135 }
136 } 136 }
137 137
138 // Live
139 if (CONFIG.LIVE.ENABLED === true) {
140 if (CONFIG.LIVE.ALLOW_REPLAY === true && CONFIG.TRANSCODING.ENABLED === false) {
141 return 'Live allow replay cannot be enabled if transcoding is not enabled.'
142 }
143 }
144
138 return null 145 return null
139} 146}
140 147
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts
index e0819c4aa..d4140e3fa 100644
--- a/server/initializers/checker-before-init.ts
+++ b/server/initializers/checker-before-init.ts
@@ -37,8 +37,13 @@ function checkMissedConfig () {
37 'remote_redundancy.videos.accept_from', 37 'remote_redundancy.videos.accept_from',
38 'federation.videos.federate_unlisted', 38 'federation.videos.federate_unlisted',
39 'search.remote_uri.users', 'search.remote_uri.anonymous', 'search.search_index.enabled', 'search.search_index.url', 39 'search.remote_uri.users', 'search.remote_uri.anonymous', 'search.search_index.enabled', 'search.search_index.url',
40 'search.search_index.disable_local_search', 'search.search_index.is_default_search' 40 'search.search_index.disable_local_search', 'search.search_index.is_default_search',
41 'live.enabled', 'live.allow_replay', 'live.max_duration',
42 'live.transcoding.enabled', 'live.transcoding.threads',
43 'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p', 'live.transcoding.resolutions.480p',
44 'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p', 'live.transcoding.resolutions.2160p'
41 ] 45 ]
46
42 const requiredAlternatives = [ 47 const requiredAlternatives = [
43 [ // set 48 [ // set
44 [ 'redis.hostname', 'redis.port' ], // alternative 49 [ 'redis.hostname', 'redis.port' ], // alternative
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 7a8200ed9..9e8927350 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -201,6 +201,9 @@ const CONFIG = {
201 LIVE: { 201 LIVE: {
202 get ENABLED () { return config.get<boolean>('live.enabled') }, 202 get ENABLED () { return config.get<boolean>('live.enabled') },
203 203
204 get MAX_DURATION () { return parseDurationToMs(config.get<string>('live.max_duration')) },
205 get ALLOW_REPLAY () { return config.get<boolean>('live.allow_replay') },
206
204 RTMP: { 207 RTMP: {
205 get PORT () { return config.get<number>('live.rtmp.port') } 208 get PORT () { return config.get<number>('live.rtmp.port') }
206 }, 209 },
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 82d04a94e..065012b32 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -608,7 +608,9 @@ const HLS_REDUNDANCY_DIRECTORY = join(CONFIG.STORAGE.REDUNDANCY_DIR, 'hls')
608 608
609const VIDEO_LIVE = { 609const VIDEO_LIVE = {
610 EXTENSION: '.ts', 610 EXTENSION: '.ts',
611 CLEANUP_DELAY: 1000 * 60 * 5, // 5 mintues 611 CLEANUP_DELAY: 1000 * 60 * 5, // 5 minutes
612 SEGMENT_TIME: 4, // 4 seconds
613 SEGMENTS_LIST_SIZE: 15, // 15 maximum segments in live playlist
612 RTMP: { 614 RTMP: {
613 CHUNK_SIZE: 60000, 615 CHUNK_SIZE: 60000,
614 GOP_CACHE: true, 616 GOP_CACHE: true,
@@ -620,7 +622,8 @@ const VIDEO_LIVE = {
620 622
621const MEMOIZE_TTL = { 623const MEMOIZE_TTL = {
622 OVERVIEWS_SAMPLE: 1000 * 3600 * 4, // 4 hours 624 OVERVIEWS_SAMPLE: 1000 * 3600 * 4, // 4 hours
623 INFO_HASH_EXISTS: 1000 * 3600 * 12 // 12 hours 625 INFO_HASH_EXISTS: 1000 * 3600 * 12, // 12 hours
626 LIVE_ABLE_TO_UPLOAD: 1000 * 60 // 1 minute
624} 627}
625 628
626const MEMOIZE_LENGTH = { 629const MEMOIZE_LENGTH = {
diff --git a/server/initializers/migrations/0535-video-live.ts b/server/initializers/migrations/0535-video-live.ts
index 35523efc4..7501e080b 100644
--- a/server/initializers/migrations/0535-video-live.ts
+++ b/server/initializers/migrations/0535-video-live.ts
@@ -9,7 +9,7 @@ async function up (utils: {
9 const query = ` 9 const query = `
10 CREATE TABLE IF NOT EXISTS "videoLive" ( 10 CREATE TABLE IF NOT EXISTS "videoLive" (
11 "id" SERIAL , 11 "id" SERIAL ,
12 "streamKey" VARCHAR(255) NOT NULL, 12 "streamKey" VARCHAR(255),
13 "videoId" INTEGER NOT NULL REFERENCES "video" ("id") ON DELETE CASCADE ON UPDATE CASCADE, 13 "videoId" INTEGER NOT NULL REFERENCES "video" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
14 "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, 14 "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL,
15 "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, 15 "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL,