ActivityPub-federated video streaming platform using P2P directly in your web browser
Update ffmpeg static version for tests
Chocobozzzc655c9ef6f7d
diff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex f0bd3ba373..8b605847ea 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -55,8 +55,8 @@ jobs:- name: Setup system dependenciesrun: |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"- tar xf 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.3.1-64bit-static.tar.xzmkdir -p $HOME/bincp ffmpeg-*/{ffmpeg,ffprobe} $HOME/binecho "::add-path::$HOME/bin"diff --git a/server/initializers/constants.ts b/server/initializers/constants.tsindex a93fe3c516..2e45ab256b 100644--- a/server/initializers/constants.ts+++ b/server/initializers/constants.ts@@ -316,7 +316,7 @@ const CONSTRAINTS_FIELDS = {}}-let VIEW_LIFETIME = {+const VIEW_LIFETIME = {VIDEO: 60000 * 60, // 1 hourLIVE: 60000 * 5 // 5 minutes}diff --git a/server/lib/activitypub/process/process-view.ts b/server/lib/activitypub/process/process-view.tsindex efceb21a20..84697673b6 100644--- a/server/lib/activitypub/process/process-view.ts+++ b/server/lib/activitypub/process/process-view.ts@@ -31,6 +31,10 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byAct}const { video } = await getOrCreateVideoAndAccountAndChannel(options)+ if (!video.isLive) {+ await Redis.Instance.addVideoView(video.id)+ }+if (video.isOwned()) {// Our live manager will increment the counter and send the view to followersif (video.isLive) {@@ -38,8 +42,6 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byActreturn}- await Redis.Instance.addVideoView(video.id)-// Forward the view but don't resend the activity to the senderconst exceptions = [ byActor ]await forwardVideoRelatedActivity(activity, undefined, exceptions, video)diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.tsindex 4a1081a4f7..e85998686f 100644--- a/server/lib/live-manager.ts+++ b/server/lib/live-manager.ts@@ -4,6 +4,7 @@ import * as chokidar from 'chokidar'import { FfmpegCommand } from 'fluent-ffmpeg'import { ensureDir, stat } from 'fs-extra'import { basename } from 'path'+import { isTestInstance } from '@server/helpers/core-utils'import {computeResolutionsToTranscode,getVideoFileFPS,@@ -451,7 +452,7 @@ class LiveManager {private async updateLiveViews () {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()) {const notBefore = new Date().getTime() - VIEW_LIFETIME.LIVEdiff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.tsindex 2198114b4e..de3181928d 100644--- a/server/tests/api/live/live.ts+++ b/server/tests/api/live/live.ts@@ -121,7 +121,7 @@ describe('Test live', function () {const live: LiveVideo = resLive.bodyif (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} else {expect(live.rtmpUrl).to.be.null@@ -185,7 +185,7 @@ describe('Test live', function () {const live: LiveVideo = res.bodyif (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} else {expect(live.rtmpUrl).to.be.null@@ -216,7 +216,7 @@ describe('Test live', function () {let rtmpUrl: stringbefore(function () {- rtmpUrl = 'rtmp://' + servers[0].hostname + ':1936'+ rtmpUrl = 'rtmp://' + servers[0].hostname + ':' + servers[0].rtmpPort + ''})async function createLiveWrapper () {diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.tsindex 6c37be1137..c4dcfd96c2 100644--- a/server/tests/api/server/config.ts+++ b/server/tests/api/server/config.ts@@ -79,7 +79,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {expect(data.transcoding.hls.enabled).to.be.trueexpect(data.live.enabled).to.be.false- expect(data.live.allowReplay).to.be.true+ expect(data.live.allowReplay).to.be.falseexpect(data.live.maxDuration).to.equal(1000 * 3600 * 5)expect(data.live.maxInstanceLives).to.equal(20)expect(data.live.maxUserLives).to.equal(3)@@ -166,7 +166,7 @@ function checkUpdatedConfig (data: CustomConfig) {expect(data.transcoding.webtorrent.enabled).to.be.trueexpect(data.live.enabled).to.be.true- expect(data.live.allowReplay).to.be.false+ expect(data.live.allowReplay).to.be.trueexpect(data.live.maxDuration).to.equal(5000)expect(data.live.maxInstanceLives).to.equal(-1)expect(data.live.maxUserLives).to.equal(10)@@ -332,7 +332,7 @@ describe('Test config', function () {},live: {enabled: true,- allowReplay: false,+ allowReplay: true,maxDuration: 5000,maxInstanceLives: -1,maxUserLives: 10,diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.tsindex d063d79736..c5b28540cc 100644--- a/server/tests/api/videos/videos-views-cleaner.ts+++ b/server/tests/api/videos/videos-views-cleaner.ts@@ -61,14 +61,14 @@ describe('Test video views cleaner', function () {{for (const server of servers) {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) {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')}}})diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.tsindex 0915603d04..e76d7917a1 100644--- a/server/tests/plugins/plugin-helpers.ts+++ b/server/tests/plugins/plugin-helpers.ts@@ -80,7 +80,7 @@ describe('Test plugin helpers', function () {let videoUUIDServer1: stringbefore(async function () {- this.timeout(15000)+ this.timeout(30000){const res = await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' })diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.tsindex b4bd55968b..e26a6937c1 100644--- a/shared/extra-utils/server/servers.ts+++ b/shared/extra-utils/server/servers.ts@@ -1,12 +1,12 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */+import { expect } from 'chai'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 { VideoChannel } from '../../models/videos'+import { join } from 'path'import { randomInt } from '../../core-utils/miscs/miscs'+import { VideoChannel } from '../../models/videos'+import { root, wait } from '../miscs/miscs'interface ServerInfo {app: ChildProcess@@ -16,6 +16,8 @@ interface ServerInfo {hostname: stringport: number+ rtmpPort: number+parallel: booleaninternalServerNumber: numberserverNumber: number@@ -95,10 +97,18 @@ function randomServer () {return randomInt(low, high)}+function randomRTMP () {+ const low = 1900+ const high = 2100++ return randomInt(low, high)+}+async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) {const parallel = parallelTests()const internalServerNumber = parallel ? randomServer() : serverNumber+ const rtmpPort = parallel ? randomRTMP() : nullconst port = 9000 + internalServerNumberawait flushTests(internalServerNumber)@@ -107,6 +117,7 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,app: null,port,internalServerNumber,+ rtmpPort,parallel,serverNumber,url: `http://localhost:${port}`,@@ -178,6 +189,11 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []},admin: {email: `admin${server.internalServerNumber}@example.com`+ },+ live: {+ rtmp: {+ port: server.rtmpPort+ }}})}