Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipewire 1.0.7 #78

Open
wants to merge 151 commits into
base: master_jammy
Choose a base branch
from
Open

Pipewire 1.0.7 #78

wants to merge 151 commits into from

Conversation

mmstick
Copy link
Member

@mmstick mmstick commented Jul 17, 2024

Required by pop-os/wireplumber#19

pv and others added 30 commits February 12, 2024 10:39
When a memblock closes its fd, have it emit signal to other memblocks
possibly sharing the fd, so they know it is now invalid.

When a memblock has an invalidated fd, it'll not allow mapping more
memory, nor match against fd searches.

This avoids bugs where kernel fd reuse causes already invalid memblocks
to be used.  Generally, higher level code should make sure memblocks get
freed in right order so that this situation does not occur, but try to
keep mempool in consistent state regardless.
Props set on the node directly should also result in emission of changed
notify when required, just like we do for params set on the port.

This accidentally used to be done because stream_update_params()
unconditionally used to emit this for us. But commit
94cde30 changed that.

Fixes #3833
The remote end may destroy the port via client_node_port_update(),
before corresponding pw_impl_port_mix are released.

clear_port() removes all struct mix, but this prevents the
pw_impl_port_mix from being removed from io_map, which causes stale mix
ids be left in io_map, so we end up continuously allocating new io
areas.

Make lifecycle of io_map entries match port_init_mix/release_mix
exactly, separately from the lifecycle of the port and struct mix.

When freeing struct mix in port_release_mix(), make sure it corresponds
to the mix being released.
Avoid leaking buffers when freeing mix, in case the port was not cleared
properly.

These leaks don't seem to be occurring currently, but better be sure.
When the server closes the connection in non-interactive mode, we need
to set the quit flag to avoid going into second mainloop_run() that will
just block forever.

See #3837
These functions were using the object serial as the object id
Add a MAPPABLE data flag that hints that the fd in the data is mappable
with a simple mmap/munmap. Normally, DmaBuf is not mappable like that
unless explicitly indicated with this flag.

Set the MAPPABLE flag on the DmaBuf from v4l2 and libcamera fd.

When asked, mmap the buffer memory in all cases when the MAPPABLE
flag is set.

This solves the case where v4l2 has exported DmaBuf and is streaming to
node A and then node B links but doesn't get automatically mmaped
memory.

Fixes #3840
When we remove a global, we set NULL,NULL,NULL as its metadata. This
then results in the implementor of the metadata to emit the property
change event for the subject.

When we decide to propagate this event to the listeners we not only
need to check if the client can see the global but also if the global
was removed and this is a remove metadata event.

Fixes metadata remove events when a global is removed.
impl-metadata would not monitor for globals being removed.
This would cause stale metadata to remain in the
store, causing future objects on the same ids to have invalid data.
Propagate the errno values from syscalls and use them in the warning
messages to give info about what is going on.
don't leave the port and node names blank but fill in some defaults that
include the node/port id.
We would timestamp within an unlikely block, which would introduce
additional jitter to current_time, which would have an impact on
the performance of the timer sensitive code.
Because it's easy to do and avoids some runtime checks.
Make a rtprio-server and rtprio-client option. Leave the server
priority by default to 88 but lower client priority to 83. JACK
does something similar by setting clients to rtprio-server - 5.

Make module-rt use the client priority by default and bump the server
priority explicitly in the config file.

Leave the pulse-server to the default rtprio-client, there is no reason
to lower this any further because it is really just a regular client.

Bump the ffado packetizer thread to rtprio-server + 5 because that is
also what JACK does.

88 is still much higher than the value of 60 that JACK uses in
Fedora but now this is at least configurable.
Make a socket of the same address family as the address we're going to
bind it to.

When the source.ip is not specified, use the default in the same address
family as the sap.ip.

Probe the interface for addresses of the same family as the sap.ip.

Makes pactl load-module module-rtp-recv sap_address=:: work.

See #3851
Use the default source.ip from the same address family as the
destination.ip.

See #3851
Update doc/ from master branch.

tutorial: fix s16 scale and add some docs
doc: add 'Configuration' page
doc: disable deprecated list
doc: fix some doxygen warnings
doc: put new pulse modules to right place
doc: filter some constructs that confuse doxygen
doc: Fix typo 'statis' -> 'static'
doc: include pipewire-pulse modules explanations also on man page
doc: add pw-v4l2.1 and spa-*.1
doc: add pw-reserve.1
doc: internals/access: update documentation vs current state
If the originating source is IPv6, the A bit is set and the source is 16
bytes compared to 4 bytes for IPv4.

Fixes #3851
We need to load and apply the overrides in the order:

