Skip to content

videoio(MSMF): add queue for async ReadSample()#21202

Merged
opencv-pushbot merged 1 commit intoopencv:4.xfrom
alalek:videoio_msmf_update_camera
Dec 13, 2021
Merged

videoio(MSMF): add queue for async ReadSample()#21202
opencv-pushbot merged 1 commit intoopencv:4.xfrom
alalek:videoio_msmf_update_camera

Conversation

@alalek
Copy link
Copy Markdown
Member

@alalek alalek commented Dec 6, 2021

Add queue to mitigate problems with burst frames pushed into callback.

  • MSMF may push into callback burst of frames with very small delay between them (3ms in the sample below)
  • expected delay between frames is 33ms (30 FPS)
[DEBUG:1@2.953] ... SourceReaderCB::OnReadSample videoio(MSMF): got frame at 13810997005437
[DEBUG:2@2.956] ... SourceReaderCB::OnReadSample videoio(MSMF): got frame at 13810997338771
[DEBUG:2@2.956] ... SourceReaderCB::OnReadSample videoio(MSMF): drop frame (not processed)

Last frame timestamp:

  • before: 99: 6333.33
  • with patch: 99: 3300.00 - no frames lost

Test --gtest_also_run_disabled_tests --gtest_filter=*videoio_camera*basic improves reported FPS from 16-24 to 28.
Also timestamp failures are fixed. (not yet)

Similar problem is described here: https://stackoverflow.com/questions/55221146/microsoft-media-foundation-uvc-readsample-callback

My problem is that the ReadSample() callback only gets called erratically at a very very low rate (1 FPS or so), in burst of a few frames.

@alalek
Copy link
Copy Markdown
Member Author

alalek commented Dec 13, 2021

👍

@opencv-pushbot opencv-pushbot merged commit 052d209 into opencv:4.x Dec 13, 2021
@alalek alalek mentioned this pull request Dec 30, 2021
@alalek alalek mentioned this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants