diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-11 14:20:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-10-11 14:33:42 +0200 |
commit | 8bd6aa0424a034166a6b1a63fe4660140246bbb2 (patch) | |
tree | 62a8253a5e1311478befffea74ff4ccfd90b90a2 | |
parent | 080f14025ea5113d27b9732e06a1db7eb5489dea (diff) | |
download | PeerTube-8bd6aa0424a034166a6b1a63fe4660140246bbb2.tar.gz PeerTube-8bd6aa0424a034166a6b1a63fe4660140246bbb2.tar.zst PeerTube-8bd6aa0424a034166a6b1a63fe4660140246bbb2.zip |
Also retry when fetching master m3u8 playlist
-rw-r--r-- | server/tests/shared/live.ts | 10 | ||||
-rw-r--r-- | server/tests/shared/streaming-playlists.ts | 5 | ||||
-rw-r--r-- | shared/server-commands/videos/live.ts | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts index f165832fe..63f3ecfd8 100644 --- a/server/tests/shared/live.ts +++ b/server/tests/shared/live.ts | |||
@@ -3,7 +3,6 @@ | |||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { pathExists, readdir } from 'fs-extra' | 4 | import { pathExists, readdir } from 'fs-extra' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { wait } from '@shared/core-utils' | ||
7 | import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models' | 6 | import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models' |
8 | import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands' | 7 | import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands' |
9 | import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists' | 8 | import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists' |
@@ -42,7 +41,13 @@ async function testVideoResolutions (options: { | |||
42 | expect(hlsPlaylist).to.exist | 41 | expect(hlsPlaylist).to.exist |
43 | expect(hlsPlaylist.files).to.have.lengthOf(0) // Only fragmented mp4 files are displayed | 42 | expect(hlsPlaylist.files).to.have.lengthOf(0) // Only fragmented mp4 files are displayed |
44 | 43 | ||
45 | await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions, transcoded }) | 44 | await checkResolutionsInMasterPlaylist({ |
45 | server, | ||
46 | playlistUrl: hlsPlaylist.playlistUrl, | ||
47 | resolutions, | ||
48 | transcoded, | ||
49 | withRetry: objectStorage | ||
50 | }) | ||
46 | 51 | ||
47 | if (objectStorage) { | 52 | if (objectStorage) { |
48 | expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) | 53 | expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) |
@@ -59,7 +64,6 @@ async function testVideoResolutions (options: { | |||
59 | 64 | ||
60 | if (objectStorage) { | 65 | if (objectStorage) { |
61 | await originServer.live.waitUntilSegmentUpload({ playlistNumber: i, segment: segmentNum }) | 66 | await originServer.live.waitUntilSegmentUpload({ playlistNumber: i, segment: segmentNum }) |
62 | await wait(1000) | ||
63 | 67 | ||
64 | expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) | 68 | expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) |
65 | } | 69 | } |
diff --git a/server/tests/shared/streaming-playlists.ts b/server/tests/shared/streaming-playlists.ts index eff34944b..74c25e99c 100644 --- a/server/tests/shared/streaming-playlists.ts +++ b/server/tests/shared/streaming-playlists.ts | |||
@@ -57,10 +57,11 @@ async function checkResolutionsInMasterPlaylist (options: { | |||
57 | playlistUrl: string | 57 | playlistUrl: string |
58 | resolutions: number[] | 58 | resolutions: number[] |
59 | transcoded?: boolean // default true | 59 | transcoded?: boolean // default true |
60 | withRetry?: boolean // default false | ||
60 | }) { | 61 | }) { |
61 | const { server, playlistUrl, resolutions, transcoded = true } = options | 62 | const { server, playlistUrl, resolutions, withRetry = false, transcoded = true } = options |
62 | 63 | ||
63 | const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl }) | 64 | const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl, withRetry }) |
64 | 65 | ||
65 | for (const resolution of resolutions) { | 66 | for (const resolution of resolutions) { |
66 | const reg = transcoded | 67 | const reg = transcoded |
diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.ts index 6f180b05f..0d9c32aab 100644 --- a/shared/server-commands/videos/live.ts +++ b/shared/server-commands/videos/live.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' | 1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' |
2 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' | 2 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' |
3 | import { PeerTubeServer } from '../server/server' | ||
4 | import { VideoDetails, VideoInclude } from '@shared/models' | 3 | import { VideoDetails, VideoInclude } from '@shared/models' |
4 | import { PeerTubeServer } from '../server/server' | ||
5 | 5 | ||
6 | function sendRTMPStream (options: { | 6 | function sendRTMPStream (options: { |
7 | rtmpBaseUrl: string | 7 | rtmpBaseUrl: string |