mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-31 02:13:51 +08:00
91917f8120
The monitoring deduplication was previously checking at each audio tick the whole audio tree for Audio Output Capture (AOC) devices used for monitoring. The profiling did not show any big impact on the audio callback. But due to reports of a significant slowdown for scenes with numerous audio sources, we have moved the check on AOC from the audio thread to the UI thread. So we implemented obs_source_audio_output_capture_device_changed which is triggered whenever: - a monitoring device is changed in Settings > Audio, - an Audio Output Capture source changes its device or on startup. This function compares the AOC device with the monitoring device in UI thread. If they are identical, a signal is sent to the audio thread to add an audio task updating the AOC duplicating source pointer at the end of an audio tick. This triggers monitoring deduplication if the ptr is not NULL. The calls in the AOC are implemented in next commits. The rest of the logic in obs-audio.c is the same except on one count, which is that we check against the muted state of the AOC rather than its user_muted; with the new logic, muted works better. Signed-off-by: pkv <pkv@obsproject.com>