]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
specific niceness for live transcoding
authorRigel Kent <sendmemail@rigelk.eu>
Sun, 10 Jan 2021 20:02:55 +0000 (21:02 +0100)
committerChocobozzz <chocobozzz@cpy.re>
Wed, 13 Jan 2021 08:16:44 +0000 (09:16 +0100)
server/helpers/ffmpeg-utils.ts
server/initializers/constants.ts

index 1f5e8d8f6ff69d18609851978a0f8f737ce31563..d01e6f80ecc65fd39aa304f9fc17231ee4a5d9b1 100644 (file)
@@ -594,7 +594,10 @@ function presetOnlyAudio (command: ffmpeg.FfmpegCommand): ffmpeg.FfmpegCommand {
 
 function getFFmpeg (input: string, type: 'live' | 'vod') {
   // We set cwd explicitly because ffmpeg appears to create temporary files when trancoding which fails in read-only file systems
-  const command = ffmpeg(input, { niceness: FFMPEG_NICE.TRANSCODING, cwd: CONFIG.STORAGE.TMP_DIR })
+  const command = ffmpeg(input, {
+    niceness: type === 'live' ? FFMPEG_NICE.LIVE : FFMPEG_NICE.VOD,
+    cwd: CONFIG.STORAGE.TMP_DIR
+  })
 
   const threads = type === 'live'
     ? CONFIG.LIVE.TRANSCODING.THREADS
index 0e4ee4a0a10408e7589bc2527798481515c584ea..182bdf9ccb21bdbdaec4976a47beae6f18acbe3f 100644 (file)
@@ -356,8 +356,11 @@ const VIDEO_RATE_TYPES: { [ id: string ]: VideoRateType } = {
 }
 
 const FFMPEG_NICE: { [ id: string ]: number } = {
-  THUMBNAIL: 2, // 2 just for don't blocking servers
-  TRANSCODING: 15
+  // parent process defaults to niceness = 0
+  // reminder: lower = higher priority, max value is 19, lowest is -20
+  THUMBNAIL: 2, // low value in order to avoid blocking server
+  LIVE: 9, // prioritize over VOD
+  VOD: 15
 }
 
 const VIDEO_CATEGORIES = {