Commit graph

9425 commits

Author SHA1 Message Date
Wim Taymans
56b03cb3a8 pulse-server: update requested for relative seek only
PulseAudio only updates the requested amount of bytes for relative
seeks, do the same.

See #2680
2022-09-10 16:06:45 +02:00
Wim Taymans
0d08f41c28 alsa: calculate elapsed time only when running 2022-09-09 18:13:02 +02:00
Wim Taymans
ca228003c4 alsa: only calculate elapsed time when known 2022-09-09 18:11:23 +02:00
Wim Taymans
5fb361724c alsa: rework timings
Collect all timing info in the process function. When doing delay
reporting, get a consistent snapshot of all the pipewire side state to
calculate the result.

This should result in more correct timing results.
2022-09-09 17:59:07 +02:00
Wim Taymans
da9a5cfa5d alsa: subtract elapsed time from server delay only
Only subtract the elapsed time from the server delay. Our reported
delay should always at least still include the data that we have
buffered or else read and write operations might think they can read
or write more than they actually can.
2022-09-09 16:36:33 +02:00
Wim Taymans
f58021ed45 alsa: improve elapsed time correction
There is no need to patch the pw_time values with the io->rate just so
we can use it to convert the elapsed time to samples. Use the io->rate
directly instead.
2022-09-09 16:34:18 +02:00
Wim Taymans
41e937e3fd alsa: add some more debug 2022-09-09 16:33:01 +02:00
Wim Taymans
633f9c2d5e module-rt: only call set_rlimit once
We can call this once after we know that we can use RTKit to get
the limits or not.
2022-09-09 15:27:26 +02:00
Wim Taymans
009e61f585 alsa: improve debug 2022-09-09 12:22:08 +02:00
Barnabás Pőcze
e9b5cc405e pipewire: rtsp-client: read message content properly
Make the receiving state machine more pronounced by explicitly storing
the state in the client. Furthermore, always consume the message content
if there is one and not only if the content type is "application/octet-stream",
but do not try to do it at once - like previously, instead only as the
socket becomes readable. The body is currently dropped, but it could
easily be collected in e.g. a `pw_array` should the need ever arise.

See #2673
2022-09-09 01:47:51 +02:00
Barnabás Pőcze
9b63c5011d pipewire: rtsp-client: check if the status code code is a number 2022-09-09 01:47:51 +02:00
Barnabás Pőcze
56df6fed13 pipewire: rtsp-client: reset receive state when connected
Previously, the state used to receive messages from the remote
end was not reset when the client connected, which could
lead to issues if the same client is reused for multiple
connections.
2022-09-09 01:47:51 +02:00
Barnabás Pőcze
2d7eb8678b pipewire: rtsp-client: allow sending arbitrary binary data
Previously, the content had to be a null-terminated byte
sequence because the sending function used `strlen()` to
determine its length. However, `rtsp_do_auth_setup()` needs
to send a non-textual byte sequence, and it only worked so
far because it did not happen to have any zero bytes in it.
Add a "content_length" parameter and change the type of
"content" to facilitate sending arbitrary byte sequences.
2022-09-09 01:47:51 +02:00
Barnabás Pőcze
e5ca5d0480 pipewire: rtsp-client: use tabs for indentation 2022-09-09 01:47:51 +02:00
Barnabás Pőcze
56c4aca5d9 pipewire: rtsp-client: remove unused "session" member 2022-09-09 01:47:51 +02:00
Barnabás Pőcze
36589039f4 pipewire: rtsp-client: make request CSeq uint32_t 2022-09-09 01:47:51 +02:00
Barnabás Pőcze
4bb8efd100 pipewire: module-raop-sink: simplify rtsp_do_auth_setup()
Rename "output" to "content" and mark it static and const,
and remove the "ret" variable.
2022-09-09 01:47:51 +02:00
Maxim Mikityanskiy
853a1c0ba8 module-rt: Fix setting realtime priority with rtkit
The commit cited below mistakenly removed the set_rlimit call from under
`if (impl->use_rtkit)`, saying it doesn't have an rtkit implementation.
However, this function does call rtkit, so it has to be called in the
rtkit flow, otherwise pipewire fails to set the realtime priority,
printing the following error message:

