0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
Commit Graph

2357 Commits

Author SHA1 Message Date
jp9000
c5dabb805f libobs: Update version to 27.2.3 2022-03-02 04:25:58 -08:00
jp9000
a8fd2e42df libobs: Update version to 27.2.2 2022-03-01 11:40:16 -08:00
jpark37
fbcb053cfa libobs/util: Use integer math for Windows timing
Cleaner and faster than double math.
2022-02-28 10:11:03 -08:00
jpark37
4e5906d2b0 libobs: Clamp video timing for safety
os_gettime_ns and os_sleepto_ns may not match up exactly.
2022-02-28 10:11:03 -08:00
jp9000
4f15f1062d libobs/util: Fix rounding error with os_sleepto_ns()
os_sleepto_ns() can occasionally return false on times that the
processor may not have reached yet. The reason is because the
count_target, which converts time_target into a QPC counter, is subject
to a rounding error.

Using numbers I generated from an actual clock cycle on my own CPU, I
can show an example of this occurring: if the clock frequency value is
10000000.0, and you call os_sleepto_ns(42164590320600), it will convert
that number first to a double floating point of its QPC value:
421645903205.99994. Then, because it converts that to a LONGLONG
integer, it of course strips off the decimal point. If you convert
421645903205 *back* to a time value, the new value will be
42164590320500, which is lower than the original value by approximately
100 nanoseconds. While this may seem insignificant, it was apparently
enough to cause the os_sleepto_ns() call in video_sleep() to sometimes
return false despite the current time being lower than the target time,
which would cause it to incorrectly calculate how many frames were
duplicated by subtracting the frame time from the current system time,
divide that by the current frame interval, set the vframe_info.count
value to 0, and thus cause an infinite loop in the encode_gpu()
function because queue_frame now starts returning negative numbers in
perpetuity.

This change fixes some rare reports of users having their video lock up
and disconnect, forcing the user to have to forcibly shut down the
program.

Thanks to Twitch user SNLabat for having the patience to kindly provide
us with a dump file from the freeze, and to Matt for coordinating with
that user to obtain it from them.
2022-02-28 02:07:13 -08:00
obiwac
c50c625555 libobs/graphics: gs_query_dmabuf_* on FreeBSD too 2022-02-26 15:36:08 -08:00
jpark37
5d1261eddb libobs: Only resize display if dimensions change 2022-02-26 01:09:07 -08:00
jp9000
f5b64ee33f libobs: Update version to 27.2.1 2022-02-20 16:35:15 -08:00
derrod
269d48f681 libobs: Adjust path for legacy browser source block
The current path would prevent the browser source from loading if OBS
itself is in the "Application Support" folder, where it might end up
when being installed via certain distribution platforms.
This adjusts the existing hack to specifically check for the obs-studio
subfolder where the old browser source library would reside.
2022-02-19 15:45:36 -08:00
Julian Orth
99a6c97b9e libobs: Map wayland keymap with MAP_PRIVATE
Wayland clients are required to use MAP_PRIVATE starting with version 7
of the wl_seat protocol.

Signed-off-by: Julian Orth <ju.orth@gmail.com>
2022-02-16 14:25:16 -03:00
jpark37
3a1124a5fd libobs/util: Fix VS static analysis warnings 2022-02-12 15:06:10 -08:00
jp9000
b68ee1ccae libobs: Update version to 27.2.0 2022-02-10 16:43:18 -08:00
jp9000
edfd5ad604 libobs: Add obs_object abstraction and functions
With this, you can now cast normal obs objects (services, outputs,
sources, encoders) to an obs_object_t, and then use obs_object_*
functions to get references, release references, and similar for weak
object references as well. This allows the ability for the frontend to
use an object of any of those types interchangeably in certain
situations without having to handle each specific type individually.

This is useful because the properties view in particular doesn't care
what type of object it uses, it just needs to be able to hold weak
references to abstract OBS objects.
2022-02-02 22:35:56 -08:00
jp9000
6b944a2f3c libobs: Rename OBSObj to OBSPtr
Makes it a bit more explicit that it's just a pointer RAII, and because
an OBSObject will be added
2022-02-02 22:35:56 -08:00
jpark37
657c4d0125 libobs: Add effect files to CMakeLists.txt
Makes them easily searchable from Visual Studio.
2022-01-29 17:16:16 -08:00
jpark37
59ab9c98fb libobs/graphics: Fix gs_get_format_bpp
Was missing case for GS_RGBA16F.
2022-01-29 18:51:34 -05:00
jpark37
63db2265dc libobs, libobs-d3d11, libobs-opengl: Add GS_RG16
This format will be useful for P010 chroma in the future.
2022-01-29 15:12:00 -08:00
Richard Stanway
4cc419e3c9 libobs: Free module if obs_module_load callback returns false
Currently if a module fails its load callback, it remains loaded and OBS
continues to call additional exports such as obs_module_post_load. This
goes against the documented behavior, which states that a module that
fails its load callback is unloaded.

