mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Add live transcoding bit rate tests
This commit is contained in:
@@ -53,15 +53,15 @@ function createLive (url: string, token: string, fields: LiveVideoCreate, status
|
||||
})
|
||||
}
|
||||
|
||||
async function sendRTMPStreamInVideo (url: string, token: string, videoId: number | string) {
|
||||
async function sendRTMPStreamInVideo (url: string, token: string, videoId: number | string, fixtureName?: string) {
|
||||
const res = await getLive(url, token, videoId)
|
||||
const videoLive = res.body as LiveVideo
|
||||
|
||||
return sendRTMPStream(videoLive.rtmpUrl, videoLive.streamKey)
|
||||
return sendRTMPStream(videoLive.rtmpUrl, videoLive.streamKey, fixtureName)
|
||||
}
|
||||
|
||||
function sendRTMPStream (rtmpBaseUrl: string, streamKey: string) {
|
||||
const fixture = buildAbsoluteFixturePath('video_short.mp4')
|
||||
function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') {
|
||||
const fixture = buildAbsoluteFixturePath(fixtureName)
|
||||
|
||||
const command = ffmpeg(fixture)
|
||||
command.inputOption('-stream_loop -1')
|
||||
@@ -140,7 +140,7 @@ async function waitUntilLiveStarts (url: string, token: string, videoId: number
|
||||
}
|
||||
|
||||
async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
|
||||
const basePath = buildServerDirectory(server.internalServerNumber, 'streaming-playlists')
|
||||
const basePath = buildServerDirectory(server, 'streaming-playlists')
|
||||
const hlsPath = join(basePath, 'hls', videoUUID)
|
||||
|
||||
if (resolutions.length === 0) {
|
||||
|
||||
@@ -9,15 +9,7 @@ import { v4 as uuidv4 } from 'uuid'
|
||||
import validator from 'validator'
|
||||
import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants'
|
||||
import { VideoDetails, VideoPrivacy } from '../../models/videos'
|
||||
import {
|
||||
buildAbsoluteFixturePath,
|
||||
buildServerDirectory,
|
||||
dateIsValid,
|
||||
immutableAssign,
|
||||
root,
|
||||
testImage,
|
||||
webtorrentAdd
|
||||
} from '../miscs/miscs'
|
||||
import { buildAbsoluteFixturePath, buildServerDirectory, dateIsValid, immutableAssign, testImage, webtorrentAdd } from '../miscs/miscs'
|
||||
import { makeGetRequest, makePutBodyRequest, makeUploadRequest } from '../requests/requests'
|
||||
import { waitJobs } from '../server/jobs'
|
||||
import { ServerInfo } from '../server/servers'
|
||||
@@ -335,7 +327,7 @@ async function checkVideoFilesWereRemoved (
|
||||
]
|
||||
) {
|
||||
for (const directory of directories) {
|
||||
const directoryPath = buildServerDirectory(serverNumber, directory)
|
||||
const directoryPath = buildServerDirectory({ internalServerNumber: serverNumber }, directory)
|
||||
|
||||
const directoryExists = await pathExists(directoryPath)
|
||||
if (directoryExists === false) continue
|
||||
@@ -489,7 +481,8 @@ function rateVideo (url: string, accessToken: string, id: number, rating: string
|
||||
function parseTorrentVideo (server: ServerInfo, videoUUID: string, resolution: number) {
|
||||
return new Promise<any>((res, rej) => {
|
||||
const torrentName = videoUUID + '-' + resolution + '.torrent'
|
||||
const torrentPath = join(root(), 'test' + server.internalServerNumber, 'torrents', torrentName)
|
||||
const torrentPath = buildServerDirectory(server, join('torrents', torrentName))
|
||||
|
||||
readFile(torrentPath, (err, data) => {
|
||||
if (err) return rej(err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user