Skip to content

Commit

Permalink
sound/pipewire: destroy multiple pipewire streams that are not destroyed
Browse files Browse the repository at this point in the history
The PCM command transition prepare->prepare or set_param->prepare
is allowed by the specification. however this type of transition
in pipewire lead to multiple creation of pipewire streams that are
not destroyed. This PR ensures that in a case like this,
when the prepare fn() in the pipewire backend is called multiple
times without the release fn(), there should be only one pipewire stream.

Close rust-vmm#490

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
  • Loading branch information
Dorinda Bassey committed Apr 2, 2024
1 parent 04998a9 commit 3ac8921
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vhost-device-sound/src/audio_backends/pipewire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ impl AudioBackend for PwBackend {

let params = &stream_params[stream_id as usize].params;

if let Some(stream) = stream_hash.get(&stream_id) {
stream.disconnect().expect("could not disconnect stream");
stream_hash.remove(&stream_id);
stream_listener.remove(&stream_id);
}

let mut pos: [u32; 64] = [SPA_AUDIO_CHANNEL_UNKNOWN; 64];

match params.channels {
Expand Down

0 comments on commit 3ac8921

Please sign in to comment.