This commit releases locale resources and frees the module's
information, preventing further callbacks from libobs. The module itself
(the DLL) is not yet unloaded from memory as os_dlclose is commented out
for causing unspecified issues - this should be revisited in the future.
2022-01-28 19:14:00 -08:00
Matt Gajownik
67dbb316a5 libobs: Respect push to talk/mute status in volmeter
The audio capture callback's mute parameter internally respects the
push to talk/mute state, whereas obs_source_muted() and the "mute"
signal don't. This resulted in meters looking entirely unmuted even
though both monitoring and output were not receiving audio.
2022-01-26 16:37:36 +11:00
Jim
03d9bda387 libobs: Deprecate obs object addref functions
Deprecates:
obs_source_addref()
obs_output_addref()
obs_encoder_addref()
obs_service_addref()
obs_scene_addref()

These functions should be considered unsafe and not used. Instead, use:
obs_source_get_ref()
obs_output_get_ref()
obs_encoder_get_ref()
obs_service_get_ref()
obs_scene_get_ref()

These functions return a pointer to the incremented object only if the
object is still valid, otherwise they will return null, indicating that
the object is no longer valid or is unsafe to use.

The reason why this is being done is because certain third party plugins
seem to be using addref, and are somehow managing to call addref on
sources that have already been fully released. For the sake of safety,
almost all usage of these functions within OBS have also been replaced
as well.
2022-01-25 05:20:03 -08:00
Jim
0523c2e5e9 libobs: Replace addref calls with get_ref 2022-01-24 14:06:50 -08:00
Jim
77a35e93ea libobs: Use get_ref calls for obs.hpp helper classes 2022-01-24 14:06:50 -08:00
Jim
f29e5ffbc7 libobs: Add obs_scene_get_ref() 2022-01-24 14:06:47 -08:00
jp9000
2416dfbd5e libobs: Prevent and log double destroy on sources
This prevents double destroys from happening on sources and causing
crashes. If someone's doing a double destroy it'll probably crash anyway
but at least we'll know what happened if it does. (Jim note: I suspect
third party plugins are calling addref on sources when they shouldn't
be. Either that or we're missing something ourselves, but I suppose
we'll see.)
2022-01-23 11:56:28 -08:00
Exeldro
b2360b4332 libobs: Don't destroy mutex before destroying sources is done 2022-01-22 15:32:42 -08:00
Richard Stanway
82b5a39ea4 libobs: Mark raw_active and gpu_encoder_active as volatile
These were operated on by atomic functions but were not marked as
volatile or loaded with os_atomic_load_long, potentially introducing
subtle race conditions. Detected by ThreadSanitizer.
2022-01-18 03:49:20 -08:00
Richard Stanway
dccf569982 libobs: Specify format string for bcrash
Detected by PVS Studio.
2022-01-15 00:31:31 +01:00
tytan652
30b8987bad libobs: Fix type mismatch on obs_property_text_monospace 2022-01-14 21:02:29 +11:00
Kurt Kartaltepe
bcb04bb800 libobs: Open a separate X11 connection for hotkeys
Qt will mask certain input events. In order to avoid them masking things
like mouse button events we open a new display here.

Fixes #4843
2022-01-08 19:20:35 -03:00
Cody Jung
e7837e30ce UI: Fix push-to-talk/mute delay not saving
Fixes a couple copy/paste errors preventing push-to-talk and push-to-mute delays
not saving when choosing Apply or OK.
2022-01-08 17:38:04 +11:00
jp9000
a5a8a7c32f libobs: Stop all source processing on destroy
Stops all video/audio IO when a source enters the destroy process.
Prevents any internal callbacks from being triggered and improves
performance.
2022-01-04 13:35:37 -08:00
jp9000
7fa07afd21 libobs: Call destroy signal after waiting
No real reason to have it above. Any other sources will still wait
anyway, so just makes things a bit more consistent.
2022-01-04 13:35:37 -08:00
jp9000
47d8f2e497 libobs: Remove all callbacks on source destroy
Removes all callbacks in use on sources right when a source is about to
be destroyed.

