Skip to content

Conversation

@PatTheMav
Copy link
Member

Description

Enables the video capture and capture card sources to automatically select an initial fallback framerate when a device is selected.

Motivation and Context

When a new device is selected, a best-possible frame rate is chosen for the initial configuration of the device. This has to be set in the source settings, as those are the "source of truth" for the properties and the device configuration.

The object has to be created explicitly first before setting the frame rate value. The source then has to be updated explicitly as well to ensure that the change will be picked up by the next iteration of the render thread to "tick" the source and thus make it configure a capture session with the fallback framerate set.

Ensures that a "good-enough" setup is used immediately and users can see that their chosen capture device is actually "working".

Note

Due to a bug with the frame rate property code, this will also make the property widget automatically switch the frame rate selection to "rational" mode.

The root cause for this is that the specific values for numerator and denominator used by CoreMedia do not match the values used by OBS (even though they effectively both represent the same frame interval), and it only does a naive numerical comparison of both values.

This will have to be fixed separately in the associated shared property UI code.

How Has This Been Tested?

Tested on macOS 26 with capture card source and video capture source:

  • Initial setup always chose best-possible fallback for a new source
  • Capture device was correctly initialised with the fallback frame rate

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

When a new device is selected, a best-possible frame rate is chosen
for the initial configuration of the device. This has to be set in the
source settings, as those are the "source of truth" for the properties
and the device configuration.

The object has to be created explicitly first before setting the
frame rate value. The source then has to be updated explicitly as well
to ensure that the change will be picked up by the next iteration
of the render thread to "tick" the source and thus make it configure
a capture session with the fallback framerate set.
@PatTheMav PatTheMav force-pushed the avcapture-default-fps branch from 13cd194 to 5b5ec47 Compare October 22, 2025 14:55
@WizardCM WizardCM added Enhancement Improvement to existing functionality macOS Affects macOS labels Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Improvement to existing functionality macOS Affects macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants