This fixes crashes in media Source when :
- the user forgets to set the input format for srt or rist URLs;
- disabling / enabling / disabling etc Media source with a rist URL.
Signed-off-by: pkv <pkv@obsproject.com>
When a media source is set to use a URL, always fully shut down the
media when stopped. This ensures that the media will do a full
reconnect after having been stopped.
This change breaks the tying of the 'close' option to the media
source being a local file vs. network source. In doing so, it is
possible to keep network sources streaming continuously, which
fixes a few things when using network cameras as sources:
* The preview pane works in studio mode.
* There is no delay in switching scenes before video appears.
* The multiview works properly/normally.
This does introduce one bit of weirdness which could be easily fixed
with sufficient knowledge of OBS to do it quickly: if a networked media
source fails with both 'Restart playback when source becomes active' and
'Close file when inactive' disabled, it is slightly tricky to get it to
restart the video stream. (It can be done by enabling those options and
hiding the scene, though.) It would be nice to have a simple "restart
stream" button somewhere to do this more easily.
(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>
Explicitly checks to make sure hotkeys are actually down, rather than
both down and up. This was causing the restart hotkey to restart the
media twice, once on key down, once on key up.
When using an IP camera on a local network, we wanted to minimize
delay. In order to achieve minimum delay, we allowed Media Source to
set BufferingMB to 0, and when it is 0, also enable AVFMT_FLAG_NOBUFFER
in the AVFormatContext flags.
Unbuffered mode is causing the frames of media sources to potentially
have some slight jitter in playback, so instead of using unbuffered mode
with media sources, just leave buffering on. There may be a frame or so
of latency, but it shouldn't be noticeable to most users.
If a user has a tremendous amount of media files, this can cause
instability. Instead, make hardware decoding something the user has to
explicitly enable.
Although hardware decoding was technically enabled by default even
before we fixed it, fixing it was essentially a change to defaults for
users because it was just not even available before version 24.
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed. Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
Input buffer by default is set to 2MB - for some sources, for example streaming
RTSP input over UDP, this is not enough and causes significant playback issues
that are not present while playing back the same source under ffplay/mpv.
It looks like someone actually started working on this feature as there are
translated strings, properties and everything ready - only the control was
missing from the UI. This commit adds that control.
Currently, the range is set to 1-16MB, step 1MB. This is somewhat arbitrary,
so suggestions to tweak this range with more real-world use cases are welcome.
(This commit also modifies deps/media-playback)
Before, the media-playback library would detect whether something was
seekable by checking the filename for "://", which is unideal because
there are other cases where targets may not be seekable. So instead, an
explicit "seekable" property (off by default) is now in place in the
media source when not in "local file" mode. Seeking will only be
enabled if local file mode is on, or if "seekable" is explicitly checked
by the user.
Closesjp9000/obs-studio#1022
There's no need to display this property at the moment, the default
amount is more than sufficient for most cases. That and most people
wouldn't know what to do with it anyway.
In the media source, do not pre-cache frames if the source is set to
close the file when inactive because that setting is designed to allow
the file to be replaced by the user. If it's replaced, it can
unintentionally keep the old precache frame, playing the frame from the
older video when it starts up.
Preloading is designed to overwrite the current internal render texture
of the source so it'll be ready to play the first frame right when the
source is first displayed.
However, When the media source is set to pause on the last frame, it
keeps that current render texture visible, so preloading it with the
first frame will essentially overwrite the current render, causing it to
inadvertently show and pause on the first frame rather than the last
frame. So instead, just disable preloading when the user has it set to
pause on the last frame.
(Note: This commit also modifies deps/media-playback)
Allows buffering network-based media sources where supported. Default
is two megabytes of buffering.
Due to a noticeable frequency of crashes inside of FFmpeg when using
hardware encoding on mac, this feature is going to be disabled for now
pending more investigation at a later time.