Commit Graph

10081 Commits (b3870476324e2dc79a9d30371a1199376bcd0ad7)

Author SHA1 Message Date
gxalpha 4bd69bf46e UI: Make toolbar color selectors respect alpha 2021-10-16 15:30:41 -07:00
gxalpha fab23d523b mac-virtualcam: Remove unneeded includes 2021-10-16 15:27:51 -07:00
Alexis King 08d4456339 v4l2: Ignore menu controls with no permissible values
At least one V4L2 device reports a menu control when queried with
QUERYCTRL yet does not report supporting a single value in its legal
range when queried with QUERYMENU. Such devices are arguably
ill-behaved, but the Linux UVC driver takes no special care to ignore
such pathological controls, so we have to do it ourselves.

Without this patch, a menu control with no valid values would cause
v4l2_control_changed to go into an infinite loop, since every S_CTRL
request on such pathological control properties would always fail,
triggering an additional modification event. By ignoring these
properties altogether, we avoid that problem, and the user benefits by
not having the UI cluttered by a confusing and useless menu control.
2021-10-16 15:24:20 -07:00
gxalpha 8f0964c2dd UI: Don't save defaults in oldSettings in properties
The default settings were saved in the oldSettings variable of the
properties dialog in `86eb7ae` to be able to restore default settings in
undo/redo, but this doesn't actually do anything.
Besides this, it introduced a bug where clicking "Cancel" in the
properties dialog would save all settings, including default ones, as
well as a bug where not changing anything in the properties dialog would
still add an undo action.
2021-10-16 15:07:13 -07:00
jp9000 b173d1ce2c UI: Disable paste source menu items when removed
Disables the "Paste (Reference)" and "Paste (Copy)" for sources when the
sources that have been copied have been removed

Fixes obsproject/obs-studio#4074
Closes obsproject/obs-studio#4096
2021-10-15 22:11:03 -07:00
jp9000 52497d23bb UI: Don't copy via name, use weak refs
This change makes it so that when copying filters or sources, that it
stores a weak reference to the source(s) or filter(s) being copied
rather than relying on their names.
2021-10-15 22:10:33 -07:00
jp9000 9819cb2924 libobs: Add obs_weak_source_expired() 2021-10-15 22:10:33 -07:00
Scratch a78558b46a obs-scripting: add transition duration functions 2021-10-15 16:50:59 -07:00
Mike 96449877ef UI: Update Edit menu item states before displaying
Originally, the states of the items in the Edit menu would only update
when a context menu popup was created for sources. This moves that code
out of the context menu creation, and into its own dedicated function.
That function is then used both before the Edit menu is shown, and
before the context menu is created.

Fixes obsproject/obs-studio#3827
2021-10-15 16:11:08 -07:00
tt2468 23cda97a54 libobs/callback: Make proc_handler_t threadsafe
Add mutexes to protect against multi-threaded memory access
violations.
2021-10-14 04:28:04 -07:00
derrod 9d8a011b78 UI: Fix broadcast button state for autostart without autostop 2021-10-13 12:41:49 +02:00
derrod 2170a6b8ac UI: Show warning if starting/stopping broadcast fails 2021-10-13 12:27:47 +02:00
derrod bd45d46c3c UI: Fix YT broadcast start/stop failing due to redundant transition/reset
- If the stream is already live or going live, do not reset or
  transition
- If the stream is testing, transition but do not reset
- If the stream is starting a test, error out since this can take a
  while
- If the attempted transition was redunant, still return a success

Fixes #5403
2021-10-13 12:27:47 +02:00
jp9000 c46a719c9c UI: Fix formatting with both 12.0.0 and 12.0.1
This single line in the entire project causes a difference between
clang-format 12.0.0 and 12.0.1. So, just rearrange the code so it works
with both instead.
2021-10-13 02:44:31 -07:00
jp9000 de0610a03a UI: Fix formatting for clang-format 12.0.0 (I guess)
I guess visual studio uses 12.0.0 rather than 12.0.1 and apparently,
there's some ****ing difference between 12.0.1 and 12.0.0.

Whatever.
2021-10-13 02:22:31 -07:00
jp9000 095661905b UI: Fix formatting with clang-format 12 2021-10-13 02:12:18 -07:00
Ryan Foster 2c5b1a837f CI: Update clang-format from 10 to 12
Microsoft Visual Studio 2019 ships with LLVM/Clang 12 as of Visual
Studio 2019 16.11.0 (August 10, 2021). LLVM/Clang 12 is available on all
platforms. This change should make it easier to have clang-format "just
work" on dev systems and be consistent across platforms without having
to use an outdated version.
2021-10-13 20:00:04 +11:00
Ryan Foster 5f68991911 clang-format: Commit file changes for clang-format 12 2021-10-13 20:00:04 +11:00
Ryan Foster 424128a825 clang-format: Commit file changes for clang-format 11 2021-10-13 20:00:04 +11:00
PatTheMav 39aedc6c2f UI: Add new vector-based menubar icons for macOS 2021-10-12 08:33:54 +11:00
jpark37 c8d0597358 win-wasapi: Log settings 2021-10-10 19:53:27 -07:00
jpark37 ab7d370ada win-wasapi Improve default device handling
Remove lastNotifyTime throttle. Could ignore last device notification.
Will bring back if necessary, but seemed like overkill.

Make isInputDevice const for safety.

