Crash on attempt to unlock IMFMediaBuffer on sleep/hibernate.

Volodymyr Enhelhardt 1 Reputation point
2023-01-07T15:52:20.657+00:00

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:

  1. 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
  1. Make sure real webcam captured by the app (see the list of enumerated MF devices at the start)
  2. Wait for capturing to begin, the app should print "Frame number ..."
  3. Go to Shutdown options (in Start menu) and choose Sleep or Hibernate
  4. 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

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
12,001 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,717 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
10,528 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 86,506 Reputation points
    2023-01-07T17:17:31.187+00:00

    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)


  2. 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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.