From b4c73315fa19680c8d6d78572d05f1474284daf7 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Mon, 20 Nov 2023 18:02:35 -0800 Subject: [PATCH] feat(log): point to passthrough as a potential issue when unable to generate thumbnails Re: #3433 and #3431 --- core/data/config.go | 7 ++++--- core/streamState.go | 3 ++- core/transcoder/thumbnailGenerator.go | 8 ++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/data/config.go b/core/data/config.go index 6923edac9..47cc860af 100644 --- a/core/data/config.go +++ b/core/data/config.go @@ -620,14 +620,14 @@ func VerifySettings() error { } // FindHighestVideoQualityIndex will return the highest quality from a slice of variants. -func FindHighestVideoQualityIndex(qualities []models.StreamOutputVariant) int { +func FindHighestVideoQualityIndex(qualities []models.StreamOutputVariant) (int, bool) { type IndexedQuality struct { quality models.StreamOutputVariant index int } if len(qualities) < 2 { - return 0 + return 0, qualities[0].IsVideoPassthrough } indexedQualities := make([]IndexedQuality, 0) @@ -649,7 +649,8 @@ func FindHighestVideoQualityIndex(qualities []models.StreamOutputVariant) int { }) // nolint:gosec - return indexedQualities[0].index + selectedQuality := indexedQualities[0] + return selectedQuality.index, selectedQuality.quality.IsVideoPassthrough } // GetForbiddenUsernameList will return the blocked usernames as a comma separated string. diff --git a/core/streamState.go b/core/streamState.go index 05eca220b..52b8b844e 100644 --- a/core/streamState.go +++ b/core/streamState.go @@ -69,7 +69,8 @@ func setStreamAsConnected(rtmpOut *io.PipeReader) { }() go webhooks.SendStreamStatusEvent(models.StreamStarted) - transcoder.StartThumbnailGenerator(segmentPath, data.FindHighestVideoQualityIndex(_currentBroadcast.OutputSettings)) + selectedThumbnailVideoQualityIndex, isVideoPassthrough := data.FindHighestVideoQualityIndex(_currentBroadcast.OutputSettings) + transcoder.StartThumbnailGenerator(segmentPath, selectedThumbnailVideoQualityIndex, isVideoPassthrough) _ = chat.SendSystemAction("Stay tuned, the stream is **starting**!", true) chat.SendAllWelcomeMessage() diff --git a/core/transcoder/thumbnailGenerator.go b/core/transcoder/thumbnailGenerator.go index bfc188ad9..311e98b96 100644 --- a/core/transcoder/thumbnailGenerator.go +++ b/core/transcoder/thumbnailGenerator.go @@ -25,7 +25,7 @@ func StopThumbnailGenerator() { } // StartThumbnailGenerator starts generating thumbnails. -func StartThumbnailGenerator(chunkPath string, variantIndex int) { +func StartThumbnailGenerator(chunkPath string, variantIndex int, isVideoPassthrough bool) { // Every 20 seconds create a thumbnail from the most // recent video segment. _timer = time.NewTicker(20 * time.Second) @@ -36,7 +36,11 @@ func StartThumbnailGenerator(chunkPath string, variantIndex int) { select { case <-_timer.C: if err := fireThumbnailGenerator(chunkPath, variantIndex); err != nil { - log.Errorln("Unable to generate thumbnail:", err) + logMsg := "Unable to generate thumbnail: " + err.Error() + if isVideoPassthrough { + logMsg += ". Video Passthrough is enabled. You should disable it to fix this, and other, streaming errors. https://owncast.online/troubleshoot" + } + log.Errorln("Unable to generate thumbnail:", logMsg) } case <-quit: log.Debug("thumbnail generator has stopped")