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

1859 Commits

Author SHA1 Message Date
jp9000
23111c317f libobs: Remove redundant function param and for loop
Originally when the audio_submix function was created, it used all mixer
tracks, but at a certain point that was removed because it can only use
the first track, so some older code was unintentionally left over,
causing the same code to be executed 6 times mistakenly.  This cleans
that up by removing the unnecessary function parameter and for loop.
2019-08-31 01:15:19 -07:00
jp9000
1a72b04951 libobs: Make sure to offset unpause audio data
When an unpause occurs, it takes an audio segment and splits it at the
exact point corresponding to the pause timestamp, and then it's supposed
to only send the ending part of the split.  However, the audio pointers
were not being incremented, therefore it was sending the front of the
audio segment to instead of the back of the audio segment by mistake.
2019-08-31 01:15:19 -07:00
jp9000
03e008fd2e libobs: Fix pause cutting out video data prematurely
When pause has been activated, the video_pause_check() function is used
when receiving raw frames in order to filter out frames that are in the
pause window, that way they aren't sent to the encoder or output.

However, when pause was enabled, it was unintentionally filtering out
some frames before the specified starting timestamp as well, causing
extra video data to get cut out prematurely.  This fixes that issue.
2019-08-31 01:15:19 -07:00
jp9000
f6d1887675 libobs: Fail pause/unpause if still waiting for them
When a pause/unpause occurs, a timestamp is set and the actual
pause/unpause does not occur until the output/encoders reach the
specified timestamps.  Do not allow pausing/unpausing unless that point
has been reached with all encoders of an encoded output or the output
itself when using a raw output.

This fixes a bug where pause data could get corrupted if
pausing/unpausing too fast, because the audio/video encoders aren't
necessarily synchronized and although one encoder may have unpaused, the
other encoder(s) may not have yet.  Checking all encoders first before
allowing a pause/unpause ensures that doesn't occur.
2019-08-31 01:15:19 -07:00
jp9000
df5689d534 libobs: Give a little extra time for pause to start/stop
Audio latency can get really low, and if it's low enough, the timestamp
can be passed by the audio subsystem before it's had a chance to pause
with it.  So instead, make the pause have a little bit of extra delay to
ensure that doesn't occur.
2019-08-31 01:15:18 -07:00
jp9000
09fc41cc06 libobs: Use correct pointer
This is not supposed to pass the graphics context pointer -- it's
supposed to pass the device pointer held by the graphics context object.
2019-08-30 00:36:27 -07:00
jp9000
3ef5393d42 libobs: Call debug marker after null check, not before 2019-08-29 21:46:13 -07:00
jp9000
7e77294eed libobs: Don't render scene item texture if it's null 2019-08-29 21:44:34 -07:00
jp9000
bf41fd5a6b libobs: Add graphics API to get graphics object pointer 2019-08-29 12:43:10 -07:00
Jim
6943d9a973
Merge pull request #2047 from jpark37/scale-weights
Bicubic/Lanczos Shader Improvements
2019-08-28 08:47:28 -07:00
jp9000
83e237fec1 libobs: Fix default mixer values
There are 6 mixers, so we want 0x3F for 6 bits, not 0xF which is only 4
bits.
2019-08-26 08:24:02 -07:00
jp9000
0845844e5d libobs: Insert sources to linked lists after creation
This fixes a race condition where the audio/video backends/threads may
start using sources before their obs_source_info::create function has
been called.
2019-08-25 19:19:57 -07:00
jp9000
2557ffce7e libobs: Add missing static to function
This function is not used outside of the source file, so make it static.
2019-08-25 19:19:57 -07:00
jp9000
2c3ea4af55 libobs: Fix null potential pointer dereference
When a source type has been removed (i.e. its plugin has been removed)
info can be null, which is permitted.
2019-08-25 19:19:57 -07:00
jpark37
af01e044a2 libobs: Fix Lanczos calculations
- Fix: Ensure (1, 1) coordinate gets clamped.
- Fix: Increase weight precision by premultiplying UV in VS.
- Cleanup: Group coordinates 012/345 instead of 024/135.
- Cleanup: Remove unnecessary branches.

