Also retry when fetching master m3u8 playlist

pull/5325/head
Chocobozzz 2022-10-11 14:20:19 +02:00
parent 080f14025e
commit 8bd6aa0424
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 11 additions and 6 deletions

View File

@ -3,7 +3,6 @@
import { expect } from 'chai'
import { pathExists, readdir } from 'fs-extra'
import { join } from 'path'
import { wait } from '@shared/core-utils'
import { LiveVideo, VideoStreamingPlaylistType } from '@shared/models'
import { ObjectStorageCommand, PeerTubeServer } from '@shared/server-commands'
import { checkLiveSegmentHash, checkResolutionsInMasterPlaylist } from './streaming-playlists'
@ -42,7 +41,13 @@ async function testVideoResolutions (options: {
expect(hlsPlaylist).to.exist
expect(hlsPlaylist.files).to.have.lengthOf(0) // Only fragmented mp4 files are displayed
await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions, transcoded })
await checkResolutionsInMasterPlaylist({
server,
playlistUrl: hlsPlaylist.playlistUrl,
resolutions,
transcoded,
withRetry: objectStorage
})
if (objectStorage) {
expect(hlsPlaylist.playlistUrl).to.contain(ObjectStorageCommand.getPlaylistBaseUrl())
@ -59,7 +64,6 @@ async function testVideoResolutions (options: {
if (objectStorage) {
await originServer.live.waitUntilSegmentUpload({ playlistNumber: i, segment: segmentNum })
await wait(1000)
expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getPlaylistBaseUrl())
}

View File

@ -57,10 +57,11 @@ async function checkResolutionsInMasterPlaylist (options: {
playlistUrl: string
resolutions: number[]
transcoded?: boolean // default true
withRetry?: boolean // default false
}) {
const { server, playlistUrl, resolutions, transcoded = true } = options
const { server, playlistUrl, resolutions, withRetry = false, transcoded = true } = options
const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl })
const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl, withRetry })
for (const resolution of resolutions) {
const reg = transcoded

View File

@ -1,7 +1,7 @@
import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'
import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
import { PeerTubeServer } from '../server/server'
import { VideoDetails, VideoInclude } from '@shared/models'
import { PeerTubeServer } from '../server/server'
function sendRTMPStream (options: {
rtmpBaseUrl: string