mod.rt: RTKit error: org.freedesktop.DBus.Error.AccessDenied
mod.rt: could not make thread #### realtime using RTKit: Permission denied

Fixes: 5ae1c03d77 ("module-rt: small fixes")
2022-09-08 20:03:56 +03:00
Jonas Holmberg
70c314f254 pw-top: Print microseconds as "us"
Avoid unicode characters in the columns since it breaks formatting on
non-unicode hosts.
2022-09-08 16:31:48 +02:00
Wim Taymans
a7c28d64ae resample-peaks: small improvement
Makes it easier for the compiler to make a constant.
2022-09-08 15:40:01 +02:00
Wim Taymans
46c8c9ec03 audioconvert: set monitor port buffer size correctly
Also use quantum_limit samples on the monitor ports.

Fixes #2677
2022-09-08 12:25:28 +02:00
Wim Taymans
900621ba9e impl-node: only activate input links after adding node
Only activate the input links to a node after the node has been added to
the graph.

This ensure that we don't accidentaly schedule the node before the Start
command has completed and the node is actually ready to process data.
2022-09-08 11:18:08 +02:00
Wim Taymans
ff84acdf3d impl-node: avoid scheduling the node before added
The Start command might be async and we should not schedule the node
until the reply has arrived and we have actually added the node to
the graph.

Otherwise it is possible that the node is scheduled before it could
complete the start command. This could be a problem for adapter because
it does negotiation and so on in the Start call.

See #2677
2022-09-08 10:31:46 +02:00
Barnabás Pőcze
27211856eb pulse-server: Handle overlong writes from clients
When a client writes more then requested, let the requested field go
negative so that it is taken into account the next time we ask for more
data.

Also the requested field follows the difference in the write pointer
caused by seeks.

See #2626
Fixes #2674
2022-09-08 09:14:19 +02:00
Wim Taymans
d5bc6aa2cb Revert "pulse-server: Handle clients that send more than requested"
This reverts commit a79b5c86ea.
2022-09-08 09:06:02 +02:00
Wim Taymans
903f831b2d alsa: scale min value back to nominal rate 2022-09-07 23:39:51 +02:00
Wim Taymans
7057cca05e alsa: adjust min and max rates
Use the DSD scaler and interleave factors to calculate the min and
max rates.
2022-09-07 21:58:32 +02:00
Wim Taymans
955815b468 alsa: only scale DSD samplerates 2022-09-07 21:42:45 +02:00
Wim Taymans
68581235ae alsa: fix min dsd rate
We just need to allow from DSD64 onwards. Remove some unused fields.
2022-09-07 20:23:53 +02:00
Wim Taymans
72b6788c68 alsa: don't set impossible rates
When the max rate is smaller than the min rate, don't add the DSD
format at all because it is not possible to play it.

See #93
2022-09-07 19:58:30 +02:00
Wim Taymans
23522651f9 alsa: dsd rates are expressed in byte rate
DSD64 would be a rate of 44100 * 64 / 8. When packed in U32_BE, we would
negotiate 44100 * 8 / 4 (88200) with the device, this means all rates
from 88200 and up are allowed for DSD64 in U32_BE.
2022-09-07 19:54:09 +02:00
Wim Taymans
c9ee142b78 resample-peaks: unroll loop a little 2022-09-07 16:18:58 +02:00
Wim Taymans
187006f30e audioconvert: remove some double defines 2022-09-07 16:08:21 +02:00
Wim Taymans
6e9e02b420 audioconvert: refactor peaks resampler
Use common code in macro and generate arch specific version.
Compile with -Ofast to optimize some fmaxf calls.
2022-09-07 16:00:31 +02:00
Wim Taymans
a79b5c86ea pulse-server: Handle clients that send more than requested
A client can sometimes send more data than we requested. PulseAudio
keeps the extra data around, it just asks for more data when it consumed
some of it.

