Fix duplicate HLS resolution in master playlist

pull/2290/head
Chocobozzz 2019-11-26 16:36:48 +01:00
parent 52201311e1
commit 49c3bf6fa2
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 4 additions and 6 deletions

View File

@ -70,7 +70,7 @@ async function getAudioStreamCodec (path: string) {
if (!audioStream) return '' if (!audioStream) return ''
const audioCodec = audioStream.codec_name const audioCodec = audioStream.codec_name
if (audioCodec.codec_name === 'aac') return 'mp4a.40.2' if (audioCodec === 'aac') return 'mp4a.40.2'
logger.warn('Cannot get audio codec of %s.', path, { audioStream }) logger.warn('Cannot get audio codec of %s.', path, { audioStream })

View File

@ -50,8 +50,8 @@ async function updateMasterHLSPlaylist (video: MVideoWithFile) {
let line = `#EXT-X-STREAM-INF:${bandwidth},${resolution}` let line = `#EXT-X-STREAM-INF:${bandwidth},${resolution}`
if (file.fps) line += ',FRAME-RATE=' + file.fps if (file.fps) line += ',FRAME-RATE=' + file.fps
const audioCodec = await getAudioStreamCodec(filePlaylistPath) const audioCodec = await getAudioStreamCodec(videoFilePath)
const videoCodec = await getVideoStreamCodec(filePlaylistPath) const videoCodec = await getVideoStreamCodec(videoFilePath)
line += `,CODECS="${videoCodec},${audioCodec}"` line += `,CODECS="${videoCodec},${audioCodec}"`
masterPlaylists.push(line) masterPlaylists.push(line)

View File

@ -205,10 +205,8 @@ async function generateHlsPlaylist (video: MVideoWithFile, resolution: VideoReso
await createTorrentAndSetInfoHash(videoStreamingPlaylist, newVideoFile) await createTorrentAndSetInfoHash(videoStreamingPlaylist, newVideoFile)
const updatedVideoFile = await newVideoFile.save() await newVideoFile.save()
videoStreamingPlaylist.VideoFiles = await videoStreamingPlaylist.$get('VideoFiles') as VideoFileModel[] videoStreamingPlaylist.VideoFiles = await videoStreamingPlaylist.$get('VideoFiles') as VideoFileModel[]
videoStreamingPlaylist.VideoFiles.push(updatedVideoFile)
video.setHLSPlaylist(videoStreamingPlaylist) video.setHLSPlaylist(videoStreamingPlaylist)