Commit Graph

267 Commits (0377b962b5450b8faefc60b94f030f1f434f3e08)

Author SHA1 Message Date
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
pkv 50aec9c2a0 media-playback: Fix rist demuxing
We currently pass a 'buffer_size' option to avformat in bytes.
Unfortunately, avformat/librist.c admits an option with the same name but in milliseconds.
The default values set in the UI (2 MB) go beyond the range admitted in ms (0-30 000)
so avformat issues errors.
This fix disables the option when rist protocol is detected.

Signed-off-by: pkv <pkv@obsproject.com>
2022-01-14 20:50:14 -08:00
Ryan Foster ce734366bc obs-ffmpeg: Respect AVFormatContext and AVOutputFormat constness
AVFormatContext::oformat was made const on April 27, 2021 [1]. If we
respect the constness of AVOutputFormat and do not cast results from
FFmpeg functions to non-const, we cannot modify the results after the
fact. Our choices are either to cast them to non-const (and presumably
have them implicitly casted back to const on later function calls), or
only try to modify the results in versions of FFmpeg where these are not
expected to be const.

Instead of relying on casts, we can set the encoder values in the
ffmpeg_cfg struct, which are later passed to new_stream.

Also modifies deps/media-playback. Removes compiler warnings.
Some avformat functions return const AV(In/Out)putFormat per [1], so
ifdef as needed.

[1]: 56450a0ee4
     lavf 59.0.100 avformat.h
     avformat: Constify the API wrt AV(In|Out)putFormat

     Also constify AVProbeData.
2021-11-23 12:10:25 -05:00
jpark37 6393c3f4cd ipc-util: Fix potential ready_event hang
There is an expectation that ready_event will signal/wake 1:1, so the
stray teardown signal may get lost. Add new stop_event for safety.
2021-11-21 01:38:36 -08:00
jp9000 6534bf5834 obs-x264: Move options parser to its own lib 2021-10-25 12:24:16 -07:00
Scratch a78558b46a obs-scripting: add transition duration functions 2021-10-15 16:50:59 -07:00
Eric Lindvall ef34a5f765 deps/media-playback: Handle discontinuities to fix video stalls
If there is a PTS discontinuity in the playback stream that causes the PTS to
reset, it is likely that new audio frames will come in while there are still
video frames waiting to be dequeued. This will cause the audio frames to be
played while the video frames wait for the PTS to get back up to where they
were before the discontinuity.
2021-09-11 22:28:53 -07:00
jpark37 bc7ecd4527 deps/obs-scripting: Fix pthread mutex leaks 2021-08-23 22:30:55 -07:00
jp9000 1d44ace7d0 deps/media-playback: Fix trailing whitespace 2021-08-15 10:59:03 -07:00
wangshaohui decd3c2678 deps/media-playback: Fix bug about audio without best_effort_timestamp 2021-08-15 06:11:03 -07:00
jpark37 976d76dfbd deps/media-playback: Less accurate sleep
Avoid busy-wait for media sources by not caring about sleep precision.

Reduces CPU usage in status bar from 1.1% to 0.8% on my machine.
2021-08-15 00:12:14 -07:00
jpark37 c021338ceb libobs,deps/media-playback: Avoid bitfields
Use unused padding of obs_source_frame/obs_source_frame2 instead.
2021-06-11 07:02:37 -07:00
jpark37 ce6f233e2d deps/media-playback: Plumb linear alpha flag 2021-06-04 19:04:08 -07:00
Eric Lindvall 3c76fc4ddb obs-ffmpeg: Enable macOS hardware decoding for media source
Reverts  c7395b05ec
2021-03-30 03:45:06 -07:00
Georges Basile Stavracas Neto b26073c5b2 deps-glad: Add DMA-BUF EGL extensions
Import the DMA-BUF importing extensions from GLAD.
2021-02-13 19:42:01 -03:00
Georges Basile Stavracas Neto 59744e95c3 deps/glad: Make X11 required as well
To keep consistency with the EGL line
2021-02-01 19:03:14 -03:00
Georges Basile Stavracas Neto 7801b3301a deps-glad: Add EGL
The code is generated by https://glad.dav1d.de/
2021-02-01 19:03:14 -03:00
jpark37 5753c25cba libcaption: Fix static keyword placement 2021-01-29 23:59:23 -08:00
Kurt Kartaltepe 5efb10a5e2 libobs: Fix leaking obs-internal.h
Removes prior attempt to expose libcaption headers which really shouldnt
have public. This instead moves the obs-internal include out of the
public obs-scene.h and into it's implementation.
2021-01-28 23:59:02 -08:00
Kurt Kartaltepe bde5d11100 libcaption: Fix header missing in install
libobs directly depends on libcaption headers. So ensure they are
installed with obs' headers.

fixes #3925
2021-01-28 12:55:11 -08:00
PatTheMav ecdc81ba0f obs-scripting: Add Py 3.8+ C-API changes
Closes obsproject/obs-studio#3689
2021-01-27 11:33:34 -08:00
Ryan Foster 81c2dac75e deps: Update cmake_minimum_required to 2.8.12 2021-01-18 01:37:45 -08:00
jp9000 0ab2b038e8 deps/json11: Update to most recent version 2020-12-09 22:23:03 -08:00
Scratch 842ad1781b obs-scripting: Fix removing signal handlers in lua 2020-12-07 15:44:00 +11:00
jp9000 f8cc3bfe01 deps/media-playback: Fix audio segment duration calc
With certain audio encoders, gaps can be introduced into the audio
packets, causing the audio duration to be miscalculated because it
calculated audio duration based upon the PTS of the current packet to
the last packet. However, this audio encoder also did not store
timestamps for most of its audio packets, causing PTS values to be
calculated based upon duration values. So those two things combined
caused audio timestamps to go all out of whack when playing back certain
videos with the media source. This is particularly prevalent with WMV
files using Microsoft codecs.

