Force live stream termination
This commit is contained in:
parent
1a5b7dff7f
commit
5a05c14573
|
@ -6,6 +6,7 @@ import { logger, loggerTagsFactory } from '@server/helpers/logger'
|
||||||
import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'
|
import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'
|
||||||
import { VIDEO_LIVE } from '@server/initializers/constants'
|
import { VIDEO_LIVE } from '@server/initializers/constants'
|
||||||
import { sequelizeTypescript } from '@server/initializers/database'
|
import { sequelizeTypescript } from '@server/initializers/database'
|
||||||
|
import { RunnerJobModel } from '@server/models/runner/runner-job'
|
||||||
import { UserModel } from '@server/models/user/user'
|
import { UserModel } from '@server/models/user/user'
|
||||||
import { VideoModel } from '@server/models/video/video'
|
import { VideoModel } from '@server/models/video/video'
|
||||||
import { VideoLiveModel } from '@server/models/video/video-live'
|
import { VideoLiveModel } from '@server/models/video/video-live'
|
||||||
|
@ -25,7 +26,6 @@ import { computeResolutionsToTranscode } from '../transcoding/transcoding-resolu
|
||||||
import { LiveQuotaStore } from './live-quota-store'
|
import { LiveQuotaStore } from './live-quota-store'
|
||||||
import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils'
|
import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils'
|
||||||
import { MuxingSession } from './shared'
|
import { MuxingSession } from './shared'
|
||||||
import { RunnerJobModel } from '@server/models/runner/runner-job'
|
|
||||||
|
|
||||||
const NodeRtmpSession = require('node-media-server/src/node_rtmp_session')
|
const NodeRtmpSession = require('node-media-server/src/node_rtmp_session')
|
||||||
const context = require('node-media-server/src/node_core_ctx')
|
const context = require('node-media-server/src/node_core_ctx')
|
||||||
|
@ -80,6 +80,9 @@ class LiveManager {
|
||||||
|
|
||||||
events.on('donePublish', sessionId => {
|
events.on('donePublish', sessionId => {
|
||||||
logger.info('Live session ended.', { sessionId, ...lTags(sessionId) })
|
logger.info('Live session ended.', { sessionId, ...lTags(sessionId) })
|
||||||
|
|
||||||
|
// Force session aborting, so we kill ffmpeg even if it still has data to process (slow CPU)
|
||||||
|
setTimeout(() => this.abortSession(sessionId), 2000)
|
||||||
})
|
})
|
||||||
|
|
||||||
registerConfigChangedHandler(() => {
|
registerConfigChangedHandler(() => {
|
||||||
|
|
|
@ -239,8 +239,6 @@ describe('Test video blacklist', function () {
|
||||||
let video4UUID: string
|
let video4UUID: string
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(10000)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const { uuid } = await servers[0].videos.upload({ attributes: { name: 'Video 3' } })
|
const { uuid } = await servers[0].videos.upload({ attributes: { name: 'Video 3' } })
|
||||||
video3UUID = uuid
|
video3UUID = uuid
|
||||||
|
@ -254,8 +252,6 @@ describe('Test video blacklist', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should blacklist video 3 and keep it federated', async function () {
|
it('Should blacklist video 3 and keep it federated', async function () {
|
||||||
this.timeout(10000)
|
|
||||||
|
|
||||||
await command.add({ videoId: video3UUID, reason: 'super reason', unfederate: false })
|
await command.add({ videoId: video3UUID, reason: 'super reason', unfederate: false })
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
@ -272,8 +268,6 @@ describe('Test video blacklist', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should unfederate the video', async function () {
|
it('Should unfederate the video', async function () {
|
||||||
this.timeout(10000)
|
|
||||||
|
|
||||||
await command.add({ videoId: video4UUID, reason: 'super reason', unfederate: true })
|
await command.add({ videoId: video4UUID, reason: 'super reason', unfederate: true })
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
@ -285,8 +279,6 @@ describe('Test video blacklist', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should have the video unfederated even after an Update AP message', async function () {
|
it('Should have the video unfederated even after an Update AP message', async function () {
|
||||||
this.timeout(10000)
|
|
||||||
|
|
||||||
await servers[0].videos.update({ id: video4UUID, attributes: { description: 'super description' } })
|
await servers[0].videos.update({ id: video4UUID, attributes: { description: 'super description' } })
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
@ -309,8 +301,6 @@ describe('Test video blacklist', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should remove the video from blacklist and refederate the video', async function () {
|
it('Should remove the video from blacklist and refederate the video', async function () {
|
||||||
this.timeout(10000)
|
|
||||||
|
|
||||||
await command.remove({ videoId: video4UUID })
|
await command.remove({ videoId: video4UUID })
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
|
|
@ -152,7 +152,7 @@ function runTestSuite (options: {
|
||||||
let deletedUrls: string[] = []
|
let deletedUrls: string[] = []
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(120000)
|
this.timeout(240000)
|
||||||
|
|
||||||
const port = await mockObjectStorageProxy.initialize()
|
const port = await mockObjectStorageProxy.initialize()
|
||||||
baseMockUrl = options.useMockBaseUrl
|
baseMockUrl = options.useMockBaseUrl
|
||||||
|
|
|
@ -63,7 +63,7 @@ async function testFfmpegStreamError (command: FfmpegCommand, shouldHaveError: b
|
||||||
let error: Error
|
let error: Error
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await waitFfmpegUntilError(command, 35000)
|
await waitFfmpegUntilError(command, 45000)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = err
|
error = err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue