From d51901e191c26471b6594a3a9e724d6b5d552963 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Mon, 13 Jul 2020 14:39:44 -0700 Subject: [PATCH] Make setting the segment length optional --- config-example.yaml | 1 - config/config.go | 9 +++++++++ core/ffmpeg/transcoder.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config-example.yaml b/config-example.yaml index 900039338..026befb47 100644 --- a/config-example.yaml +++ b/config-example.yaml @@ -31,7 +31,6 @@ instanceDetails: url: http://soundcloud.com/owncast videoSettings: - chunkLengthInSeconds: 4 streamingKey: abc123 offlineContent: static/offline.m4v # Is displayed when a stream ends diff --git a/config/config.go b/config/config.go index 35e0f3c69..71910b3ea 100644 --- a/config/config.go +++ b/config/config.go @@ -155,6 +155,15 @@ func (c *config) GetFFMpegPath() string { return path } +func (c *config) GetVideoSegmentSecondsLength() int { + if c.VideoSettings.ChunkLengthInSeconds != 0 { + return c.VideoSettings.ChunkLengthInSeconds + } + + // Default + return 4 +} + //Load tries to load the configuration file func Load(filePath string, versionInfo string) error { Config = new(config) diff --git a/core/ffmpeg/transcoder.go b/core/ffmpeg/transcoder.go index ff26e4a74..c7bb649f0 100644 --- a/core/ffmpeg/transcoder.go +++ b/core/ffmpeg/transcoder.go @@ -190,7 +190,7 @@ func NewTranscoder() Transcoder { transcoder.playlistOutputPath = config.Config.PublicHLSPath transcoder.input = utils.GetTemporaryPipePath() - transcoder.segmentLengthSeconds = config.Config.VideoSettings.ChunkLengthInSeconds + transcoder.segmentLengthSeconds = config.Config.GetVideoSegmentSecondsLength() qualities := config.Config.VideoSettings.StreamQualities if len(qualities) == 0 {