pipewire/src/modules/module-protocol-pulse
Barnabás Pőcze 0753e992b8 pulse-server: improve reference counting of samples
Previously, when a sample is "committed" from an upload stream,
its reference count is set to 1. This is problematic if,
when the sample is committed for a second time, there are
streams playing the sample as the reference count will go out
of sync.

The problem can be easily triggered, especially with longer samples:

   pactl upload-sample a-long-sample.ogg
   pactl play-sample a-long-sample
   pactl play-sample a-long-sample
   pactl upload-sample a-long-sample.ogg  # while playing

When the first stream finishes playing, it will free the sample,
which can cause problems e.g. for the second stream playing the
sample at that very moment.

Fix that by decoupling the buffer from the sample and making
the buffer reference counted. And remove the reference counting
from the samples as it is no longer needed.

Futhermore, previously, the reference counts were ignored
when the removal of a sample was requested. That is fixed
as well.

The previous issue can be triggered easily as well:

  pactl upload-sample a-long-sample.ogg
  pactl play-sample a-long-sample
  pactl remove-sample a-long-sample      # while playing

Fixes #1953
2021-12-26 19:37:41 +00:00
..
extensions pulse-server: compile extensions separately 2021-10-18 15:36:17 +02:00
modules pulse-server: use safer spa_scnprintf 2021-12-22 21:34:29 +01:00
client.c pulse-server: client: add 'disconnect' event 2021-12-26 19:37:41 +00:00
client.h pulse-server: client: add 'disconnect' event 2021-12-26 19:37:41 +00:00
collect.c modules: switch a few modules to the new property helpers 2021-10-13 07:12:00 +00:00
collect.h pulse-server: set the SINK_SET_FORMATS flag 2021-09-01 13:24:50 +02:00
commands.h pulse-server: split out commands 2021-06-25 03:22:56 +02:00
dbus-name.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
dbus-name.h pulse-server: split out D-Bus parts 2021-06-25 03:23:09 +02:00
defs.h pulse-server: increase buffer size 2021-12-14 15:42:19 +01:00
extension.c pulse-server: use for-each loop 2021-10-18 15:36:22 +02:00
extension.h pulse-server: split out extension handling 2021-06-25 03:23:35 +02:00
format.c pulse-server: fix the number of enum values 2021-12-20 09:13:37 +01:00
format.h pulse-server: add device-restore extension 2021-09-01 13:23:10 +02:00
internal.h pulse-server: improve latency setup a little 2021-11-04 18:07:30 +01:00
log.h modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
manager.c Only handle -EPIPE eerrors. 2021-11-10 19:26:03 +00:00
manager.h pipewire-pulse: add manager disconnect event 2021-11-10 19:26:03 +00:00
media-roles.c pulse-server: split out media roles 2021-06-25 03:23:20 +02:00
media-roles.h pulse-server: split out media roles 2021-06-25 03:23:20 +02:00
message-handler.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
message-handler.h pulse-server: split out message-handler 2021-06-25 03:23:41 +02:00
message.c pulse-server: add size check when reading strings 2021-11-25 10:14:30 +01:00
message.h pulse-server: split out message handling 2021-06-25 03:23:24 +02:00
module.c pulse-server: handle if the module is destroyed while loading 2021-12-26 19:37:41 +00:00
module.h pulse-server: handle if the module is destroyed while loading 2021-12-26 19:37:41 +00:00
operation.c pulse-server: try to not put pointers in info messages 2021-11-05 16:22:22 +01:00
operation.h pulse-server: split out reply, operation, client, stream 2021-06-25 03:23:27 +02:00
pending-sample.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
pending-sample.h pulse-server: split out pending-sample 2021-06-25 03:23:15 +02:00
pulse-server.c pulse-server: improve reference counting of samples 2021-12-26 19:37:41 +00:00
pulse-server.h pulse-server: add missing forward declarations 2021-06-25 03:24:00 +02:00
quirks.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
quirks.h pipewire-pulse: implement simple quirk database 2021-06-30 17:17:36 +02:00
reply.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
reply.h pulse-server: split out reply, operation, client, stream 2021-06-25 03:23:27 +02:00
sample-play.c pulse-server: improve reference counting of samples 2021-12-26 19:37:41 +00:00
sample-play.h pulse-server: split out sample, sample-play 2021-06-25 03:23:12 +02:00
sample.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
sample.h pulse-server: improve reference counting of samples 2021-12-26 19:37:41 +00:00
server.c pulse-server: client: restructure message handling 2021-12-26 19:37:41 +00:00
server.h pulse-server: split out server creation and socket handling 2021-06-25 03:23:32 +02:00
stream.c pulse-server: stream: only remove from list if pending 2021-12-26 19:37:41 +00:00
stream.h pulse-server: stream: only remove from list if pending 2021-12-26 19:37:41 +00:00
utils.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
utils.h pulse-server: use pid_t where appropriate 2021-07-25 15:17:08 +02:00
volume.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
volume.h pulse-server: split out volume handling 2021-06-25 03:23:01 +02:00