If absolute config path, use only that.
If environment variable, use only that.
Else
 /usr/share/pipewire/*.conf.d/
 /etc/pipewire/*.conf.d/
 $HOME/.config/pipewire/*.conf.d/

Before this patch we would first apply $HOME and then /etc and /usr,
which is not expected.
My making the phase into a float, the resampler can do finer grained
adjustments, which should improve the stability of adaptive
resampling
The rate we get from dlls can have a subsample precision. However,
the check for using process_copy is in sample precision. This means
that an adaptive stream will oscillate rather then lock into the
exact rate.
pobrn and others added 23 commits May 3, 2024 12:13
All pw_core event handlers (`on_core_*()`) currently receive a pointer
to `struct data`, not `struct proxy_data`; as can be seen from the
`pw_core_add_listener()` call in `main()`.

Fixes: cacdcc1 ("pw-mon: add filter param to hide props and/or params")
Fixes #3997
Using `g_autoptr` and related modern helpers more often makes
the code smaller, easier to follow and maintain.
No behavior changes intended.

(cherry picked from commit 594e3fa)
Some clients like many camera apps, including Cheese or Snapshot,
trigger a lot of unnessecary renegotiations. While arguably that should
be solved on a Gstreamer level, we can help out by checking if the
preferred new caps are the same that are already in use and skip the
renegotiation in this case.

This allows several apps to e.g. take pictures without a slow and heavy
stream restart.

(cherry picked from commit e2e8cf7)
gst_pad_get_current_caps may return NULL and passing that into
gst_caps_is_equal may result in fatal critical log due to the
"g_return_val_if_fail (GST_IS_CAPS (caps1)" check. Fix by checking for
NULL to avoid this.

(cherry picked from commit 95127d8)
Check for NULL when importing a buffer and log a message instead of
trying to deref the NULL pointer and crash.

Add some more logging to mem when importing a bad fd.

See #3998
Surrogate escapes must add not or 0x10000, as the specified bits go up
0xfffff.
`object::type` was not cleared in the error path. Fix that
by calling `object_destroy()`, which takes care of it.
`registry_event_global()` creates an `object` object for every object,
not just those matching `data::pattern`. However, previously
`registry_event_global_remove()` only destroyed those objects
that matched the given pattern. Fix that by destroying
every object.

Fixes #4001
Fixes 47e1f38 ("pw-dump: also dump object removal")
Libcamera formats are generally little-endian, matching DMA DRM
fourccs, while PW ones are big-endian. Thus we have to invert the
order.

Only RGB and BGR where tested, as these are the formats currently
supported by the software ISP. This fixes inverted red and blue in
Snapshot on the Librem5 and Pinephone (OG).

See also gstlibcamera-utils.cpp in libcamera.
Clear queued buffers when stopping consuming, to ensure that all buffers
are usable when we start again.

Do for A2DP as we already do for SCO.
We delay the audio a bit to keep packet intervals equal, which keeps
some data in buffers.

In theory the calculation keeps one buffer free, but it doesn't
explicitly keep "extra" buffer space so in theory might flush too late
and next process() might not have free buffers.  However, as we encode
next packet right away this shouldn't really occur...

Try to keep one extra spare buffer free so that the flush time is
certainly early enough.
The atomic operations were used in an attempt to limit the amount of
wakeups done on the eventfd. It's however racy and causes trouble in
some cases.

Remove the atomic operations all together, it's probably not worth
optimizing this too much.
The larger events need to be copied into the target buffer at the same
offset as the source buffer or else we overwrite the header and make
a corrupt buffer.
Avoid trying to remove a port before it has been added.
Add macro SPA_CMP to do 3-way comparisons safely, and use it to avoid
signed integer overflows.

Fix also float/double comparisons (previously 0.1 == 0.8 since cast to
return type int).

Fix Id/Bool comparisons so they can return negative value.
Handle allocation failure and size overflow.
It seems to be required to unselect it as default node in wireplumber.

Fixes #4023
@mmstick mmstick requested review from a team July 17, 2024 19:47
@gabriele2000
Copy link

Isn't this a bit "old" than 1.2.1?
I've got pipewire video capture on latest OBS that doesn't work because it's too outdated, I hope this version will not be still problematic...

@mmstick
Copy link
Member Author

mmstick commented Jul 17, 2024

Wireplumber requires a newer version of 1.0.X to build for Jammy. Meanwhile, 1.2.X has regressions which might be solved by a newer version of Wireplumber.

@jacobgkau jacobgkau self-assigned this Jul 17, 2024
Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one's working fine on pang12.

This does seem to break GNOME Shell screen recording more than it already was. There have already been some known issues with that, such as the cursor not showing up properly in the recording, and the recording only working once per GNOME Shell session unless the gjs process is manually killed. However, with this update, the recordings basically stop working entirely; they only seem to capture one or two frames, and produce a video that only lasts a split second (when played via MPV or VLC).

I've confirmed this regression occurs on multiple machines, on Intel, AMD, and NVIDIA graphics. The screen recorder worked on all three machines prior to the update, and no longer works after the update. I did notice that the filesize for the broken recordings are still comparable to the working ones. Based on the behavior in different video players, it seems likely this is some kind of reported framerate or other encoding error besides simply not saving the data.

The rest of regression testing passed. I could see a case for giving up on the built-in screen recording since it already worked poorly, but on the other hand, there has been a workaround available to at least make it work, and we know from issues such as pop-os/gnome-shell#134 that people are still using the functionality. For that reason, I think that should count as a blocker from a QA standpoint.

Full checklist:
  • Built-in speakers and microphone still work, volume adjustment still plays sound.
  • GNOME Sound Recorder still records and plays back.
  • Audacity records and plays back.
    • JACK mode
    • ALSA mode
  • DaVinci Resolve audio still works as expected (without lag) & shows up in pavucontrol.
    • Volume adjustment sounds stop working when Resolve is open, not a regression.
  • Ardour works in JACK mode, Bitwig works in native PipeWire mode.
  • Output via GPU (e.g. HDMI and DisplayPort audio) works.
    • Intel GPU system
    • NVIDIA GPU system
    • AMD GPU system
  • Headphone/microphone and combo headset both work.
  • Built-in GNOME Shell screen recording still works.
    • Option to show cursor is broken, stuck in top-left in recording (not a regression).
    • Only starts recording once per GNOME Shell restart (not a regression).
    • Only records for a brief instant (this is a regression).
  • Still able to share screen, webcam, and microphone via Jitsi in Firefox.
  • Bluetooth microphone input works with no stuttering.

@ianhundere
Copy link

any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.