Fixes a crash where callbacks would still be executed while in a
destroyed state (particularly sidechain filters). Could also just mark
the source as being in a destroyed state and not accept anymore
obs_source_output_[audio/video] calls.
2022-01-04 01:45:49 -08:00
wangshaohui
bb59dfd060 libobs: Move position for calling execute_graphics_tasks
The new order is as below:
[message pump]
output_frame
render_displays
execute_graphics_tasks
2021-12-31 17:34:20 -08:00
jp9000
2f13d92d25 libobs: Fix template errors on non-MS compilers
Because apparently Microsoft's compilers are bad at following language
specs.
2021-12-30 22:02:11 -08:00
jp9000
52cc1d533e libobs, UI: Fix cpp auto-release assignment from OBSRefs
The *AutoRelease helpers should not take references from OBSRef objects.
Instead, make an OBSRefAutoRelease base class, and OBSRef a subclass of
that to allow moves, and then perform moves from those objects.

This fixes an issue where *AutoRelease OBSRef objects would cause an
unintended double release of objects after having been assigned values
from non-*AutoRelease OBSRef objects.
2021-12-30 21:19:34 -08:00
jp9000
1655ebf18f libobs, UI: Add support for beta builds
Allows the ability to specify beta builds in addition to release
candidate builds
2021-12-27 10:01:07 -08:00
Richard Stanway
5be6681687 libobs: Check memory allocation in Windows crash handler
If we're crashing due to a low memory condition, it's dangerous to
try to allocate more memory without checking for success.
2021-12-26 17:48:54 +01:00
Richard Stanway
7d64e9d598 libobs: Use size_t for obs_encoder_get_frame_size 2021-12-26 17:32:00 +01:00
jp9000
8212cedf03 Revert "libobs, docs: Add function to get source version"
This reverts commit 1a7a10048c.
2021-12-25 17:10:45 -08:00
Norihiro Kamae
d1b87e1642 libobs: Add API to get encoder frame size
When muxing to some format, duration of the packet is used. We need an
API for encoder to return the frame size.
2021-12-23 10:48:37 -08:00
Clayton Groeneveld
5878856ce4 UI: Display grayscale volume meter if muted
Currently, the volume meters don't show volume levels when
muted. This shows the levels and makes it grayscale when
the source is muted.
2021-12-23 06:35:29 -08:00
columbarius
4cda05f270 libobs/graphics: Add Linux-only gs_query_dmabuf_* functions
When sharing DMA-BUFs it is required the announce the underlying
hardware capabilities via supported modifiers.

Add new device_query_dmabuf_capabilities vfunc to gs_exports and connect it
to the egl implementation stubs in the supported render platforms. Add a new
public method gs_query_dmabuf_capabilities() that calls the vfunc above.

Add new device_query_dmabuf_modifiers vfunc to gs_exports and connect it
to the egl implementation in the supported render platforms. Add a new
public method gs_query_dmabuf_modifiers() that calls the vfunc above.
2021-12-22 14:27:53 -03:00
tt2468
167f539416 libobs: Rename obs_audio_monitoring_supported to _available
With the reasonable possibility of monitoring support becoming a
runtime check, the phrase `available` is more fitting.
2021-12-22 02:43:14 -08:00
jp9000
49f9a055dc libobs: Fix destruction order for destruction task queue
Destruction of the task queue should probably happen after the audio and
video threads have been destroyed and all audio/video processing has
stopped.
2021-12-21 11:48:29 -08:00
jw0z96
447b17e75e libobs: Implement additional source blending modes 2021-12-20 09:06:38 -08:00
jw0z96
33a6d2a5fd libobs: Expose blending operation types 2021-12-20 09:06:38 -08:00
jp9000
8b3416c1e7 libobs: Implement deferred destruction of sources
(This also modifies the UI)

The purpose of deferring destruction of sources is to ensure that:
1.) Hard locks from enumeration cannot occur with source destruction.
  For example, if the browser source is destroyed while in the graphics
  thread, the browser thread would wait for the graphics thread, but the
  graphics thread would still be waiting for the browser thread, causing
  a hard lock.
2.) When destroys occur during source enumeration, that the integrity of
  the context's next pointer in the linked list can no longer be
  compromised
3.) Source releases are fully asynchronous rather than having the risk
  of stalling the calling thread
4.) We can wait for source destruction when switching scene collections
  or when shutting down rather than hoping for threads to be finished
  with sources.

This introduces a new requirement when cleaning up scene/source data:
the obs_wait_for_destroy_queue() function. It is highly recommended that
this function be called after cleaning up sources. It will return true
if at least one or more sources were destroyed. Otherwise it will return
false. Forks are highly advised to call this function manually on source
cleanup -- preferably in a loop, in conjunction with processing
outstanding OBS signals and UI events.
2021-12-19 11:53:19 -08:00
jp9000
ab84214356 libobs: Add obs_in_task_thread() function
Allows determining which thread the caller is currently in, if any
2021-12-19 11:53:19 -08:00
jp9000
cf492ca271 libobs: Add ability to queue audio task
This is mostly framework for allowing the ability to wait for certain
threads
2021-12-19 11:53:14 -08:00