You can see the MS SDK sample CaptureEngineVideoCapture
which is a bit different (CaptureEngine + GUI), but it handles WM_POWERBROADCAST to stop the capture (+ calls PowerSetRequest in Capture.cpp)
Crash on attempt to unlock IMFMediaBuffer on sleep/hibernate.
Application crashes on attempt to unlock IMFMediaBuffer on sleep/hibernate.
Stacktrace:
mfplat.dll!CopyImage_SSE2() Unknown
mfplat.dll!MFCopyImage() Unknown
FrameServerClient.dll!CMF2DMediaBuffer::InternalCopyBuffer(class MFBUFFER::CBuffer *,long,class MFBUFFER::CBufferRO *,long) Unknown
FrameServerClient.dll!CMF2DMediaBuffer::ContiguousCopyFrom2(unsigned char const *,unsigned long,long) Unknown
FrameServerClient.dll!CMF2DMediaBuffer::ContiguousCopyFrom(unsigned char const *,unsigned long) Unknown
FrameServerClient.dll!CMF2DMediaBuffer::Unlock(void) Unknown
mf-hibernate.exe!Reader::Stop() Line 145 C++
mf-hibernate.exe!main() Line 286 C++
Configuration:
VisualStudio 2022
Windows 10 Pro 21H2 19044.2364
AMD Ryzen 9 5900X
RAM 64GB
NVIDIA GeForce RTX 2070
Webcam Logitech C930c
Webcam Logitech BRIO 4K
Steps to reproduce:
- Compile & Run the app (attached debugger is OK)
- Open mf-hibernate.vcxproj & build OR compile mf-hibernate.cpp, e.g.,
cl mf-hibernate.cpp /Od /EHsc /link /SUBSYSTEM:CONSOLE Ole32.lib Mf.lib Mfplat.lib Mfreadwrite.lib Shlwapi.lib
- Make sure real webcam captured by the app (see the list of enumerated MF devices at the start)
- Wait for capturing to begin, the app should print "Frame number ..."
- Go to Shutdown options (in Start menu) and choose Sleep or Hibernate
- Wake up and note that app was crashed
Unable to upload cpp as txt file (attachments not working), link to zip https://drive.google.com/file/d/1tMbb9cJ9e-3GqDe3iLmfKirMSU6N5IC7/view
2 answers
Sort by: Most helpful
-
Castorix31 86,506 Reputation points
2023-01-07T17:17:31.187+00:00 -
Limitless Technology 44,571 Reputation points
2023-01-10T09:01:36.843+00:00 Hi,
Thank you for posting your query.
Kindly follow the steps provided below to resolve your issue.
I would suggest you to temporarily disable the antivirus security software program installed on your computer and check if that helps.
Go to this link for your reference and other troubleshooting procedures https://answers.microsoft.com/en-us/windows/forum/all/sleephibernate-causes-crash-on-windows-10/1c972b60-98d9-4e58-922c-c6ae3059eab7
https://learn.microsoft.com/en-us/answers/topics/windows-api-com.html
Do not hesitate to message us if you need further assistance.
If the answer is helpful kindly click "Accept as Answer" and up vote it.