Make isDefaultDevice atomic. Allows it to be accessed simultaneously
from settings and notification callback threads. Race between setting
change in OBS and Windows is not a problem, a signal will be sent after
both to consolidate. Worst that should happen is a redundant reconnect
cycle.

Only read/write default_id from notification callback for thread safety.
2021-10-10 19:53:27 -07:00
jpark37 24d82062ae win-wasapi: Schedule work on real-time work queue
MS claims it can schedule audio better if we use their API.
2021-10-10 19:53:27 -07:00
jpark37 86b607154a UI: Add support for real-time work queue 2021-10-10 19:53:27 -07:00
jpark37 d1230c292e win-wasapi: Register capture thread with MMCSS
Ensure audio gets more priority to help prevent glitching.
2021-10-10 19:53:27 -07:00
jpark37 a995c305b7 win-wasapi: Remove bools and persist threads
This simplifies synchronization, and fixes several races.
2021-10-10 19:53:27 -07:00
jpark37 a504691af8 win-wasapi: Clean reset on initialization failure
Do not store IAudioClient and IAudioCaptureClient onto the source object
until initialization is almost complete, right before the capture thread
is created. We don't to retain objects from failed attempts. Also clear
them when stopping.
2021-10-10 19:53:26 -07:00
jpark37 b166b0488b win-wasapi: Remove unnecessary inline tags 2021-10-10 19:53:26 -07:00
jpark37 49aa9074f8 win-wasapi: Remove undefined function InitName 2021-10-10 19:53:26 -07:00
jpark37 88164affae win-wasapi: Rename InitRender to ClearBuffer
We no longer persist the render client.
2021-10-10 19:53:26 -07:00
jpark37 5a2e884d14 win-wasapi: Simplify sample rate logging 2021-10-10 19:53:26 -07:00
jpark37 4503c4fdac win-wasapi: Remove persistent references
Only need IMMDevice and IAudioRenderClient during initialization.
2021-10-10 19:53:26 -07:00
jpark37 15f9d37aef win-wasapi: Persist objects beyond Start/Stop
Initialize IMMNotificationClient and IMMDeviceEnumerator in constructor
to simplify cleanup and initializaiton. Both can survive a reset.
2021-10-10 19:53:26 -07:00
jpark37 12442c3e57 win-wasapi: Make InitDevice throw to log errors 2021-10-10 19:53:26 -07:00
jpark37 8f33e01b84 win-wasapi: Fix incorrect log strings 2021-10-10 19:53:26 -07:00
jpark37 5f2d0456bc win-wasapi: Mark GetWASAPIAudioDevices_ as static 2021-10-10 19:53:26 -07:00
jpark37 3c71399650 libobs/audio-monitoring: Add reconnect logic
Automatically tear down if monitor is invalidated, and retry every time
an input sample is played.
2021-10-10 19:22:35 -07:00
jpark37 eb6050f3ce libobs/audio-monitoring: Move variable assignment
Assinged too early for upcoming change that may reset monitor->render.
2021-10-10 19:22:35 -07:00
jpark37 7af886581d libobs/audio-monitoring: Add WASAPI init helper
audio_monitor_init_wasapi will be used for reconnect logic.
2021-10-10 19:22:35 -07:00
jpark37 63ffae7d74 libobs/audio-monitoring: Remove unnecessary device 2021-10-10 19:22:35 -07:00
jpark37 b005e6748e libobs/audio-monitoring: Fix mutex leak
Use SRWLOCK for simplicity. Does not need to be destroyed.
2021-10-10 19:22:35 -07:00
jpark37 8ce1bb645f win-wasapi: Remove monitor invalidation code
The previous monitor recovery logic touches the source monitoring type,
resets the monitor even if the output device hasn't been invalidated,
and was susceptible to races. Monitor invalidation should live within
the monitor abstraction.
2021-10-10 19:22:35 -07:00
jpark37 e582879303 libobs/media-io: Register audio thread with MMCSS
Ensure audio gets more priority to help prevent glitching.
2021-10-10 19:19:01 -07:00
jpark37 e69f051736 libobs/util: Improve os_sleepto_ns on Windows
Avoid nanosecond abstraction to reduce math operations.

Replace Sleep(0) with YieldProcessor(). We want the thread to remain
scheduled, the current CPU core to do less work, and the hyperthread
sibling to perform better.

Hacky profiling showed maybe 10-25 µs skid reduction per function call.
I think power/performance gains would be hard to measure, so I haven't
tried, but it would be shocking if they got worse.
2021-10-10 19:13:19 -07:00
jpark37 cf6e106939 obs-outputs: Remove unnecessary header 2021-10-10 19:12:45 -07:00
jpark37 e581802812 obs-outputs: Remove WIN32_LEAN_AND_MEAN define
It should already be defined near the Windows.h include.
2021-10-10 19:12:45 -07:00
jpark37 a3f10cf0be libobs: Remove WIN32_LEAN_AND_MEAN
It should already be defined near the Windows.h include.
2021-10-10 19:12:45 -07:00
jpark37 64cb26d03d UI: Tuck variable inside macro guard 2021-10-10 19:12:45 -07:00
jpark37 e181a23bed UI: Remove NOMINMAX from CMake scripts
If we want NOMINMAX globally, we should probably define at top level.
2021-10-10 19:12:45 -07:00
jpark37 c93b040d0d UI: Use patterns that avoid std::min/max
New code is cleaner anyway.
2021-10-10 19:12:45 -07:00