Commit graph

5579 commits

Author SHA1 Message Date
Wim Taymans
6370d75efd json: init value to ->cur instead of NULL
Or else we end up with a return value of ->cur - NULL, which might look
lik a positive result and cause a crash later on.

Fixes #641
2021-01-29 09:18:59 +01:00
Jakub Adam
c64bf36e8e gst: avoid crash with zero SPA_PARAM_BUFFERS_size
With sending and receiving pipelines:

  gst-launch videotestsrc ! tee !  pipewiresink mode=provide

  gst-launch pipewiresrc path=<node_id> ! videoconvert ! autovideosink

The first pipeline crashes when the other connects.

It happens because SPA_PARAM_BUFFERS_size passed to
pw_stream_update_params() upon pipewiresink's buffer pool activation is
zero. As a consequence, in gst_pipewire_pool_wrap_buffer(), d->type will
be SPA_ID_INVALID and the created GstBuffer will have no memory
appended. This ultimately leads to segfault in do_send_buffer().

If size hasn't been set in GstPipeWirePool's config before the
first buffer is to be rendered by pipewiresink, configure the pool with
the size of that first incoming buffer and activate the pool.
2021-01-28 20:50:07 +01:00
Wim Taymans
f8d57d03ca pulse-server: keep separate counter for missing bytes
And only increment when consumed from ringbuffer. In underrun we
play silence and don't ask for the missing bytes.

Fixes #616
2021-01-28 20:00:48 +01:00
Wim Taymans
09f423922d pulse-server: don't crash when alloc fails 2021-01-28 19:30:32 +01:00
Wim Taymans
0b69b92dc8 json: init value with NULL
Fixes #641
2021-01-28 19:19:59 +01:00
Wim Taymans
8636c509f5 pulser-server: revert attempt to flush more
size is later used as the buffer size and might be too large.
2021-01-28 19:17:50 +01:00
Wim Taymans
b65b291bb2 pulse-server: make sure to count played samples
On underrun we need to keep on counting playing_for so fill this
in underrun and don't add this to missing to avoid double counting.

See #639
2021-01-28 18:59:03 +01:00
Wim Taymans
ac3555d6fc pulse-server: skip underrun more aggressively
Skip all of the underrun bytes immediately.

See #638
2021-01-28 17:56:32 +01:00
Wim Taymans
e172effe71 pulse-server: log the amount of underrun bytes 2021-01-28 17:56:07 +01:00
Jonas Holmberg
0ccad38df1 alsa-pcm: Fix target calculation
Use threshold instead of last_threshold so that early wakeup is detected
in handle_capture() when duration changes.
2021-01-28 16:18:35 +00:00
Wim Taymans
c0ed88f2f9 media-session: always try to activate the saved profile
When the current profile is not the saved profile, check if the
saved profile is available again and try to activate it.
2021-01-28 16:56:27 +01:00
Wim Taymans
f03deb5324 media-session: try to avoid switching away from hdmi
When HDMI goes to sleep the profile becomes unavailable. Avoid
switching to Off in that case.
2021-01-28 15:41:14 +01:00
Wim Taymans
fc08c79dad media-session: start timeout only when something changed 2021-01-28 14:36:29 +01:00
Wim Taymans
072d3a191c media-session: keep track of all active routes
Keep track of active profile in default-routes so that we can restore
the prefered routes later.
Keep track of all active routes in an array. There can be more than
one active route per direction.
New routes will get their volume restored. Route changes will be saved.
2021-01-28 14:28:46 +01:00
Wim Taymans
b8bac95dad media-session: add info logging to profile restore logic 2021-01-28 11:43:17 +01:00
Wim Taymans
b2e4f1358d bluez5: clean up some profile names 2021-01-27 20:50:23 +01:00
Wim Taymans
7fa1833310 bluez5: use function to get profile name 2021-01-27 20:39:02 +01:00
Nicolai Syvertsen
ebcdfe8f5d pipewire-pulse: better default null sink description
This includes the sink_name and media class.
2021-01-27 19:09:21 +01:00
Nicolai Syvertsen
c092f0c1c4 pipewire-pulse: null sink must have a description
Certain pulseaudio clients crash if this is unset
2021-01-27 15:31:54 +00:00
Wim Taymans
5dc2a7b793 policy-node: reverse config direction for virtual devices
For a virtual source we want to configure it like a sink with
input ports and the monitor ports as the capture ports.
2021-01-27 16:27:06 +01:00
Wim Taymans
295cba8404 policy-node: a virtual source is an output node 2021-01-27 16:14:39 +01:00
Wim Taymans
82bc0710f0 media-session: use a default volume if unknown
Set a safe volume when there is no previously saved volume.
2021-01-27 15:44:52 +01:00
Wim Taymans
0be851739f improve config parsing
Use get_string to get object keys in a more generic way.
2021-01-27 15:36:32 +01:00
Wim Taymans
fc68e901e5 pulse-server: don't count playing in underrun 2021-01-27 15:33:01 +01:00
Wim Taymans
585f533d27 media-session: move profile selection to media-session
Disable automatic profile selection in the acp device
Implement selection of profiles in the default-profile module
2021-01-27 13:48:10 +01:00
Wim Taymans
3312757706 acp: use auto-profile and auto-port properties
Also disable initial automatic profile selection when auto-profile
is set to false
2021-01-27 13:48:10 +01:00
Wim Taymans
64b078d7bb acp: fix port and profile name lookup 2021-01-27 13:48:10 +01:00
Wim Taymans
cf35e52586 media-session: use the right define for the bitmask 2021-01-27 13:48:10 +01:00
Wim Taymans
47d59ac4d9 pulse-server: improve debug 2021-01-27 13:48:10 +01:00
Wim Taymans
cdce04bdb1 jack-device: set node.description
Some apps crash when it's not set
2021-01-27 13:48:10 +01:00
jasker5183
ccf2254b6b Update libasound_module_pcm_pipewire.so location for Ubuntu 2021-01-26 16:40:42 +00:00
Jonas Holmberg
30848ada6b alsa-pcm: Change resync warning to info
Do not print a warning when a client with custom latency disconnects.
2021-01-26 15:46:23 +01:00
Wim Taymans
fbb5dad6d1 alsa: bundle param changes
Only poll events and set_param can cause a param changed events.
Keep track of all the changes in the param user data and at the
end of the poll/set_param emit one notification for all changed
params.
2021-01-25 17:06:54 +01:00
Wim Taymans
c95bd1c3d4 media-session: avoid restoring an unavailable profile 2021-01-25 16:00:20 +01:00
Wim Taymans
98a3527685 media-session: init current_profile to invalid
So that we can detect a switch..
2021-01-25 15:53:54 +01:00
Wim Taymans
30d568403c bluez5: mark profiles as available 2021-01-25 15:53:36 +01:00
Wim Taymans
26d5fe373e bluez5: fix mute
Actually remember the mute state and use this when reporting our
state.

