]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/job-queue/handlers/video-transcoding.ts
Live streaming implementation first step
[github/Chocobozzz/PeerTube.git] / server / lib / job-queue / handlers / video-transcoding.ts
index 46d52e1cf043a6424e0b57e119b15f8a01349420..6659ab716438dada65555926fa7c9836c4ab8374 100644 (file)
@@ -15,7 +15,7 @@ import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils'
 import { generateHlsPlaylist, mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewResolution } from '../../video-transcoding'
 import { Notifier } from '../../notifier'
 import { CONFIG } from '../../../initializers/config'
-import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models'
+import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/types/models'
 
 async function processVideoTranscoding (job: Bull.Job) {
   const payload = job.data as VideoTranscodingPayload
@@ -75,7 +75,7 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O
   if (videoArg === undefined) return undefined
 
   // Outside the transaction (IO on disk)
-  const { videoFileResolution } = await videoArg.getMaxQualityResolution()
+  const { videoFileResolution, isPortraitMode } = await videoArg.getMaxQualityResolution()
 
   const { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => {
     // Maybe the video changed in database, refresh it
@@ -84,9 +84,9 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O
     if (!videoDatabase) return undefined
 
     // Create transcoding jobs if there are enabled resolutions
-    const resolutionsEnabled = computeResolutionsToTranscode(videoFileResolution)
+    const resolutionsEnabled = computeResolutionsToTranscode(videoFileResolution, 'vod')
     logger.info(
-      'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, videoFileResolution,
+      'Resolutions computed for video %s and origin file resolution of %d.', videoDatabase.uuid, videoFileResolution,
       { resolutions: resolutionsEnabled }
     )
 
@@ -104,14 +104,15 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O
           dataInput = {
             type: 'new-resolution' as 'new-resolution',
             videoUUID: videoDatabase.uuid,
-            resolution
+            resolution,
+            isPortraitMode
           }
         } else if (CONFIG.TRANSCODING.HLS.ENABLED) {
           dataInput = {
             type: 'hls',
             videoUUID: videoDatabase.uuid,
             resolution,
-            isPortraitMode: false,
+            isPortraitMode,
             copyCodecs: false
           }
         }