NVIDIA RTX 2080 Ti, Intel GPA, SetStablePowerState

256x224 -> 1323x1080: 123 us -> 123 us
2019-08-25 10:00:23 -07:00
jpark37
3485c4cdac libobs: Simplify bicubic weight calculations
Also increase weight precision by premultiplying UV in VS.

Intel HD Graphics 530, Intel GPA, SetStablePowerState

256x224 -> 1323x1080: 1221 us -> 1020 us
2019-08-25 10:00:10 -07:00
jp9000
73704f20db libobs: Add audio lines
Adds the "audio_line" internal source type as a bare source type for the
sole purpose of outputting audio, and the obs_source_info::audio_mix
callback which allows mixing of those audio lines, which is then treated
as normal audio for the source.  Audio line objects should be added as
sub-sources when multiple audio lines from a single source are needed,
then mixed together with the audio_mix callback.

The difference between the new obs_source_info::audio_mix callback and
obs_source_info::audio_render is that obs_source_info::audio_mix (along
with the audio_line source) are only one track, and it outputs audio to
the source automatically via obs_source_output_audio() when the call
completes.  This allows the mixed audio to be treated like a normal
source's audio, in that you can filter it, change its volume, or monitor
it.

This change was necessary because the CEF (used with the browser source)
outputs multiple audio streams at once to a single browser source, so
it's the program's responsibility to mix those streams together itself.
2019-08-21 15:19:19 -07:00
jp9000
806ab5a022 libobs: Mark encoders that support dynamic bitrate
(This commit also modifies mac-vth264, obs-ffmpeg, obs-qsv11, and
obs-x264)
2019-08-18 03:14:38 -07:00
Jim
22ff0cbff3
Merge pull request #1989 from sorayuki/master
libobs: Merge obs_source_process_filter_(tech_)?end functions
2019-08-17 08:36:21 -07:00
Jim
ce51fa092c
Merge pull request #1992 from Xaymar/patch-tidy-up-1
Fix various clang-tidy and CppCheck warnings.
2019-08-17 08:16:46 -07:00
jp9000
74a3e7246e libobs: Fix browser source settings resetting pre-24
Fixes an issue where the browser source settings will continually reset
pre-24.  Note that this is not 23.2.2, but the version is being
temporarily updated in order to fix the issue for the release candidate
build.
2019-08-17 06:21:19 -07:00
Jim
d0c72334b2
Merge pull request #1961 from Xaymar/patch-fix_property_groups
libobs: Fix modified callback and remove by name for groups
2019-08-16 13:16:34 -07:00
jp9000
bc3ed7bbf7 libobs: Reset mixers for "monitoring only" sources
Resets mixer values for sources that are upgrading to "monitoring only"
(the browser source)
2019-08-15 21:23:45 -07:00
Jim
59a8bf2254
Merge pull request #2031 from jpark37/area-output
libobs: UI: Add Area for downscale output
2019-08-15 20:41:29 -07:00
jpark37
0ea820b277 libobs: UI: Add Area scaling for downscale output
Now that Lanczos downscale blurring has been removed, the Area shader
can attempt to fill the void.
2019-08-14 22:33:52 -07:00
jpark37
9f5d218e16 libobs: Remove unnecessary divides from Lanczos 2019-08-14 21:36:23 -07:00
jpark37
93f1ab789d libobs: Fix dark lines using Lanczos
When texel samples are not exactly on texel centers, weight calculations
will involve a divide by a number very close to zero, resulting in
precision issues. Restore normalization of weights to compensate.
2019-08-14 21:00:09 -07:00
SoraYuki
21135f1483 libobs: Merge obs_source_process_filter_(tech_)?end functions 2019-08-14 14:03:34 +08:00
Michael Fabian 'Xaymar' Dirks
a1cc453996 libobs: Fix apply_settings & remove_by_name for groups
'obs_properties_apply_settings' and 'obs_properties_remove_by_name'
would incorrectly ignore property groups and not call the callbacks
or remove the property, resulting in quite glitchy UI.

