mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2026-09-03 20:53:09 -05:00
Add latency setting support
This commit is contained in:
@@ -49,8 +49,8 @@ function checkMissedConfig () {
|
||||
'peertube.check_latest_version.enabled', 'peertube.check_latest_version.url',
|
||||
'search.remote_uri.users', 'search.remote_uri.anonymous', 'search.search_index.enabled', 'search.search_index.url',
|
||||
'search.search_index.disable_local_search', 'search.search_index.is_default_search',
|
||||
'live.enabled', 'live.allow_replay', 'live.max_duration', 'live.max_user_lives', 'live.max_instance_lives',
|
||||
'live.rtmp.enabled', 'live.rtmp.port', 'live.rtmp.hostname',
|
||||
'live.enabled', 'live.allow_replay', 'live.latency_setting.enabled', 'live.max_duration',
|
||||
'live.max_user_lives', 'live.max_instance_lives', 'live.rtmp.enabled', 'live.rtmp.port', 'live.rtmp.hostname',
|
||||
'live.rtmps.enabled', 'live.rtmps.port', 'live.rtmps.hostname', 'live.rtmps.key_file', 'live.rtmps.cert_file',
|
||||
'live.transcoding.enabled', 'live.transcoding.threads', 'live.transcoding.profile',
|
||||
'live.transcoding.resolutions.144p', 'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p',
|
||||
|
||||
@@ -4,9 +4,9 @@ import { dirname, join } from 'path'
|
||||
import { decacheModule } from '@server/helpers/decache'
|
||||
import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type'
|
||||
import { BroadcastMessageLevel } from '@shared/models/server'
|
||||
import { buildPath, root } from '../../shared/core-utils'
|
||||
import { VideoPrivacy, VideosRedundancyStrategy } from '../../shared/models'
|
||||
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
|
||||
import { buildPath, root } from '../../shared/core-utils'
|
||||
import { parseBytes, parseDurationToMs } from '../helpers/core-utils'
|
||||
|
||||
// Use a variable to reload the configuration if we need
|
||||
@@ -296,6 +296,10 @@ const CONFIG = {
|
||||
|
||||
get ALLOW_REPLAY () { return config.get<boolean>('live.allow_replay') },
|
||||
|
||||
LATENCY_SETTING: {
|
||||
get ENABLED () { return config.get<boolean>('live.latency_setting.enabled') }
|
||||
},
|
||||
|
||||
RTMP: {
|
||||
get ENABLED () { return config.get<boolean>('live.rtmp.enabled') },
|
||||
get PORT () { return config.get<number>('live.rtmp.port') },
|
||||
|
||||
@@ -24,7 +24,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const LAST_MIGRATION_VERSION = 685
|
||||
const LAST_MIGRATION_VERSION = 690
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -700,7 +700,10 @@ const RESUMABLE_UPLOAD_SESSION_LIFETIME = SCHEDULER_INTERVALS_MS.REMOVE_DANGLING
|
||||
const VIDEO_LIVE = {
|
||||
EXTENSION: '.ts',
|
||||
CLEANUP_DELAY: 1000 * 60 * 5, // 5 minutes
|
||||
SEGMENT_TIME_SECONDS: 4, // 4 seconds
|
||||
SEGMENT_TIME_SECONDS: {
|
||||
DEFAULT_LATENCY: 4, // 4 seconds
|
||||
SMALL_LATENCY: 2 // 2 seconds
|
||||
},
|
||||
SEGMENTS_LIST_SIZE: 15, // 15 maximum segments in live playlist
|
||||
REPLAY_DIRECTORY: 'replay',
|
||||
EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION: 4,
|
||||
@@ -842,7 +845,8 @@ if (isTestInstance() === true) {
|
||||
PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME = 5000
|
||||
|
||||
VIDEO_LIVE.CLEANUP_DELAY = 5000
|
||||
VIDEO_LIVE.SEGMENT_TIME_SECONDS = 2
|
||||
VIDEO_LIVE.SEGMENT_TIME_SECONDS.DEFAULT_LATENCY = 2
|
||||
VIDEO_LIVE.SEGMENT_TIME_SECONDS.SMALL_LATENCY = 1
|
||||
VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION = 1
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { LiveVideoLatencyMode } from '@shared/models'
|
||||
import * as Sequelize from 'sequelize'
|
||||
|
||||
async function up (utils: {
|
||||
transaction: Sequelize.Transaction
|
||||
queryInterface: Sequelize.QueryInterface
|
||||
sequelize: Sequelize.Sequelize
|
||||
db: any
|
||||
}): Promise<void> {
|
||||
await utils.queryInterface.addColumn('videoLive', 'latencyMode', {
|
||||
type: Sequelize.INTEGER,
|
||||
defaultValue: null,
|
||||
allowNull: true
|
||||
}, { transaction: utils.transaction })
|
||||
|
||||
{
|
||||
const query = `UPDATE "videoLive" SET "latencyMode" = ${LiveVideoLatencyMode.DEFAULT}`
|
||||
await utils.sequelize.query(query, { type: Sequelize.QueryTypes.UPDATE, transaction: utils.transaction })
|
||||
}
|
||||
|
||||
await utils.queryInterface.changeColumn('videoLive', 'latencyMode', {
|
||||
type: Sequelize.INTEGER,
|
||||
defaultValue: null,
|
||||
allowNull: false
|
||||
}, { transaction: utils.transaction })
|
||||
}
|
||||
|
||||
function down () {
|
||||
throw new Error('Not implemented.')
|
||||
}
|
||||
|
||||
export {
|
||||
up,
|
||||
down
|
||||
}
|
||||
Reference in New Issue
Block a user