From ca801f182927644eb63e902de285f0232eba56d0 Mon Sep 17 00:00:00 2001 From: pigeatgarlic Date: Thu, 11 Apr 2024 22:05:12 +0700 Subject: [PATCH] fix window logic --- parent_windows.go | 4 ++-- src/main.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/parent_windows.go b/parent_windows.go index e9f5d195..cb0291bd 100644 --- a/parent_windows.go +++ b/parent_windows.go @@ -95,7 +95,7 @@ func main() { } memory := (*C.SharedMemory)(unsafe.Pointer(pointer)) - memory.queues[C.Video0].metadata.codec = C.int(1) + memory.queues[C.Video0].metadata.codec = C.int(0) memory.queues[C.Video1].metadata.codec = C.int(0) memory.queues[C.Audio].metadata.codec = C.int(3) @@ -135,7 +135,7 @@ func main() { }(&memory.queues[queue_type], i) } - fmt.Printf("execute sunshine with command : ./sunshine.exe \"%s\"\n", byteSliceToString(buffer)) + fmt.Printf("execute sunshine with command : ./sunshine.exe \"%s\" 0\n", byteSliceToString(buffer)) chann := make(chan os.Signal, 16) signal.Notify(chann, syscall.SIGTERM, os.Interrupt) <-chann diff --git a/src/main.cpp b/src/main.cpp index af864980..88946d28 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -144,11 +144,11 @@ main(int argc, char *argv[]) { int queuetype = -1; std::stringstream ss; ss << argv[2]; ss >> queuetype; - if ((queuetype != QueueType::Audio && - queuetype != QueueType::Input) || - video::probe_encoders()) { - BOOST_LOG(error) << "Video failed to find working encoder"sv; - return -1; + if(queuetype != QueueType::Audio && queuetype != QueueType::Input) { + if (video::probe_encoders()) { + BOOST_LOG(error) << "Video failed to find working encoder"sv; + return -1; + } } //Get buffer local address from handle @@ -254,6 +254,7 @@ main(int argc, char *argv[]) { while (!process_shutdown_event->peek() && !local_shutdown->peek()) std::this_thread::sleep_for(1s); + BOOST_LOG(info) << "Closed" << queuetype; // let other threads to close std::this_thread::sleep_for(1s); task_pool.stop();