diff options
author | Théo Le Calvar <tlc@kher.nl> | 2021-04-06 15:12:38 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-04-09 15:53:18 +0200 |
commit | d2351bcfd4cfed4b728df170593e0c6b66aa6762 (patch) | |
tree | fa5748dce3a9d42972aea3642826732a19188cda /server | |
parent | d5fc35c24d496b097dbe222db53355cc339d8606 (diff) | |
download | PeerTube-d2351bcfd4cfed4b728df170593e0c6b66aa6762.tar.gz PeerTube-d2351bcfd4cfed4b728df170593e0c6b66aa6762.tar.zst PeerTube-d2351bcfd4cfed4b728df170593e0c6b66aa6762.zip |
add tests for inputOptions and videoFilters in trancode plugins
Diffstat (limited to 'server')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js | 37 | ||||
-rw-r--r-- | server/tests/plugins/plugin-transcoding.ts | 40 |
2 files changed, 75 insertions, 2 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js b/server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js index 5990ce1ce..366b827a9 100644 --- a/server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js +++ b/server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js | |||
@@ -13,6 +13,30 @@ async function register ({ transcodingManager }) { | |||
13 | } | 13 | } |
14 | 14 | ||
15 | { | 15 | { |
16 | const builder = () => { | ||
17 | return { | ||
18 | videoFilters: [ | ||
19 | 'fps=10' | ||
20 | ] | ||
21 | } | ||
22 | } | ||
23 | |||
24 | transcodingManager.addVODProfile('libx264', 'video-filters-vod', builder) | ||
25 | } | ||
26 | |||
27 | { | ||
28 | const builder = () => { | ||
29 | return { | ||
30 | inputOptions: [ | ||
31 | '-r 5' | ||
32 | ] | ||
33 | } | ||
34 | } | ||
35 | |||
36 | transcodingManager.addVODProfile('libx264', 'input-options-vod', builder) | ||
37 | } | ||
38 | |||
39 | { | ||
16 | const builder = (options) => { | 40 | const builder = (options) => { |
17 | return { | 41 | return { |
18 | outputOptions: [ | 42 | outputOptions: [ |
@@ -23,8 +47,21 @@ async function register ({ transcodingManager }) { | |||
23 | 47 | ||
24 | transcodingManager.addLiveProfile('libx264', 'low-live', builder) | 48 | transcodingManager.addLiveProfile('libx264', 'low-live', builder) |
25 | } | 49 | } |
50 | |||
51 | { | ||
52 | const builder = () => { | ||
53 | return { | ||
54 | inputOptions: [ | ||
55 | '-r 5' | ||
56 | ] | ||
57 | } | ||
58 | } | ||
59 | |||
60 | transcodingManager.addLiveProfile('libx264', 'input-options-live', builder) | ||
61 | } | ||
26 | } | 62 | } |
27 | 63 | ||
64 | |||
28 | async function unregister () { | 65 | async function unregister () { |
29 | return | 66 | return |
30 | } | 67 | } |
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index ecea21e69..415705ca1 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -119,8 +119,8 @@ describe('Test transcoding plugins', function () { | |||
119 | const res = await getConfig(server.url) | 119 | const res = await getConfig(server.url) |
120 | const config = res.body as ServerConfig | 120 | const config = res.body as ServerConfig |
121 | 121 | ||
122 | expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod' ]) | 122 | expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'video-filters-vod', 'input-options-vod' ]) |
123 | expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live' ]) | 123 | expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live' ]) |
124 | }) | 124 | }) |
125 | 125 | ||
126 | it('Should not use the plugin profile if not chosen by the admin', async function () { | 126 | it('Should not use the plugin profile if not chosen by the admin', async function () { |
@@ -143,6 +143,28 @@ describe('Test transcoding plugins', function () { | |||
143 | await checkVideoFPS(videoUUID, 'below', 12) | 143 | await checkVideoFPS(videoUUID, 'below', 12) |
144 | }) | 144 | }) |
145 | 145 | ||
146 | it('Should apply video filters in vod profile', async function () { | ||
147 | this.timeout(120000) | ||
148 | |||
149 | await updateConf(server, 'video-filters-vod', 'default') | ||
150 | |||
151 | const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid | ||
152 | await waitJobs([ server ]) | ||
153 | |||
154 | await checkVideoFPS(videoUUID, 'below', 12) | ||
155 | }) | ||
156 | |||
157 | it('Should apply input options in vod profile', async function () { | ||
158 | this.timeout(120000) | ||
159 | |||
160 | await updateConf(server, 'input-options-vod', 'default') | ||
161 | |||
162 | const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid | ||
163 | await waitJobs([ server ]) | ||
164 | |||
165 | await checkVideoFPS(videoUUID, 'below', 6) | ||
166 | }) | ||
167 | |||
146 | it('Should not use the plugin profile if not chosen by the admin', async function () { | 168 | it('Should not use the plugin profile if not chosen by the admin', async function () { |
147 | this.timeout(120000) | 169 | this.timeout(120000) |
148 | 170 | ||
@@ -169,6 +191,20 @@ describe('Test transcoding plugins', function () { | |||
169 | await checkLiveFPS(liveVideoId, 'below', 12) | 191 | await checkLiveFPS(liveVideoId, 'below', 12) |
170 | }) | 192 | }) |
171 | 193 | ||
194 | it('Should apply the input options on live profile', async function () { | ||
195 | this.timeout(120000) | ||
196 | |||
197 | await updateConf(server, 'low-vod', 'input-options-live') | ||
198 | |||
199 | const liveVideoId = await createLiveWrapper(server) | ||
200 | |||
201 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | ||
202 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | ||
203 | await waitJobs([ server ]) | ||
204 | |||
205 | await checkLiveFPS(liveVideoId, 'below', 6) | ||
206 | }) | ||
207 | |||
172 | it('Should default to the default profile if the specified profile does not exist', async function () { | 208 | it('Should default to the default profile if the specified profile does not exist', async function () { |
173 | this.timeout(120000) | 209 | this.timeout(120000) |
174 | 210 | ||