This fix works by splitting the internal logic of ...apply_settings
into an extra function to call, while keeping the API the same. The
change to ...remove_by_name is to simply recursively going into the
group content with the same function call.
2019-08-13 17:13:10 +02:00
Jim
444991ba21
Merge pull request #2021 from jpark37/yuva-format
Add support for YUV alpha formats
2019-08-11 20:38:17 -07:00
Kurt Kartaltepe
491b6ec035 Revert "libobs-opengl: Add GS_RGBX format"
This reverts commit d940b9e580.
2019-08-11 18:30:28 -07:00
jpark37
3d6f5c8ad6 libobs: Add YUV alpha formats
This will allow YUV alpha formats to be converted to RGBA on the GPU.
2019-08-11 11:26:22 -07:00
Jim
0546d18855
Merge pull request #1934 from kkartaltepe/alpha-linux
linux-capture: Correct XCompCap glxFBConfigs alpha check
2019-08-11 05:00:35 -07:00
Jim
a52c564e5d
Merge pull request #2003 from SCG82/video-io
libobs: Add missing format to format_is_yuv & get_video_format_name
2019-08-10 23:47:15 -07:00
Jim
31a902b3af
Merge pull request #2018 from jpark37/yuv-simplify2
libobs: Separate textures for YUV input
2019-08-10 22:41:28 -07:00
Jim
ecfcb64056
Merge pull request #1994 from jpark37/faster-lanczos
libobs: Optimize lanczos shader, remove scaling
2019-08-10 03:02:26 -07:00
jpark37
bdd8d64053 libobs: Separate textures for YUV input
The shaders to unpack YUV information from the same texture were rather
complicated. Breaking them up into separate textures makes the shaders
much simpler, and we can remove the PRECISION_OFFSET hack.

Performance also gets a nice boost on Intel for planar textures.

Intel GPA, SetStablePowerState, Intel HD Graphics 530, 1920x1080

UYVY: 473 us -> 457 us
YUY2: 492 us -> 422 us
YVYU: 491 us -> 441 us
I420: 1637 us -> 505 us
I422: 1644 us -> 482 us
I444: 1653 us -> 504 us
NV12: 1656 us -> 369 us
Y800 (limited): 270 us -> 277 us
Y800 (full): 263 us -> 289 us
RGB (limited): 341 us -> 411 us
BGR3 (limited): 512 us -> 509 us
BGR3 (full): 527 us -> 534 us
2019-08-09 21:14:29 -07:00
Jim
164f731320
Merge pull request #1995 from jpark37/yuv-simplify
libobs: Separate textures for YUV output, fix chroma
2019-08-09 21:11:45 -07:00
Jim
cd79855ddb
Merge pull request #1998 from jpark37/gpu-timing
libobs: Add GPU timestamp query support
2019-08-09 19:01:47 -07:00
jpark37
b0e7c5d0d3 libobs: Fix stale format in async frame cache
The video format is not updated if switching between cache-compatible
formats, e.g. YUY2 and YVYU, resulting in the wrong conversion technique
being used. This change ensures the format is always up-to-date.
2019-08-07 06:47:27 -07:00
SCG82
5bc1b3bc76 libobs: Add missing pixel format to format_is_yuv and get_video_format_name 2019-08-03 05:42:30 -07:00
jp9000
68a5a40df9 libobs, obs-ffmpeg, win-dshow: Fix FFmpeg 4.0 deprecation
Fixes FFmpeg 4.0 deprecation warnings.
2019-07-29 20:34:13 -07:00
jpark37
0e12d8189c libobs: Add GPU timestamp query support
This change only wraps the functionality. I have rough code to exercise
the the query functionality, but that part is not really clean enough to
submit.
2019-07-27 13:31:07 -07:00
jpark37
9aacc99b3e libobs: Separate textures for YUV output, fix chroma
The shaders to pack YUV information into the same texture were rather
complicated and suffering precision issues. Breaking them up into
separate textures makes the shaders much simpler and avoids having to
compute large integer offsets. Unfortunately, the code to handle
multiple textures is not as pleasant, but at least the NV12 rendering
path is no longer separate.

