diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js | 97 | ||||
-rw-r--r-- | server/tests/plugins/plugin-transcoding.ts | 34 |
2 files changed, 85 insertions, 46 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 366b827a9..59b136947 100644 --- a/server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js +++ b/server/tests/fixtures/peertube-plugin-test-transcoding-one/main.js | |||
@@ -1,63 +1,84 @@ | |||
1 | async function register ({ transcodingManager }) { | 1 | async function register ({ transcodingManager }) { |
2 | 2 | ||
3 | // Output options | ||
3 | { | 4 | { |
4 | const builder = () => { | 5 | { |
5 | return { | 6 | const builder = () => { |
6 | outputOptions: [ | 7 | return { |
7 | '-r 10' | 8 | outputOptions: [ |
8 | ] | 9 | '-r 10' |
10 | ] | ||
11 | } | ||
9 | } | 12 | } |
10 | } | ||
11 | 13 | ||
12 | transcodingManager.addVODProfile('libx264', 'low-vod', builder) | 14 | transcodingManager.addVODProfile('libx264', 'low-vod', builder) |
13 | } | 15 | } |
14 | 16 | ||
15 | { | 17 | { |
16 | const builder = () => { | 18 | const builder = (options) => { |
17 | return { | 19 | return { |
18 | videoFilters: [ | 20 | outputOptions: [ |
19 | 'fps=10' | 21 | '-r:' + options.streamNum + ' 5' |
20 | ] | 22 | ] |
23 | } | ||
21 | } | 24 | } |
22 | } | ||
23 | 25 | ||
24 | transcodingManager.addVODProfile('libx264', 'video-filters-vod', builder) | 26 | transcodingManager.addLiveProfile('libx264', 'low-live', builder) |
27 | } | ||
25 | } | 28 | } |
26 | 29 | ||
30 | // Input options | ||
27 | { | 31 | { |
28 | const builder = () => { | 32 | { |
29 | return { | 33 | const builder = () => { |
30 | inputOptions: [ | 34 | return { |
31 | '-r 5' | 35 | inputOptions: [ |
32 | ] | 36 | '-r 5' |
37 | ] | ||
38 | } | ||
33 | } | 39 | } |
34 | } | ||
35 | 40 | ||
36 | transcodingManager.addVODProfile('libx264', 'input-options-vod', builder) | 41 | transcodingManager.addVODProfile('libx264', 'input-options-vod', builder) |
37 | } | 42 | } |
38 | 43 | ||
39 | { | 44 | { |
40 | const builder = (options) => { | 45 | const builder = () => { |
41 | return { | 46 | return { |
42 | outputOptions: [ | 47 | inputOptions: [ |
43 | '-r:' + options.streamNum + ' 5' | 48 | '-r 5' |
44 | ] | 49 | ] |
50 | } | ||
45 | } | 51 | } |
46 | } | ||
47 | 52 | ||
48 | transcodingManager.addLiveProfile('libx264', 'low-live', builder) | 53 | transcodingManager.addLiveProfile('libx264', 'input-options-live', builder) |
54 | } | ||
49 | } | 55 | } |
50 | 56 | ||
57 | // Scale filters | ||
51 | { | 58 | { |
52 | const builder = () => { | 59 | { |
53 | return { | 60 | const builder = () => { |
54 | inputOptions: [ | 61 | return { |
55 | '-r 5' | 62 | scaleFilter: { |
56 | ] | 63 | name: 'Glomgold' |
64 | } | ||
65 | } | ||
57 | } | 66 | } |
67 | |||
68 | transcodingManager.addVODProfile('libx264', 'bad-scale-vod', builder) | ||
58 | } | 69 | } |
59 | 70 | ||
60 | transcodingManager.addLiveProfile('libx264', 'input-options-live', builder) | 71 | { |
72 | const builder = () => { | ||
73 | return { | ||
74 | scaleFilter: { | ||
75 | name: 'Flintheart' | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | |||
80 | transcodingManager.addLiveProfile('libx264', 'bad-scale-live', builder) | ||
81 | } | ||
61 | } | 82 | } |
62 | } | 83 | } |
63 | 84 | ||
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 415705ca1..b6dff930e 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -15,9 +15,11 @@ import { | |||
15 | sendRTMPStreamInVideo, | 15 | sendRTMPStreamInVideo, |
16 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
17 | setDefaultVideoChannel, | 17 | setDefaultVideoChannel, |
18 | testFfmpegStreamError, | ||
18 | uninstallPlugin, | 19 | uninstallPlugin, |
19 | updateCustomSubConfig, | 20 | updateCustomSubConfig, |
20 | uploadVideoAndGetId, | 21 | uploadVideoAndGetId, |
22 | waitFfmpegUntilError, | ||
21 | waitJobs, | 23 | waitJobs, |
22 | waitUntilLivePublished | 24 | waitUntilLivePublished |
23 | } from '../../../shared/extra-utils' | 25 | } from '../../../shared/extra-utils' |
@@ -119,8 +121,8 @@ describe('Test transcoding plugins', function () { | |||
119 | const res = await getConfig(server.url) | 121 | const res = await getConfig(server.url) |
120 | const config = res.body as ServerConfig | 122 | const config = res.body as ServerConfig |
121 | 123 | ||
122 | expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'video-filters-vod', 'input-options-vod' ]) | 124 | expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ]) |
123 | expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live' ]) | 125 | expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ]) |
124 | }) | 126 | }) |
125 | 127 | ||
126 | it('Should not use the plugin profile if not chosen by the admin', async function () { | 128 | it('Should not use the plugin profile if not chosen by the admin', async function () { |
@@ -143,26 +145,31 @@ describe('Test transcoding plugins', function () { | |||
143 | await checkVideoFPS(videoUUID, 'below', 12) | 145 | await checkVideoFPS(videoUUID, 'below', 12) |
144 | }) | 146 | }) |
145 | 147 | ||
146 | it('Should apply video filters in vod profile', async function () { | 148 | it('Should apply input options in vod profile', async function () { |
147 | this.timeout(120000) | 149 | this.timeout(120000) |
148 | 150 | ||
149 | await updateConf(server, 'video-filters-vod', 'default') | 151 | await updateConf(server, 'input-options-vod', 'default') |
150 | 152 | ||
151 | const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid | 153 | const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid |
152 | await waitJobs([ server ]) | 154 | await waitJobs([ server ]) |
153 | 155 | ||
154 | await checkVideoFPS(videoUUID, 'below', 12) | 156 | await checkVideoFPS(videoUUID, 'below', 6) |
155 | }) | 157 | }) |
156 | 158 | ||
157 | it('Should apply input options in vod profile', async function () { | 159 | it('Should apply the scale filter in vod profile', async function () { |
158 | this.timeout(120000) | 160 | this.timeout(120000) |
159 | 161 | ||
160 | await updateConf(server, 'input-options-vod', 'default') | 162 | await updateConf(server, 'bad-scale-vod', 'default') |
161 | 163 | ||
162 | const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid | 164 | const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid |
163 | await waitJobs([ server ]) | 165 | await waitJobs([ server ]) |
164 | 166 | ||
165 | await checkVideoFPS(videoUUID, 'below', 6) | 167 | // Transcoding failed |
168 | const res = await getVideo(server.url, videoUUID) | ||
169 | const video: VideoDetails = res.body | ||
170 | |||
171 | expect(video.files).to.have.lengthOf(1) | ||
172 | expect(video.streamingPlaylists).to.have.lengthOf(0) | ||
166 | }) | 173 | }) |
167 | 174 | ||
168 | it('Should not use the plugin profile if not chosen by the admin', async function () { | 175 | it('Should not use the plugin profile if not chosen by the admin', async function () { |
@@ -205,6 +212,17 @@ describe('Test transcoding plugins', function () { | |||
205 | await checkLiveFPS(liveVideoId, 'below', 6) | 212 | await checkLiveFPS(liveVideoId, 'below', 6) |
206 | }) | 213 | }) |
207 | 214 | ||
215 | it('Should apply the scale filter name on live profile', async function () { | ||
216 | this.timeout(120000) | ||
217 | |||
218 | await updateConf(server, 'low-vod', 'bad-scale-live') | ||
219 | |||
220 | const liveVideoId = await createLiveWrapper(server) | ||
221 | |||
222 | const command = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | ||
223 | await testFfmpegStreamError(command, true) | ||
224 | }) | ||
225 | |||
208 | it('Should default to the default profile if the specified profile does not exist', async function () { | 226 | it('Should default to the default profile if the specified profile does not exist', async function () { |
209 | this.timeout(120000) | 227 | this.timeout(120000) |
210 | 228 | ||