Apparently, using the old chromium network implementation changes the
way cookies are handled, causing cookies to reset. So instead of doing
that, continue to use the new network implementation on Windows, and
only use the old network implementation on macOS for the time being.
Make duplicator_capture_tick the sole creater, and reference adder of
IDXGIOutputDuplication objects. This prevents a situation where
duplicator_capture::showing cause be false while
duplicator_capture::duplicator was not null at startup on background
scenes, preventing IDXGIOutputDuplication from being recreated when
DXGI_ERROR_ACCESS_LOST.
This uses the older network implementation rather than the new
NetworkService chromium has implemented until a later version of CEF is
used. The newer NetworkService implementation has caused some lag with
playback when hardware acceleration is not available for whatever
reason. This doesn't fix media playback issues with software rendering
on windows, but it does on macOS. All playback issues with software
rendering appear to be fixed in later version of CEF, however those
versions do not currently have hardware accelerated OSR or audio capture
support, so we must deal with 3770 until we can upgrade CEF again (which
hopefully won't be too long).
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.
The file duration is a bit of an estimate. This adds 500ms to the
estimated stinger media file duration to help ensure stinger videos
play back in full without getting cut off prematurely.
Lookahead requires examining frame data over a large number of frames,
so when pkv added the change to fully reset the encoder when the bitrate
changes, nvenc will invalidate all buffers and basically starts over
from a completely clean slate.
It's possible to make lookahead work when changing the bitrate, but due
to how lookahead seems to works internally in nvenc, it will cause
continually increasing latency every time the bitrate is updated, which
is unideal.
Additionally, when lookahead is enabled, deadlocks can occur when
changing the bitrate in a thread other than the graphics thread.
Currently we allow it to be reset outside of the graphics thread. From
limited investigating, it would appear this deadlock occurs because
nvenc is locking and releasing old textures.
So instead of dealing with all these potential issues, disable the
ability to adjust bitrate when the user has lookahead enabled on nvenc.
It's not really worth implementing dynamic bitrate support when
lookahead is enabled if the latency is just going to continually
increase for every bitrate adjustment anyway.
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.
This fixes a freeze that can occur if you try to destroy browser while
another browser is being created. The CEF UI thread has to wait on a
window message to the main application UI thread, meanwhile the destroy
call in the main application UI thread is waiting on the CEF UI thread,
thus causes a deadlock.
Now that we have the SetParent(hwnd, nullptr) code that detaches the CEF
window from the Qt window, we no longer have to worry about
synchronously shutting down the browser, so instead of waiting for that
operation to finish, just allow it to occur asynchronously.
Uses the new obs_source_set_audio_active function to signal to the UI
whether audio is active or inactive depending upon whether the user is
currently allowing OBS to control the audio or whether the user is
allowing CEF to control the audio. Ensures that the browser does not
show up in the mixer if CEF is playing back the audio itself.
It was determined that rerouting audio through OBS currently isn't the
best idea even with monitoring enabled, primarily due to the fact that
audio monitoring has never had this wide of testing before, and that
many users complained that they were not getting audio for (as of yet)
unknown reasons from audio monitoring. It would appear that we need to
address the issues with audio monitoring first before attempting to use
audio monitoring with any sources by default. For now, audio will
reroute through CEF by default, and then the user must explicitly use
the option "Control audio via OBS", (renamed from "reroute audio", and
now disabled by default), to enable browser audio control through OBS.
There are other issues that need to be resolved as well, and once all
the various issues are addressed, the setting default can be allowed to
change back.
This prevents VideoFormat::Any from unintentionally selecting H264 when
MJPEG is the only other format available.
This fixes a bug where certain devices (Logitech C920 with latest
drivers) will only have H264 and MJPEG available, and using
VideoFormat::Any will then select H264 over MJPEG because it's the first
format value and has the same priority as MJPEG. So now, MJPEG will be
prioritized over H264 instead.
Full color range seems to be active when decoding video with FFMmpeg
even when partial is explicitly selected. This should keep the range
synchronized.
Request contexts don't appear to work with relative paths, only absolute
paths. This fixes the bug where when using portable mode,
cookies/session wouldn't save because obs_module_config_path() was
returning a relative path rather than an absolute path.
Browser panels were having their initial visibility state always being
set to false. This fixes that by only setting visibility state on
browser objects which explicitly call the visibility message (i.e. only
browser sources).
In newer CEF builds the http://absolute/ scheme handler factory seems to
never complete when accessing large media files due to an apparent bug
in the Chromium media player (XHR requests complete fine). At the same
time, file:// URLs are working just fine.
file:// URLs will be used where available (CEF 3440+) falling back to
BrowserSchemeHandlerFactory on older CEF versions.
This reverts commit 46c5780a77e761416a990d5680593ff3a47405fb.
This needs to be reverted for now because users who did not set a size
on it (left it at default and just stretched it) will now suddenly have
the source's size change out of nowhere. There needs to be backward
compatibility implementation for this.
Using WasHidden() for the purposes of visibility no longer can be relied
upon due to some sort of bug with OSR in Chromium. This issue does not
happen when using 3440. The browser works fine without WasHidden()
calls, so we must remove its usage or be forced to use 3440. For those
who need the visibility handling, an alternative will have to be used
once it's available.
Additionally, this reverts the failed workaround to use OBS FPS in place
of SignalBeginFrame() because that code is no longer needed due to the
WasHidden() removal.
Before, we were calling DestroyWindow on the browser panel HWND from the
CEF UI thread, which meant that the main program thread had to process
window messages in order for that message to successfully through as
DestroyWindow blocks on the WM_DESTROY/WM_NCDESTROY window messages.
Unfortunately, this also had the side-effect of processing all queued Qt
events, which, when called in the destructor of a window like this, can
result in undefined behavior; specifically crashes, which were occurring
due to this. Especially when browser panels were in docks and docked to
the main window.
So, instead of calling DestroyWindow in another thread and then
processing events in the main thread, call DestroyWindow directly in the
main thread to get WM_DESTROY/WM_NCDESTROY and only those processed on
the spot. This appears to fix the crashes due to the undefined
behavior when closing browser panels.
This fixes crashes that could occur while processing Qt events during a
source's destruction.
Originally the processEvents code was added to make sure that any window
messages being sent to the browsers were being processed by Qt.
However, that was only necessary for browser panels as they are actually
associated with windows/views. Browser sources are OCR, thus they do
not need this.
Fixes same issue as 5c04876de1, but reverts that and changes it so that
external_begin_frame_enabled is not used instead, which seems to fix
that issue.
CEF outputs multiple audio streams at once, and OBS was only able to
handle one at a time. This fixes it by using audio lines for each CEF
audio stream, and mixes them together itself.
The dynamic bitrate operates based upon estimating the current bitrate
output, and then adjusting the bitrate on the fly as necessary when
congestion is detected as a replacement for dropping frames.
This may still need adjustment, as it is difficult to accurately emulate
real-world frame drop scenarios. This does not currently drop frames at
all, and because of that, very high congestion may cause additional
stream delay to viewers (because data will be buffered), but from
limited testing, most congestion will not cause that and it can safely
recover pretty quickly without adding significant delay.