Update ffmpeg static version for tests
This commit is contained in:
parent
e4bf785617
commit
c655c9ef6f
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
@ -55,8 +55,8 @@ jobs:
|
||||||
- name: Setup system dependencies
|
- name: Setup system dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install postgresql-client-common redis-tools parallel
|
sudo apt-get install postgresql-client-common redis-tools parallel
|
||||||
wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.0.3-64bit-static.tar.xz"
|
wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz"
|
||||||
tar xf ffmpeg-release-4.0.3-64bit-static.tar.xz
|
tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz
|
||||||
mkdir -p $HOME/bin
|
mkdir -p $HOME/bin
|
||||||
cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
|
cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
|
||||||
echo "::add-path::$HOME/bin"
|
echo "::add-path::$HOME/bin"
|
||||||
|
|
|
@ -316,7 +316,7 @@ const CONSTRAINTS_FIELDS = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let VIEW_LIFETIME = {
|
const VIEW_LIFETIME = {
|
||||||
VIDEO: 60000 * 60, // 1 hour
|
VIDEO: 60000 * 60, // 1 hour
|
||||||
LIVE: 60000 * 5 // 5 minutes
|
LIVE: 60000 * 5 // 5 minutes
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,10 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byAct
|
||||||
}
|
}
|
||||||
const { video } = await getOrCreateVideoAndAccountAndChannel(options)
|
const { video } = await getOrCreateVideoAndAccountAndChannel(options)
|
||||||
|
|
||||||
|
if (!video.isLive) {
|
||||||
|
await Redis.Instance.addVideoView(video.id)
|
||||||
|
}
|
||||||
|
|
||||||
if (video.isOwned()) {
|
if (video.isOwned()) {
|
||||||
// Our live manager will increment the counter and send the view to followers
|
// Our live manager will increment the counter and send the view to followers
|
||||||
if (video.isLive) {
|
if (video.isLive) {
|
||||||
|
@ -38,8 +42,6 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byAct
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
await Redis.Instance.addVideoView(video.id)
|
|
||||||
|
|
||||||
// Forward the view but don't resend the activity to the sender
|
// Forward the view but don't resend the activity to the sender
|
||||||
const exceptions = [ byActor ]
|
const exceptions = [ byActor ]
|
||||||
await forwardVideoRelatedActivity(activity, undefined, exceptions, video)
|
await forwardVideoRelatedActivity(activity, undefined, exceptions, video)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import * as chokidar from 'chokidar'
|
||||||
import { FfmpegCommand } from 'fluent-ffmpeg'
|
import { FfmpegCommand } from 'fluent-ffmpeg'
|
||||||
import { ensureDir, stat } from 'fs-extra'
|
import { ensureDir, stat } from 'fs-extra'
|
||||||
import { basename } from 'path'
|
import { basename } from 'path'
|
||||||
|
import { isTestInstance } from '@server/helpers/core-utils'
|
||||||
import {
|
import {
|
||||||
computeResolutionsToTranscode,
|
computeResolutionsToTranscode,
|
||||||
getVideoFileFPS,
|
getVideoFileFPS,
|
||||||
|
@ -451,7 +452,7 @@ class LiveManager {
|
||||||
private async updateLiveViews () {
|
private async updateLiveViews () {
|
||||||
if (!this.isRunning()) return
|
if (!this.isRunning()) return
|
||||||
|
|
||||||
logger.info('Updating live video views.')
|
if (!isTestInstance()) logger.info('Updating live video views.')
|
||||||
|
|
||||||
for (const videoId of this.watchersPerVideo.keys()) {
|
for (const videoId of this.watchersPerVideo.keys()) {
|
||||||
const notBefore = new Date().getTime() - VIEW_LIFETIME.LIVE
|
const notBefore = new Date().getTime() - VIEW_LIFETIME.LIVE
|
||||||
|
|
|
@ -121,7 +121,7 @@ describe('Test live', function () {
|
||||||
const live: LiveVideo = resLive.body
|
const live: LiveVideo = resLive.body
|
||||||
|
|
||||||
if (server.url === servers[0].url) {
|
if (server.url === servers[0].url) {
|
||||||
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':1936/live')
|
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
|
||||||
expect(live.streamKey).to.not.be.empty
|
expect(live.streamKey).to.not.be.empty
|
||||||
} else {
|
} else {
|
||||||
expect(live.rtmpUrl).to.be.null
|
expect(live.rtmpUrl).to.be.null
|
||||||
|
@ -185,7 +185,7 @@ describe('Test live', function () {
|
||||||
const live: LiveVideo = res.body
|
const live: LiveVideo = res.body
|
||||||
|
|
||||||
if (server.url === servers[0].url) {
|
if (server.url === servers[0].url) {
|
||||||
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':1936/live')
|
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
|
||||||
expect(live.streamKey).to.not.be.empty
|
expect(live.streamKey).to.not.be.empty
|
||||||
} else {
|
} else {
|
||||||
expect(live.rtmpUrl).to.be.null
|
expect(live.rtmpUrl).to.be.null
|
||||||
|
@ -216,7 +216,7 @@ describe('Test live', function () {
|
||||||
let rtmpUrl: string
|
let rtmpUrl: string
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
rtmpUrl = 'rtmp://' + servers[0].hostname + ':1936'
|
rtmpUrl = 'rtmp://' + servers[0].hostname + ':' + servers[0].rtmpPort + ''
|
||||||
})
|
})
|
||||||
|
|
||||||
async function createLiveWrapper () {
|
async function createLiveWrapper () {
|
||||||
|
|
|
@ -79,7 +79,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
|
||||||
expect(data.transcoding.hls.enabled).to.be.true
|
expect(data.transcoding.hls.enabled).to.be.true
|
||||||
|
|
||||||
expect(data.live.enabled).to.be.false
|
expect(data.live.enabled).to.be.false
|
||||||
expect(data.live.allowReplay).to.be.true
|
expect(data.live.allowReplay).to.be.false
|
||||||
expect(data.live.maxDuration).to.equal(1000 * 3600 * 5)
|
expect(data.live.maxDuration).to.equal(1000 * 3600 * 5)
|
||||||
expect(data.live.maxInstanceLives).to.equal(20)
|
expect(data.live.maxInstanceLives).to.equal(20)
|
||||||
expect(data.live.maxUserLives).to.equal(3)
|
expect(data.live.maxUserLives).to.equal(3)
|
||||||
|
@ -166,7 +166,7 @@ function checkUpdatedConfig (data: CustomConfig) {
|
||||||
expect(data.transcoding.webtorrent.enabled).to.be.true
|
expect(data.transcoding.webtorrent.enabled).to.be.true
|
||||||
|
|
||||||
expect(data.live.enabled).to.be.true
|
expect(data.live.enabled).to.be.true
|
||||||
expect(data.live.allowReplay).to.be.false
|
expect(data.live.allowReplay).to.be.true
|
||||||
expect(data.live.maxDuration).to.equal(5000)
|
expect(data.live.maxDuration).to.equal(5000)
|
||||||
expect(data.live.maxInstanceLives).to.equal(-1)
|
expect(data.live.maxInstanceLives).to.equal(-1)
|
||||||
expect(data.live.maxUserLives).to.equal(10)
|
expect(data.live.maxUserLives).to.equal(10)
|
||||||
|
@ -332,7 +332,7 @@ describe('Test config', function () {
|
||||||
},
|
},
|
||||||
live: {
|
live: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
allowReplay: false,
|
allowReplay: true,
|
||||||
maxDuration: 5000,
|
maxDuration: 5000,
|
||||||
maxInstanceLives: -1,
|
maxInstanceLives: -1,
|
||||||
maxUserLives: 10,
|
maxUserLives: 10,
|
||||||
|
|
|
@ -61,14 +61,14 @@ describe('Test video views cleaner', function () {
|
||||||
{
|
{
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1)
|
const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1)
|
||||||
expect(total).to.equal(2)
|
expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer2)
|
const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer2)
|
||||||
expect(total).to.equal(2)
|
expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -80,7 +80,7 @@ describe('Test plugin helpers', function () {
|
||||||
let videoUUIDServer1: string
|
let videoUUIDServer1: string
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(15000)
|
this.timeout(30000)
|
||||||
|
|
||||||
{
|
{
|
||||||
const res = await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' })
|
const res = await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' })
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
|
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
|
||||||
|
|
||||||
import { ChildProcess, exec, fork } from 'child_process'
|
|
||||||
import { join } from 'path'
|
|
||||||
import { root, wait } from '../miscs/miscs'
|
|
||||||
import { copy, pathExists, readdir, readFile, remove } from 'fs-extra'
|
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { VideoChannel } from '../../models/videos'
|
import { ChildProcess, exec, fork } from 'child_process'
|
||||||
|
import { copy, pathExists, readdir, readFile, remove } from 'fs-extra'
|
||||||
|
import { join } from 'path'
|
||||||
import { randomInt } from '../../core-utils/miscs/miscs'
|
import { randomInt } from '../../core-utils/miscs/miscs'
|
||||||
|
import { VideoChannel } from '../../models/videos'
|
||||||
|
import { root, wait } from '../miscs/miscs'
|
||||||
|
|
||||||
interface ServerInfo {
|
interface ServerInfo {
|
||||||
app: ChildProcess
|
app: ChildProcess
|
||||||
|
@ -16,6 +16,8 @@ interface ServerInfo {
|
||||||
hostname: string
|
hostname: string
|
||||||
port: number
|
port: number
|
||||||
|
|
||||||
|
rtmpPort: number
|
||||||
|
|
||||||
parallel: boolean
|
parallel: boolean
|
||||||
internalServerNumber: number
|
internalServerNumber: number
|
||||||
serverNumber: number
|
serverNumber: number
|
||||||
|
@ -95,10 +97,18 @@ function randomServer () {
|
||||||
return randomInt(low, high)
|
return randomInt(low, high)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function randomRTMP () {
|
||||||
|
const low = 1900
|
||||||
|
const high = 2100
|
||||||
|
|
||||||
|
return randomInt(low, high)
|
||||||
|
}
|
||||||
|
|
||||||
async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) {
|
async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) {
|
||||||
const parallel = parallelTests()
|
const parallel = parallelTests()
|
||||||
|
|
||||||
const internalServerNumber = parallel ? randomServer() : serverNumber
|
const internalServerNumber = parallel ? randomServer() : serverNumber
|
||||||
|
const rtmpPort = parallel ? randomRTMP() : null
|
||||||
const port = 9000 + internalServerNumber
|
const port = 9000 + internalServerNumber
|
||||||
|
|
||||||
await flushTests(internalServerNumber)
|
await flushTests(internalServerNumber)
|
||||||
|
@ -107,6 +117,7 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,
|
||||||
app: null,
|
app: null,
|
||||||
port,
|
port,
|
||||||
internalServerNumber,
|
internalServerNumber,
|
||||||
|
rtmpPort,
|
||||||
parallel,
|
parallel,
|
||||||
serverNumber,
|
serverNumber,
|
||||||
url: `http://localhost:${port}`,
|
url: `http://localhost:${port}`,
|
||||||
|
@ -178,6 +189,11 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
|
||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
email: `admin${server.internalServerNumber}@example.com`
|
email: `admin${server.internalServerNumber}@example.com`
|
||||||
|
},
|
||||||
|
live: {
|
||||||
|
rtmp: {
|
||||||
|
port: server.rtmpPort
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user