In addition, write chroma samples to "standard" offsets. For I444,
there's no difference, but I420/NV12 formats now have chroma shifted to
the left as 4:2:0 is shown in the H.264 specification.

Intel GPA, SetStablePowerState, Intel HD Graphics 530

Expect speed incrase:
I420: 844 us -> 493 us (254 us + 190 us + 274 us)
I444: 837 us -> 747 us (258 us + 276 us + 272 us)
NV12: 450 us -> 368 us (319 us + 168 us)

Expect no change:
NV12 (HW): 580 (481 us + 166 us) us -> 588 us (468 us + 247 us)
RGB: 359 us -> 387 us

Fixes https://obsproject.com/mantis/view.php?id=624
Fixes https://obsproject.com/mantis/view.php?id=1512
2019-07-26 23:21:41 -07:00
jpark37
f27ece50c9 libobs: Optimize lanczos shader, remove scaling
Use bilinear filtering to reduce 36 taps to 25 for the regular path.
This works because the middle weights are always between 0 and 1,
allowing texture coordinates to be placed strategically to sample
correct ratios. I'm not sure about the undistort path, so I've left that
alone.

Also remove scaling added in #526, after which weight normalization is
unnecessary. If we want to use or invent an algorithm with alternate
downscaling properties, that's fine, but I don't think we should change
Lanczos scaling to mean something it's not. The scale implementation was
also seen not working when applied directly to scene items because of
assumptions made about the projection matrix.

Intel GPA, SetStablePowerState, Intel HD Graphics 530, D3D11
644x478 -> 1323x1080: 3890 us -> 3401 us
1920x1080 -> 1280x720: 2555 us -> 2261 us
2019-07-26 20:45:33 -07:00
Jim
62c7e00d16
Merge pull request #1993 from jpark37/faster-bicubic
Optimize bicubic shader
2019-07-26 00:36:19 -07:00
jp9000
aee84cc743 libobs: Add "monitoring by default" source cap
(This also modifies the UI module)

Adds the ability for a source to monitor by default.  This is mainly
aimed at browser sources, so that they do not stop outputting audio by
default like they used to.
2019-07-26 00:05:14 -07:00
jpark37
2721ac4a85 libobs: Optimize bicubic shader
Use bilinear filtering to reduce 16 taps to 9 for the regular path. This
works because the middle weights are always between 0 and 1, allowing
texture coordinates to be placed strategically to sample correct ratios.
I'm not sure about the undistort path, so I've left that alone.

Also remove weight normalization. I'm not seeing that make even a small
difference.

Intel HD Graphics 530, D3D11
644x478 -> 1323x1080: 1790 us -> 1279 us
1920x1080 -> 1280x720: 1301 us -> 918 us

References:
https://entropymine.com/imageworsener/bicubic/
http://vec3.ca/bicubic-filtering-in-fewer-taps/
http://developer.download.nvidia.com/books/HTML/gpugems/gpugems_ch24.html
2019-07-25 22:21:11 -07:00
jpark37
2f286b81d9 libobs: Default sampler sometimes unset for GL
When mixing sampling with raw loads in a shader, ending a shader with a
load would case the default sampler to become unset for OpenGL. Instead,
initialize with no sampler, and only set if there is a sampler.
2019-07-25 21:54:23 -07:00
jpark37
2c6aac32c8 libobs: Fix benign typo 2019-07-25 21:54:23 -07:00