aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-24 14:08:23 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-25 10:07:51 +0100
commit5a547f69d5dc5867e253f7721513479c754b4f15 (patch)
tree5ccad0e07d04e24d7a4c0b624a46d3b5a93ebce5 /shared
parent9252a33d115bba85adcfbc18ab3725924642871c (diff)
downloadPeerTube-5a547f69d5dc5867e253f7721513479c754b4f15.tar.gz
PeerTube-5a547f69d5dc5867e253f7721513479c754b4f15.tar.zst
PeerTube-5a547f69d5dc5867e253f7721513479c754b4f15.zip
Support encoding profiles
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/server/servers.ts12
-rw-r--r--shared/models/videos/video-resolution.enum.ts2
2 files changed, 9 insertions, 5 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index a647b0eb4..75e79cc41 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -104,7 +104,7 @@ function randomRTMP () {
104 return randomInt(low, high) 104 return randomInt(low, high)
105} 105}
106 106
107async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) { 107async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = [], silent = true) {
108 const parallel = parallelTests() 108 const parallel = parallelTests()
109 109
110 const internalServerNumber = parallel ? randomServer() : serverNumber 110 const internalServerNumber = parallel ? randomServer() : serverNumber
@@ -133,10 +133,10 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,
133 } 133 }
134 } 134 }
135 135
136 return runServer(server, configOverride, args) 136 return runServer(server, configOverride, args, silent)
137} 137}
138 138
139async function runServer (server: ServerInfo, configOverrideArg?: any, args = []) { 139async function runServer (server: ServerInfo, configOverrideArg?: any, args = [], silent?: boolean) {
140 // These actions are async so we need to be sure that they have both been done 140 // These actions are async so we need to be sure that they have both been done
141 const serverRunString = { 141 const serverRunString = {
142 'Server listening': false 142 'Server listening': false
@@ -240,7 +240,11 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
240 // If no, there is maybe one thing not already initialized (client/user credentials generation...) 240 // If no, there is maybe one thing not already initialized (client/user credentials generation...)
241 if (dontContinue === true) return 241 if (dontContinue === true) return
242 242
243 server.app.stdout.removeListener('data', onStdout) 243 if (silent === false) {
244 console.log(data.toString())
245 } else {
246 server.app.stdout.removeListener('data', onStdout)
247 }
244 248
245 process.on('exit', () => { 249 process.on('exit', () => {
246 try { 250 try {
diff --git a/shared/models/videos/video-resolution.enum.ts b/shared/models/videos/video-resolution.enum.ts
index 571ab5d8f..dcd55dad8 100644
--- a/shared/models/videos/video-resolution.enum.ts
+++ b/shared/models/videos/video-resolution.enum.ts
@@ -81,7 +81,7 @@ export function getTargetBitrate (resolution: number, fps: number, fpsTranscodin
81 // Example outputs: 81 // Example outputs:
82 // 1080p10: 2420 kbps, 1080p30: 3300 kbps, 1080p60: 4620 kbps 82 // 1080p10: 2420 kbps, 1080p30: 3300 kbps, 1080p60: 4620 kbps
83 // 720p10: 1283 kbps, 720p30: 1750 kbps, 720p60: 2450 kbps 83 // 720p10: 1283 kbps, 720p30: 1750 kbps, 720p60: 2450 kbps
84 return baseBitrate + (fps - fpsTranscodingConstants.AVERAGE) * (maxBitrateDifference / maxFpsDifference) 84 return Math.floor(baseBitrate + (fps - fpsTranscodingConstants.AVERAGE) * (maxBitrateDifference / maxFpsDifference))
85} 85}
86 86
87/** 87/**