1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Create and inject caption playlist in HLS master

This commit is contained in:
Chocobozzz 2025-04-08 15:26:02 +02:00
parent a7be820abc
commit 6e44e7e29a
No known key found for this signature in database
GPG key ID: 583A612D890159BE
49 changed files with 1368 additions and 401 deletions

View file

@ -56,7 +56,6 @@ const config = {
const lTags = loggerTagsFactory('live')
class LiveManager {
private static instance: LiveManager
private readonly muxingSessions = new Map<string, MuxingSession>()
@ -274,13 +273,16 @@ class LiveManager {
if (this.videoSessions.has(video.uuid)) {
logger.warn(
'Video %s has already a live session %s. Refusing stream %s.',
video.uuid, this.videoSessions.get(video.uuid), streamKey, lTags(sessionId, video.uuid)
video.uuid,
this.videoSessions.get(video.uuid),
streamKey,
lTags(sessionId, video.uuid)
)
return this.abortSession(sessionId)
}
// Cleanup old potential live (could happen with a permanent live)
const oldStreamingPlaylist = await VideoStreamingPlaylistModel.loadHLSPlaylistByVideo(video.id)
const oldStreamingPlaylist = await VideoStreamingPlaylistModel.loadHLSByVideo(video.id)
if (oldStreamingPlaylist) {
if (!videoLive.permanentLive) throw new Error('Found previous session in a non permanent live: ' + video.uuid)
@ -316,7 +318,9 @@ class LiveManager {
if (!hasAudio && !hasVideo) {
logger.warn(
'Not audio and video streams were found for video %s. Refusing stream %s.',
video.uuid, streamKey, lTags(sessionId, video.uuid)
video.uuid,
streamKey,
lTags(sessionId, video.uuid)
)
this.videoSessions.delete(video.uuid)
@ -325,7 +329,12 @@ class LiveManager {
logger.info(
'%s probing took %d ms (bitrate: %d, fps: %d, resolution: %d)',
inputLocalUrl, Date.now() - now, bitrate, fps, resolution, lTags(sessionId, video.uuid)
inputLocalUrl,
Date.now() - now,
bitrate,
fps,
resolution,
lTags(sessionId, video.uuid)
)
const allResolutions = await Hooks.wrapObject(
@ -337,7 +346,9 @@ class LiveManager {
if (!hasAudio && allResolutions.length === 1 && allResolutions[0] === VideoResolution.H_NOVIDEO) {
logger.warn(
'Cannot stream live to audio only because no video stream is available for video %s. Refusing stream %s.',
video.uuid, streamKey, lTags(sessionId, video.uuid)
video.uuid,
streamKey,
lTags(sessionId, video.uuid)
)
this.videoSessions.delete(video.uuid)
@ -345,7 +356,8 @@ class LiveManager {
}
logger.info(
'Handling live video of original resolution %d.', resolution,
'Handling live video of original resolution %d.',
resolution,
{ allResolutions, ...lTags(sessionId, video.uuid) }
)
@ -426,7 +438,8 @@ class LiveManager {
muxingSession.on('bad-socket-health', ({ videoUUID }) => {
logger.error(
'Too much data in client socket stream (ffmpeg is too slow to transcode the video).' +
' Stopping session of video %s.', videoUUID,
' Stopping session of video %s.',
videoUUID,
localLTags
)