So to fix it, when the duration needs to be calculated, just calculate
the duration based upon the sample count of the audio packet. This fixes
the issue with the video in question that caused problems, and likely
fixes issues in a lot of videos that may have been floating out there
for some time. Basically this is a fix for a potential long-standing
issue.

Closes obsproject/obs-studio#3683
2020-11-15 04:57:41 -08:00
Colin Edwards 7b0d7c6357 Remove BUILD_CAPTIONS build flag 2020-11-02 22:46:55 -06:00
Exeldro 1c774008b4 deps/media-playback: Fix time at non-standard speeds 2020-09-24 01:15:57 -07:00
Per Heed 318779be7a obs-scripting: Fix script_path() python mem corruption
Returning PyObject with borrowed reference will result in double free
and/or use after free issue.  Issue seen as crash when running Python
script calling script_path().
2020-09-13 16:20:56 -07:00
Richard Stanway 5889e2905e CMake: Set PIC for all library targets
Fixes https://github.com/obsproject/obs-studio/issues/3436
2020-09-09 01:55:50 +02:00
nkmerrill a5656d12b4 deps/media-playback: Fix fast-forward after reset
Fixes #3341 by ensuring timestamps are reset after pausing.
2020-09-07 19:50:40 -06:00
Jim 86147d9719
Merge pull request #3415 from jpark37/default-color-space
Unify color space settings as 709
2020-09-07 13:29:44 -07:00
jp9000 2ac1ad5290 deps/media-playback: Fix pause continually running loop
Fixes an issue where when paused, the thread loop would continue to
repeat endlessly until unpaused.
2020-09-07 12:36:40 -07:00
jpark37 b6afaceeae Update VIDEO_CS_DEFAULT to mean 709 instead of 601
Consistent with modified default UI setting.
2020-09-06 20:51:28 -07:00
Scratch e4b81c2b1b obs-scripting: Fix removing signal handlers in python
Closes #3218
2020-08-16 00:26:32 +10:00
Jim bfdf5dc947
Merge pull request #2356 from jpark37/sycc-color-space
Color space refinements
2020-08-05 08:58:21 -07:00
jp9000 bff7ae89ad deps/media-playback: Add seek callback
Allows setting the current frame directly when seeking. If not set, will
just use preload if avaialble.
2020-07-29 13:59:49 -07:00
jp9000 83913e1d31 deps/media-playback: Don't EOF while paused and seeking
Fixes a bug where playback would completely stop when manually seeking
to the end of the file. Playback should not officially stop until
playback has unpaused.
2020-07-21 16:40:33 -07:00
Exeldro 7a33167769 deps/media-playback: Preload video when seeking paused 2020-07-20 14:23:13 -07:00
jpark37 f8cae4639e deps/media-playback: Remove unused #define 2020-07-18 23:33:21 -07:00
jpark37 2e7fee8e53 deps/libff: Remove very old version check 2020-07-18 23:32:15 -07:00
jpark37 24e18c73f5 media-playback: Leverage VIDEO_CS_SRGB
Doesn't change much now, but may someday.
2020-07-18 19:44:13 -07:00
jp9000 56e56cd265 deps/media-playback: Reset TS when seeking
If seeking occurs too close to the previous time value, it could cause
the playback to delay an abnormal amount of time, or if the time value
is under the previous value, then it would cause an assert.  So instead,
reset the next timestamp value to be instant in both cases if a seek
occurs to ensure timely playback.
2020-07-16 19:00:01 -07:00
yoho 0a4b1d622c obs-ffmpeg: Add auto reconnect to remote media sources
(Note: This commit also modifies deps/media-playback)

Co-authored-by: Eric Lindvall <eric@5stops.com>
Co-authored-by: Ryan Foster <RytoEX@gmail.com>
Co-authored-by: Jim <obs.jim@gmail.com>
2020-07-05 08:31:05 -07:00
Jim 3b11e170b7
Merge pull request #2836 from jpark37/yuv-image-fix
Fix FFmpeg YUV to RGB conversion by adding extra destination padding to line sizes
2020-06-26 06:13:45 -07:00
jpark37 2123b306f3 libobs: Fix right edge of some videos
FFmpeg YUV to RGB conversions require extra destination padding.

The Mantis issue might have been fixed when some YUV format conversions
were moved to the GPU, but this may fix other YUV formats.

Fixes https://obsproject.com/mantis/view.php?id=1177
2020-06-14 20:00:58 -07:00
jpark37 218a3d36a3 deps/media-playback: Use SWS_POINT instead of SWS_FAST_BILINEAR
There is no resize happening in this code, so bilinear doesn't make
sense. Fixes artifacts caused by SWS_FAST_BILINEAR approximation.
2020-06-11 10:49:04 -07:00
jpark37 89532e59fc deps/media-playback: Use OBS YUV(A)444P to RGB conversion
swscale with SWS_FAST_BILINEAR produces artifacts.
2020-06-11 10:49:00 -07:00
Jim 9607a9f46e
Merge pull request #2384 from LiamCoal/allow-no-buffering
media-playback: Unbuffered Media Source
2020-05-21 17:40:08 -07:00
jp9000 7993179466 cmake: Add cmake folders 2020-05-13 06:52:37 -07:00
Jimi Huotari c7f84f8fc4
deps/glad: Fix build with GCC-10
GCC-10 defaults to '-fno-common' [1], which triggers issues with
defining global variables multiple times.  To fix the build, use
'extern' to turn the first definition of 'gladGetProcAddressPtr'
into a declaration.

1. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678

Closes https://github.com/obsproject/obs-studio/issues/2828
2020-05-04 11:02:49 +03:00