PipeWire however always tries to keep tlength worth of data, as
specified in the PulseAudio docs... Keep track of how much extra data
has been sent and keep this around as well. Make sure we flush this
extra data as well.

Fixes #2626
2022-09-07 13:07:28 +02:00
Wim Taymans
50f76c8730 pulse-server: implement TRIGGER and PREBUF methods
Start and stop prebuf.
2022-09-07 13:02:55 +02:00
Wim Taymans
968bc382af log: initialize pos to help the compiler
Although pos will be set to 0 in the first iteration, the compiler does
not seem to figure this out, so help it a little:

../spa/include/spa/support/log.h:306:21: warning: ‘pos’ may be used uninitialized [-Wmaybe-uninitialized]
  306 |                 pos += sprintf(str + pos, "%02x ", buf[i]);                             \
      |                     ^~
../spa/include/spa/support/log.h:301:13: note: ‘pos’ was declared here
  301 |         int pos;                                                                        \
      |             ^~~
2022-09-07 09:17:19 +02:00
Frédéric Danis
2c72597271 bluez5: Use spa_log_hexdump() to dump media properties/configuration 2022-09-07 07:50:23 +02:00
Frédéric Danis
1d39ea004e log: Add spa_log_hexdump 2022-09-07 07:50:23 +02:00
Wim Taymans
75af02edcd stream: add Format and EnumFormat on stream nodes
The stream only has one format/enumformat list for the one port it has
so also expose this on the node. We can then remove the adapter for
video.

We can also now show midi (control) streams as the format in pw-top.
2022-09-06 20:42:19 +02:00
Wim Taymans
5b2b93f915 alsa: add period-size, period-num and headroom in props
Add the currently configured alsa hw_params in the properties for
easier access.
2022-09-06 20:16:29 +02:00
Wim Taymans
32421965c7 stream: add a video adapter for video streams
The vidweo adapter is in passthrough but allows us to query the
node for the formats, which then show up in pw-top.
2022-09-06 19:06:10 +02:00
Wim Taymans
e9b7667b55 pw-top: remove some slashes to avoid confusion
Update man page
2022-09-06 18:32:56 +02:00
Wim Taymans
ffc09ce55e videoconvert: refresh with latest audioadapter copy 2022-09-06 17:48:00 +02:00
Wim Taymans
d90d2c92f4 man: update man page 2022-09-06 15:47:13 +02:00
Wim Taymans
76631e6251 pw-top: show negotiated formats
Add a column with negotiated formats.
It requires an adapter that will enumerate the port formats so it does
not work for video streams yet.

Fixes #2566
2022-09-06 15:36:58 +02:00
Wim Taymans
305f2104ee pulse-server: rework buffer attributes
Move the latency fraction calculation to fix_ functions so that the
new latency rate can be used when creating the streams.
Actually set the requested record attributes on the stream instead
of modifying the defaults.

See #2671
2022-09-06 11:53:51 +02:00
Wim Taymans
8efc221fa8 man: clarify MIDI and DSD playback
These tools don't render MIDI or DSD, you need separate tools or
hardware for that.
2022-09-06 10:03:52 +02:00
Wim Taymans
1a915c2ced pulse-server: set record attributes more like PulseAudio
PulseAudio assigns half of the fragsize to the source latency.
PulseAudio sends in chunks up to a fixed limit.

Checked against #2418
2022-09-05 18:13:12 +02:00
Wim Taymans
ad06db91ee Revert "pulse-server: send chunks with half the fragsize"
This reverts commit e10305851d.

If causes some regressions: see #2671
2022-09-05 16:19:42 +02:00