You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug 🐛
When starting the capture using GraphicsCaptureApiHandler::start_free_threaded, GraphicsCaptureApiHandler::on_closed, which should be called when the capture ends, such as when the window disappears, is not called. I have confirmed that it is called correctly when starting the capture using GraphicsCaptureApiHandler::start.
Expected behavior 📝 GraphicsCaptureApiHandler::on_closed is called when the capture is finished.
OS 🤖
Version: 11
Build: 23H2
Additional context ➕
use windows_capture::{
capture::GraphicsCaptureApiHandler,
frame::Frame,
graphics_capture_api::InternalCaptureControl,
settings::{ColorFormat,CursorCaptureSettings,DrawBorderSettings,Settings},
window::Window,};#[derive(Debug,Default)]/// A dummy struct to implement the `GraphicsCaptureApiHandler`` trait.structCapture;/// A capture handler implementation for the windows-capture crate.implGraphicsCaptureApiHandlerforCapture{typeFlags = ();typeError = ();fnnew(_flags:Self::Flags) -> Result<Self,Self::Error>{println!("Capture handler created");Ok(Self)}fnon_frame_arrived(&mutself,_frame:&mutFrame,_control:InternalCaptureControl,) -> Result<(),Self::Error>{println!("Frame arrived");Ok(())}fnon_closed(&mutself) -> Result<(),Self::Error>{println!("Capture handler closed");Ok(())}}fnmain(){constTARGET_WINDOW_NAME:&str = "Fork";let window = Window::from_contains_name(TARGET_WINDOW_NAME).expect("Failed to find window");let settings = Settings::new(
window,CursorCaptureSettings::WithoutCursor,DrawBorderSettings::WithoutBorder,ColorFormat::Rgba8,(),);// This doesn't return when the window is closedlet control = Capture::start_free_threaded(settings).expect("Failed to start capture");
control.wait().expect("Failed to wait for capture");// For demonstration purposes. We didn't use `wait()` in our actual code.// This works//Capture::start(settings).expect("Failed to start capture");}
The text was updated successfully, but these errors were encountered:
OK. I compared the differences between start and start_free_threaded visually and was able to make it work properly by applying the following changes. However, I don't fully understand what's happening in the background. d8db910
I'll submit a PR #47 for now, but since I don't understand it completely, feel free to fix it on your end instead of merging it.
Additionally, feel free to use the code in the PR as you like.
Describe the bug 🐛
When starting the capture using
GraphicsCaptureApiHandler::start_free_threaded
,GraphicsCaptureApiHandler::on_closed
, which should be called when the capture ends, such as when the window disappears, is not called. I have confirmed that it is called correctly when starting the capture usingGraphicsCaptureApiHandler::start
.Expected behavior 📝
GraphicsCaptureApiHandler::on_closed
is called when the capture is finished.OS 🤖
Additional context ➕
The text was updated successfully, but these errors were encountered: