Fix crash when an invalid inbound stream is disconnected. Closes #1439 (#1483)

This commit is contained in:
Gabe Kangas
2021-10-21 17:21:17 -07:00
committed by GitHub
parent b50540dfe9
commit c4d2ffd834
2 changed files with 11 additions and 0 deletions

View File

@@ -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)