Commit Graph

79 Commits

Author SHA1 Message Date
Florian Müllner
972a3b2d44 dbusServices/extensions: Load preferences as module
Now that extensions themselves are imported as modules, do the
same for their preference dialogs.

Extensions must now export a class with a `fillPreferencesWindow()`
method as default.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2795>
2023-07-06 18:41:29 +00:00
Florian Müllner
612e04165e dbusServices: Port to ESM
We want to replace gjs' custom (and now legacy) imports system
with standard EcmaScript modules: JS developers are already
familiar with them, they have better tooling support and using
standard features over non-standard ones is generally the right
thing to do.

Our D-Bus services are separate from the main process, and thus
can be ported separately (except for the few imports that are
shared with the main process' code base).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2786>
2023-06-21 13:26:42 +02:00
robert.mader@collabora.com
e1145defa9 screencastService: Fix 'pipeline' option
When introducing the pipeline fallback mechanism, support for defining a
custom pipeline was unintentionally dropped, breaking extensions such as
EasyScreenCast.

Fixes 9cb40c4814

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2782>
2023-05-30 22:21:12 +00:00
Jonas Dreßler
846bb84ff6 screencastService: Fixup pipeline fallback behavior
Calling _teardownPipeline() before _tryNextPipeline() was actually not a
good idea, it sets the pipelineState to STOPPED, which means we can't try
any of the following pipelines anymore.

Instead what we want to do is set the pipeline state of the old pipeline to
NULL when trying a new one, without calling _teardownPipeline() for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2754>
2023-04-26 18:02:57 +00:00
robert.mader@collabora.com
b916ced2e6 screencastService: Add dmabuf/GL pipeline
This pipeline imports dmabufs and does format conversion using GL.
The `video/x-raw(memory:DMABuf)` filter ensures format negotiation
between `pipewiresrc` and Mutter will only succeed if Mutter advertises
dmabuf support as well, falling back to the next pipeline otherwise.

Using this pipeline frees Mutter from downloading buffer content on the
main thread which can have a big impact on compositor performance.
Doing format conversion on the GPU should further improve the overall
performance on most hardware.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2597>
2023-04-26 12:19:42 +00:00
Jonas Dreßler
c494597a91 screencastService: Signal errors via the internal dbus interface
Make sure gnome-shell gets notified of errors that happen during screen
recording using the screencastService, so that it can properly notify the
user about the error and tear down its state, too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2752>
2023-04-26 13:35:57 +02:00
robert.mader@collabora.com
80d72cfd32 screencastService: Do not try multiple pipelines on old Pipewire versions
Pipewire versions < 0.3.67 may not fail immediatly on negotiation
errors, thus use the last/fallback pipeline directly.
Technically, a similar recent version of Wireplumber is required
as well, but we can't check that easily and the combination of old
Wireplumber and new Pipewire is quite unlikely.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2609>
2023-04-26 12:48:32 +02:00
Jonas Dreßler
9cb40c4814 screencastService: Add fallback mechanism for gstreamer pipelines
Introduce a fallback mechanism for gstreamer pipelines that allows to
define multiple pipelines and prefer them over each other.

The way this works is that we introduce a new STARTING PipelineState.
While the Recorder is in that state, it is allowed to tear down the
current pipeline and start another one whenever an error happens, this is
used to try multiple pipelines in a fixed order until a working one is
found.

Right now there's just a single pipeline using the existing vp8 encoder, the
actual new encoders and pipelines will be added in a separate commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2609>
2023-04-26 11:39:16 +02:00
robert.mader@collabora.com
46517e02dd screencastService: Drop always-copy condition
The check for the Pipewire version was originally introduced in
d32c0348 which states:
> Since it is not clear yet when a proper solution will arrive,
> this makes use of `always-copy` as a workaround for now and
> should be reverted once it is no longer needed.

The check for a stable Gstreamer version with the mention proper fix was
introduced in d7b44319 and carried for the 43 cycle.

By the time Gnome 44 will be released all distros should have had enough
time to update their Gstreamer version - or backport the patches, in
case of not ustream-supported versions.

Thus lets drop it now.

Note: `always-copy` is not suitable for dmabuf buffers as it copies via
mmap.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2609>
2023-04-25 20:28:28 +02:00
Jonas Dreßler
cad01d154c screencastService: Set PipelineState to PLAYING on actual state-change
Right now when we tell gstreamer to move the pipeline to the state
PLAYING, we pretend that happens immediately and set our PipelineState
to PLAYING right afterwards.

In reality though it's more complicated than that: Gstreamer changes
states asynchronously and set_state() returns a Gst.StateChangeReturn.ASYNC.
In that case we should wait until the according STATE_CHANGED event happens
on the bus, and only then set our PipelineState to PLAYING.

Since the STATE_CHANGED event will also happen when set_state() returns
SUCCESS, we can use the same async logic for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 18:57:51 +02:00
Jonas Dreßler
42af7e53a2 screencastService: Handle more gstreamer errors
Gstreamer can produce various errors, we shouldn't pretend those don't
exist and go on as usual when one happens. Instead, when an error
happens, tear down the pipeline, set our PipelineState to the new ERROR
state and bail out with a proper error message.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 18:57:47 +02:00
Jonas Dreßler
cbfbdc4be5 screencastService: Streamline teardown and error handling
We're tracking three different state-machines in the Recorder object:
The state of the gstreamer pipeline, the state of the screencast
session, and the sender of our dbus invocation that might vanish.

Properly handling errors that might appear in any of those three "black
boxes" is not easy, especially tearing down the other two when one of
them breaks.

So refactor the error handling here: Add a single error path for each of
those three states we're tracking, and make them all subsequently call
the _bailOutOnError() method. From there we tear down the other states and
call the error callbacks.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 17:17:41 +02:00
Jonas Dreßler
e6196b5b9f screencastService: Add an ERROR state for the pipeline state tracking
This will be useful when we start actually listening for ERROR events on
the gstreamer bus.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 17:17:41 +02:00
Jonas Dreßler
98cfce0ebe screencastService: Use strings for states
Using strings instead of numbers allows for easier debugging, it means
we can just log the state itself.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 17:17:41 +02:00
Jonas Dreßler
9eea48536a screencastService: Promisify Recorder start/stopRecording functions
This will allow for cleaner error handling in the following commits.

A benefit we get from it right now is having one less callback when
calling startRecording/stopRecording().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2197>
2023-04-25 17:17:41 +02:00
Jonas Dreßler
617997412e screencastService: Handle case where no videos directory exists
The videos directory doesn't necessarily have to exist, users are free to
delete it. Right now we don't handle this case and screencasting fails.

Let's handle it and fall back to the users home directory instead when
xdg-videos doesn't exist.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2594>
2023-01-11 16:51:30 +00:00
Florian Müllner
a2acecb491 dbusService/screencast: Hold during gstreamer checks
Some gstreamer plugins require a connection to the display server,
so they block until the server is up and running. That's why we
moved the check into the D-Bus service, so that the blocking would
not lock up the compositor itself.

However the block can still delay the service initialization so
much that auto-shutdown hits immediately when returning from the
constructor. If that happens, the proxy on the shell side is no
longer backed by a remote object when the init callback runs, and
all properties therefore resolve as `null`.

As a result, gnome-shell thinks that screencasts aren't supported
and hides the screencast button.

Fix this by holding the service during the gstreamer checks, so
that the auto-shutdown timeout only starts after the service is
ready.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6051

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2533>
2022-11-09 11:15:04 +00:00
Florian Müllner
3cdcd075ef dbusServices/screencast: Check for all require elements
Instead of assuming that gst-plugins-good has been compiled with
all the plugins we need enabled, explicitly check for the ones
we use.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5710

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2519>
2022-11-04 09:51:20 +00:00
Florian Müllner
f266c2ca15 screenshot: Move HAVE_RECORDER check into screencast service
Some gstreamer plugins require a connection to the display server,
so if we end up initializing gstreamer before we are ourselves
fully initialized, we may end up with a locked compositor.

Avoid this by moving the runtime recorder check into the screencast
D-Bus service, so that all gstreamer calls happen out of process.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5710

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2519>
2022-11-04 09:51:20 +00:00
Sebastian Keller
d7b443197b screencast: Don't force buffer copies on recent gstreamer versions
Gstreamer 1.20.4 includes a fix in the videoconvert element that makes
it no longer necessary to always copy buffers in pipewiresrc to have
smooth recordings. This change now skips those otherwise unnecessary
copies when using a new enough videoconvert.

Related: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2928
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2503>
2022-10-20 13:56:47 +00:00
Sebastian Keller
d32c03488f screencast: Always copy buffers in pipewiresrc
Pipewire 0.3.52 via commit a1f33a99 introduced a change that affects how
long pipewiresrc holds onto the pw_buffers it dequeued. Before that
change the pw_buffer was held until the end of the videoconvert element
at the beginning of the pipeline. After that change the pw_buffer was
held onto until the filesink at the end of the pipeline. This was
starving MetaScreenCastStreamSrc of pw_buffers to record new frames
into, resulting in the majority of frames being missed, especially in
situations in which the encoder was taking longer.

Pipewire 0.3.57 via commit 1ea1d525 will allow queuing the pw_buffer
early again via the `always-copy` option. This however is only a
workaround until a proper solution is found in either pipewire or
gstreamer that does not depend on copying the buffer contents and
instead queues the pw_buffer again after videoconvert as prior to
a1f33a99.

Since it is not clear yet when a proper solution will arrive, this makes
use of `always-copy` as a workaround for now and should be reverted once
it is no longer needed.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5585
Related: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2461
Related: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/283
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2436>
2022-09-03 15:15:31 +00:00
Alessandro Bono
b63c6ac0ef cleanup: Use deepUnpack() intead of deep_unpack()
deep_unpack() is just a backwards compability alias for deepUnpack()[1].
The new name makes it more clear that this is not a C function, start to
use it.

[1] 13e662a29d

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2416>
2022-08-10 10:29:24 +00:00
Florian Müllner
637ee7386e js: Use async D-Bus wrappers
After porting the more complex cases - in particular those that
affect a module's API - we are left with straight-forward D-Bus
method calls that can be moved to promise-based wrappers in one
go.

For consistency, this also switches from Remote to Async where
the call result is ignored.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2344>
2022-08-01 18:51:14 +00:00
Emmanuele Bassi
317fa8222e screencast: Use the same format for screencasts and screenshot file names
Screenshots use `%Y-%m-%d %H-%M-%S` for the timestamp, which has the
advantage of allowing proper lexicographical sorting.

The screencast file name pattern, on the other hand, uses
locale-dependent expansions, which break sorting based on file name, and
introduces the chance of potentially invalid characters on different
file systems.

Fixes: #5115
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2300>
2022-07-27 13:50:10 +00:00
Evan Welsh
61eef2fb9b extensionUtils: Add utility for setting the current extension
ES modules do not allow exports to be overriden, in anticipation
of the ESM port add a `setCurrentExtension` utility which will
throw if used in the shell. This is tested using a conditional
import of Main.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2363>
2022-07-06 13:40:44 -04:00
Evan Welsh
83c08e17cf dbusServices: Refactor service utilities from fileUtils into dbusUtils
To enable porting services to ECMAScript modules independently of
the shell, split DBus service utility functions into a new file,
dbusUtils.js

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2365>
2022-07-05 03:41:41 -04:00
Florian Müllner
a8c5d77872 dbusServices/screencast: Install unconditionally
We currently decide at build time whether to include screencast
support, based on whether the required gst/pipewire library headers
are installed.

That check is imprecise, because having the library headers available
at build time doesn't necessarily mean that the libraries are there
at runtime, or that the corresponding typelibs are installed.

It makes more sense to check the requirements at runtime, so prepare
for that by installing the screencast service unconditionally, but
bail out early if the dependencies aren't met.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2297>
2022-05-20 12:00:22 +00:00
Simon McVittie
7f4f328a7f Specify API versions for all public GIR APIs, except GLib
If one of these libraries breaks its GIR API in future, then upgrading
packages unrelated to gnome-shell might pull in the newer version,
causing gnome-shell to crash when it gets a newer GIR API that is
incompatible with its expectations. For example, this seems to be
happening in Debian testing at the moment, when GNOME Shell 41.4
imports GWeather and can get version 4.0 instead of the version 3.0 that
it expected.

Adding explicit API versions at the time the newer version is released
is too late, because that will still let the newer version of the GIR API
break pre-existing GNOME Shell packages. Prevent similar crashes in
future by making the desired versions explicit.

This is done for all third-party libraries except GLib, similar to the
common practice in Python code; if GLib breaks API, then that will be
a disruptive change to the whole GLib/GObject ecosystem, regardless.

Gvc, Meta, Shell, Shew, St are not included because they're private
(only exist in a non-default search path entry).

Clutter and Cogl *are* included, because we need to import the fork of
them that comes with Meta, as opposed to their deprecated standalone
versions.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/1008926
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2261>
2022-04-04 17:55:25 +01:00
Florian Müllner
5442266f28 js: Simplify promisify() calls
If the finish function isn't specified, promisify will now try
to use the async name without '_async'/'_begin' suffix (if any)
and '_finish' appended.

Everything except IBus uses a variation of that pattern, so there's
quite a bit of boilerplate we get to remove…

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2174>
2022-02-11 16:24:01 +00:00
Florian Müllner
d7d484a8cd dbusServices: Allow to persist services via environment
Auto-shutdown prevents debugging a service with tools like
d-feet, so allow turning it off with an environment variable.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2169>
2022-02-10 13:14:45 +00:00
Florian Müllner
00e41383c7 dbusServices/screencast: Removed unused properties
Those have been superseded by corresponding state enums.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2165>
2022-02-09 13:00:04 +01:00
Florian Müllner
e07bc62fbd dbusServices/extensions: Give extensions access to the prefs window
The current preference API - buildPrefsWidget() - predates client-side
decorations. While extension authors have been finding ways around
the limitation of not having access to the window/titlebar, the change
to the new Adwaita API seems like a good time for an updated API that
officially provides that access (as far as allowed by libadwaita).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>
2022-02-08 19:11:19 +00:00
Florian Müllner
285ebe020c dbusServices/extensions: Stop setting a default size
Adw.PreferencesWindow already sets an appropriate default.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>
2022-02-08 19:11:19 +00:00
Florian Müllner
cd9532c678 dbusServices/extensions: Use default style class
libadwaita provides a series of style classes as part of its API.
Use those instead of meddling manually with the font size.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>
2022-02-08 19:11:19 +00:00
Florian Müllner
7a8b636028 dbusServides/extensions: Use Adw.PreferencesWindow
Adapt the new GNOME platform API for the upcoming 42. This makes
sure that we get the latest version of the stylesheet, as well as
support for the new dark mode.

Using the dedicated preference API also gives extensions with more
complex preferences an easier and standardized way for implementing
multi-page preferences.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>
2022-02-08 19:11:19 +00:00
Florian Müllner
089fd315dd dbusServices/extensions: Simplify actions handling
GTK4 has dedicated API for widget-specific actions, make use of that
instead of explicitly managing an action group.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>
2022-02-08 19:11:19 +00:00
Florian Müllner
ae92c1c4eb dbusServices/extensions: Split error page from window
The error UI comprises the bits that are actually custom. Splitting them
out from the off-the-shelf window makes it easier to replace the dialog
with libadwaita's dedicated preference window.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>
2022-02-08 19:11:19 +00:00
Florian Müllner
073dbc3a04 dbusServices/extensions: Split out prefs dialog
We're about to make changes to the UI, so this seems to be a good
time to split GUI and service code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>
2022-02-08 19:11:19 +00:00
Florian Müllner
c071c3ed4c dbus-services/extensions: Remove outdated requires
We are using GTK4, not GTK3 >= 3.20 ...

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2012>
2022-02-08 19:11:19 +00:00
Florian Müllner
8d8eba000f dbusServices: Allow replacement
The REPLACE flag we currently pass is useless, as replacing the service
is disallowed when not started with the ALLOW_REPLACEMENT flag.

Fix this by adopting a more standard pattern where replacement is always
allowed, but only actually requested when `--replace` is passed on the
command line.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2152>
2022-02-07 18:44:34 +00:00
Florian Müllner
35466b0e0a dbusServices/notifications: Disallow acting on "foreign" IDs
The Notify() and CloseNotification() methods act on a notification,
identified by the passed ID. Just like it makes sense to only emit
notification signals to the original sender, those methods should
be restricted to the notification owner.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5008

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2153>
2022-02-05 12:17:23 +00:00
Florian Müllner
0cbab09044 dbusServices/notifications: Stop broadcasting signals
All fd.o Notifications signals are emitted for a particular notification,
so debugging aside, only the owner of said notification has a legitimate
reason to act on it.

So far we (and other implementations like the old notification-daemon)
have relied on the client-side to properly filter the signals (like
libnotify), but at least the QT implementation is known to not do
that.

Enforce correct client behavior by only emitting the signal to the
original sender.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5008

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2153>
2022-02-05 12:17:23 +00:00
Ivan Molodetskikh
0e4b87fe5a screencastService: Create directory if it doesn't exist
Instead of testing if the videos directory exists and using the home
directory otherwise, just try to create the target directory. This
aligns with how the screenshot UI handles the screenshots folder, and
it's convenient for putting screencasts into a subdirectory.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2102>
2022-01-14 18:42:47 +00:00
Florian Müllner
8c1cf3fa3d dbusServices/extensions: Instruct gjs to generate unique GType names
Like the main gnome-shell process, the extensions service loads code from
extensions. It therefore makes sense to prevent GType name clashes there
as well, just like we already to in the gnome-shell process.

This may break some extensions that use the old type name in .ui files,
but they can be fixed easily by specifying an explicit GTypeName.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2024>
2022-01-05 19:28:25 +00:00
Florian Müllner
daf729de11 build: Replace deprecated meson functions
Replace deprecated functions with their direct replacements:

 - dep.get_pkgconfig_variable() → dep.get_variable()
 - prg.path() → prg.full_path()
 - source/build_root() → project_source/build_root()

In one case we need meson.global_source_root() that was only
added in meson 0.58, so bump the requirement to that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2077>
2021-12-23 15:52:21 +00:00
Florian Müllner
b93342f72e dbusServices/extensions: Only allow one dialog at a time
Showing multiple preference dialogs at the same time (for instance
by repeated `gnome-extensions prefs` calls) may or may not work as
expected, depending on whether any of the dialogs is modal or not
(read: opened via the Extensions app).

The easiest way to address this is to disallow more than a single
dialog at the time. It's arguably also the more predictable behavior,
and means extensions don't have to deal with inconsistent state
caused by multiple dialogs.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4564

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2013>
2021-10-30 21:50:47 +00:00
Florian Müllner
4d2b008966 dbusServices/extensions: Fix shutdown after showing prefs
GTK4 relies entirely on refcounting for cleanup (that is,
there is no longer a destroy() method that forces a dispose
run regardless of the refcount).

Unfortunately that makes cleanup harder in (some) language
bindings, where an object may be kept alive implicitly by
closures etc.

Address this by releasing the hold count when the window
is closed rather than when it is destroyed.

This isn't the most elegant, but it ensure that the service
doesn't get stuck if an extension doesn't carefully clean
up everything in its prefs widget.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4564

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2013>
2021-10-30 21:50:47 +00:00
Florian Müllner
dc0491ade8 dbusServices/screencast: Handle pipeline failures gracefully
If parsing the pipeline fails for some reason, we currently end up
with a zombie session that leads to a stuck recording indicator in
gnome-shell.

Instead, properly tear down the session to allow mutter and gnome-shell
to correctly update their state.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1878>
2021-06-09 15:21:35 +00:00
Jonas Dreßler
51bf7ec176 screencastService: Improve the gstreamer pipeline for recording
The current gstreamer pipeline performs quite bad on slower machines and
is dropping lots of frames, improve the pipeline by changing a few
things:

- Use threads for videoconvert and improve speed of videoconvert by
disabling some unneeded things
- Add a queue before the encoding step, this allows the encoder to work
at its own pace and will lead to a lot more stability
- Remove the fixed quantizer and only set a max quantizer, this helps
quite a bit with performance
- Change the deadline parameter of vp8enc to 1: This makes the encoder
go into real time mode, which will make it a lot faster
- Set cpu-used to 16, the maximum possible value.
- Set static-threshold to 1000, static-threshold is the motion detection
threshold, and while a value of 100 is recommended for screencasting in
the gstreamer documentation (see [1]), using 1000 appears to perform a
lot better and still outputs fairly good quality
- Set a larger buffer size than the default size, this seems to get a
bit more stability during high load scenarios

All in all, those changes make the pipeline drop no more frames when
recording at 30 FPS and 2K screen resolution. That was tested on a
fairly recent mobile core-i5 processor.

Also, because we now have two %T replacement strings for the number of
threads, we need to switch to replaceAll(). For that to work, we have to
put the %T matching expression into quotes.

[1] https://gstreamer.freedesktop.org/documentation/vpx/GstVPXEnc.html?gi-language=c#GstVPXEnc:static-threshold

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1633>
2021-05-04 13:45:57 +00:00
Simon Schneegans
a8a79c0333 extensionsService: Log error if preferences dialog failed to open
This is helpful for continuous integration checks to see whether the
preferences dialog of an extension can be opened successfully.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1830>
2021-05-01 21:07:36 +00:00