From 49c3bf6fa25afb49c8a27937147043c6e4ce95c3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 26 Nov 2019 16:36:48 +0100 Subject: [PATCH] Fix duplicate HLS resolution in master playlist --- server/helpers/ffmpeg-utils.ts | 2 +- server/lib/hls.ts | 4 ++-- server/lib/video-transcoding.ts | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 1eea05d1e..00c32e99a 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts @@ -70,7 +70,7 @@ async function getAudioStreamCodec (path: string) { if (!audioStream) return '' 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 }) diff --git a/server/lib/hls.ts b/server/lib/hls.ts index c94b599df..443a60088 100644 --- a/server/lib/hls.ts +++ b/server/lib/hls.ts @@ -50,8 +50,8 @@ async function updateMasterHLSPlaylist (video: MVideoWithFile) { let line = `#EXT-X-STREAM-INF:${bandwidth},${resolution}` if (file.fps) line += ',FRAME-RATE=' + file.fps - const audioCodec = await getAudioStreamCodec(filePlaylistPath) - const videoCodec = await getVideoStreamCodec(filePlaylistPath) + const audioCodec = await getAudioStreamCodec(videoFilePath) + const videoCodec = await getVideoStreamCodec(videoFilePath) line += `,CODECS="${videoCodec},${audioCodec}"` masterPlaylists.push(line) diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index ab5200936..03bc21559 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts @@ -205,10 +205,8 @@ async function generateHlsPlaylist (video: MVideoWithFile, resolution: VideoReso await createTorrentAndSetInfoHash(videoStreamingPlaylist, newVideoFile) - const updatedVideoFile = await newVideoFile.save() - + await newVideoFile.save() videoStreamingPlaylist.VideoFiles = await videoStreamingPlaylist.$get('VideoFiles') as VideoFileModel[] - videoStreamingPlaylist.VideoFiles.push(updatedVideoFile) video.setHLSPlaylist(videoStreamingPlaylist) -- 2.25.1