From c4d2ffd8341a11a20bcd422a2d5c0955f7dbea2d Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Thu, 21 Oct 2021 17:21:17 -0700 Subject: [PATCH] Fix crash when an invalid inbound stream is disconnected. Closes #1439 (#1483) --- core/streamState.go | 9 +++++++++ core/transcoder/utils.go | 2 ++ 2 files changed, 11 insertions(+) diff --git a/core/streamState.go b/core/streamState.go index 35a88b54b..33f2222a4 100644 --- a/core/streamState.go +++ b/core/streamState.go @@ -106,6 +106,15 @@ func SetStreamAsDisconnected() { _yp.Stop() } + // If there is no current broadcast available the previous stream + // likely failed for some reason. Don't try to append to it. + // Just transition to offline. + if _currentBroadcast == nil { + stopOnlineCleanupTimer() + transitionToOfflineVideoStreamContent() + return + } + for index := range _currentBroadcast.OutputSettings { playlistFilePath := fmt.Sprintf(filepath.Join(config.HLSStoragePath, "%d/stream.m3u8"), index) segmentFilePath := fmt.Sprintf(filepath.Join(config.HLSStoragePath, "%d/%s"), index, offlineFilename) diff --git a/core/transcoder/utils.go b/core/transcoder/utils.go index 83d6676df..d89cbfe9d 100644 --- a/core/transcoder/utils.go +++ b/core/transcoder/utils.go @@ -34,6 +34,7 @@ var errorMap = map[string]string{ `Unknown encoder 'h264_x264'`: "your copy of ffmpeg does not have support for the default x264 codec (h264_x264). download a version of ffmpeg that supports this.", `Unrecognized option 'x264-params`: "your copy of ffmpeg does not have support for the default libx264 codec (h264_x264). download a version of ffmpeg that supports this.", `Failed to set value '/dev/dri/renderD128' for option 'vaapi_device': Invalid argument`: "failed to set va-api device to /dev/dri/renderD128. your system is likely not properly configured for va-api", + `Stream map 'v:0' matches no streams`: "the stream provided looks to have no video included, it may be audio-only. owncast requires a video stream.", // Generic error for a codec "Unrecognized option": "error with codec. if your copy of ffmpeg or your hardware does not support your selected codec you may need to select another", @@ -55,6 +56,7 @@ var ignoredErrors = []string{ "maybe the hls segment duration will not precise", "Non-monotonous DTS in output", "frames duplicated", + "To ignore this", } func handleTranscoderMessage(message string) {