From ea4ae73955e95f7227a12e6ba4b87bcbf4be8909 Mon Sep 17 00:00:00 2001 From: Dylan Manning Date: Fri, 6 Dec 2024 12:10:21 +0000 Subject: [PATCH] fix: Prevent videoSavePath being null (#258) temporarily fix, needs to be further investigated --- Classes/Recorders/LibObsRecorder.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Classes/Recorders/LibObsRecorder.cs b/Classes/Recorders/LibObsRecorder.cs index e358c72..903e025 100644 --- a/Classes/Recorders/LibObsRecorder.cs +++ b/Classes/Recorders/LibObsRecorder.cs @@ -26,6 +26,7 @@ public class LibObsRecorder : BaseRecorder { private static CaptureSettings captureSettings => SettingsService.Settings.captureSettings; Dictionary audioSources = new(), videoSources = new(); Dictionary audioEncoders = new(), videoEncoders = new(); + private string videoSavePath; private readonly Dictionary videoEncoderIds = new() { #if WINDOWS @@ -209,6 +210,7 @@ public override async Task StartRecording() { signalOutputStop = false; var session = RecordingService.GetCurrentSession(); + videoSavePath = session.videoSavePath; windowHandle = session.WindowHandle; #if WINDOWS @@ -225,7 +227,7 @@ public override async Task StartRecording() { if (captureSettings.captureGameAudio) CreateAudioApplicationSource(new AudioApplication(session.GameTitle, recordWindow)); else SetupAudioSources(); if (!await SetupVideoSources(recordWindow, session.Pid, session.ForceDisplayCapture)) return false; - SetupOutput(session.videoSavePath); + SetupOutput(videoSavePath); if (!await CheckIfReady()) return false; @@ -744,13 +746,13 @@ public override async Task StopRecording() { DisplayCapture = false; if (!isReplayBuffer) { - Logger.WriteLine($"Session recording saved to {session.videoSavePath}"); - RecordingService.lastVideoDuration = GetVideoDuration(session.videoSavePath); + Logger.WriteLine($"Session recording saved to {videoSavePath}"); + RecordingService.lastVideoDuration = GetVideoDuration(videoSavePath); } if (IntegrationService.ActiveGameIntegration is LeagueOfLegendsIntegration lol) { - GetOrCreateMetadata(session.videoSavePath); - lol.UpdateMetadataWithStats(session.videoSavePath); + GetOrCreateMetadata(videoSavePath); + lol.UpdateMetadataWithStats(videoSavePath); } #if RELEASE && WINDOWS @@ -768,7 +770,7 @@ public override async Task StopRecording() { #endif IntegrationService.Shutdown(); if (!isReplayBuffer) - BookmarkService.ApplyBookmarkToSavedVideo("/" + Path.GetFileName(session.videoSavePath)); + BookmarkService.ApplyBookmarkToSavedVideo("/" + Path.GetFileName(videoSavePath)); Logger.WriteLine($"LibObs stopped recording {session.Pid} {session.GameTitle} [{bnum_allocs()}]"); return !signalOutputStop;