See #559
2021-01-25 15:21:23 +01:00
Wim Taymans
39f082fc86 default-profile: don't try to restore bluetooth profiles 2021-01-25 13:17:22 +01:00
Wim Taymans
b3f728b1a0 bluez5: set device.bus to bluetooth 2021-01-25 13:07:31 +01:00
Wim Taymans
3366eeb65e media-session: restore route volumes
Follow the active input/output routes. If the route changes, restore
the previously saved settings. If only the properties change, save
them to be restored later.

Fixes #402
2021-01-25 12:11:16 +01:00
Wim Taymans
ebf324590b pod: handle various ways of making empty array/choice
Make it possible to make empty array/choice
Handle empty array/choice
Add some tests to make empty arrays/choice objects
2021-01-25 10:55:30 +01:00
Wim Taymans
c913abffef pulse-server: Fix underrun check
We're underrun when we can't produce the required number of samples.

See #617
2021-01-24 20:33:30 +01:00
Wim Taymans
96d98c7955 pulse-server: express latency in samples in all cases 2021-01-24 20:33:30 +01:00
jasker5183
b44cb0a897 Add bluetooth issue.md 2021-01-23 12:49:06 +00:00
Pauli Virtanen
59452a0904 pulse-server: send server change events when default nodes change
Send server change events to subscribers, when default nodes change due
to some nodes being added/removed/changed, also if there is no metadata
change.  Make sure the event is consistent with the result from
find_device at the time.

Previously, these were not necessarily sent, or information from
find_device immediately after the event might not reflect the change
yet.
2021-01-23 07:17:19 +01:00
Sami Farin
906a1f5448 Make getrandom() failure fatal 2021-01-23 07:15:55 +01:00
Pauli Virtanen
8b4fbac187 sco-sink: msbc timeout should follow processed samples
Remove wrong adjustment to the write timeout with mSBC.

The time between writes should be the 7.5ms at which we encode, which is
correct even when the frames get fragmented to incommensurate tx packets
(on USB BT adapters).

Fixes sound on RTL8176B. This adapter has large reported write_mtu, so
the wrong delay affected it.
2021-01-22 23:11:17 +02:00
Wim Taymans
14dcfb8a28 pulse-server: find the target device in play_sample
Use the regular logic to find the target device for play sample so
that it supports @DEFAULT_SINK@ etc.

See #612
2021-01-22 19:53:46 +01:00
Wim Taymans
1eb9d73814 bluez5: skip routes without a profile 2021-01-22 17:35:27 +01:00
Wim Taymans
2b98b7dc7a pw-dump: print None pod as null 2021-01-22 17:23:33 +01:00