Skip to content

Commit

Permalink
fix: Prevent videoSavePath being null (#258)
Browse files Browse the repository at this point in the history
temporarily fix, needs to be further investigated
  • Loading branch information
sonicv6 authored Dec 6, 2024
1 parent 001aa57 commit ea4ae73
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Classes/Recorders/LibObsRecorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class LibObsRecorder : BaseRecorder {
private static CaptureSettings captureSettings => SettingsService.Settings.captureSettings;
Dictionary<string, IntPtr> audioSources = new(), videoSources = new();
Dictionary<string, IntPtr> audioEncoders = new(), videoEncoders = new();
private string videoSavePath;

private readonly Dictionary<string, string> videoEncoderIds = new() {
#if WINDOWS
Expand Down Expand Up @@ -209,6 +210,7 @@ public override async Task<bool> StartRecording() {

signalOutputStop = false;
var session = RecordingService.GetCurrentSession();
videoSavePath = session.videoSavePath;

windowHandle = session.WindowHandle;
#if WINDOWS
Expand All @@ -225,7 +227,7 @@ public override async Task<bool> 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;

Expand Down Expand Up @@ -744,13 +746,13 @@ public override async Task<bool> 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
Expand All @@ -768,7 +770,7 @@ public override async Task<bool> 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;
Expand Down

0 comments on commit ea4ae73

Please sign in to comment.