mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2026-01-02 22:52:15 +00:00
sound/alsa: Release buffers even on RELEASE err
If a PCM_RELEASE control request comes from the guest and the state transition is invalid by spec standards, release the buffers anyway. This doesn't change the current behavior. When dealing with an unrelated vhost-user issue, the state transitions became invalid because of unexpected errors in the virto-snd driver. Making this change made the issue obvious while debugging. Plus, the spec does not state rejecting a PCM lifecycle control request if the transition is not possible. (The possible state transitions are non-normative statements.) Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
This commit is contained in:
parent
3921238555
commit
33c977cc0f
@ -425,15 +425,13 @@ impl AlsaBackend {
|
||||
msg.code = VIRTIO_SND_S_BAD_MSG;
|
||||
continue;
|
||||
};
|
||||
let release_result = streams.write().unwrap()[stream_id].state.release();
|
||||
if let Err(err) = release_result {
|
||||
if let Err(err) = streams.write().unwrap()[stream_id].state.release() {
|
||||
log::error!("Stream {} release {}", stream_id, err);
|
||||
msg.code = VIRTIO_SND_S_BAD_MSG;
|
||||
} else {
|
||||
senders[stream_id].send(false).unwrap();
|
||||
let mut streams = streams.write().unwrap();
|
||||
std::mem::take(&mut streams[stream_id].buffers);
|
||||
}
|
||||
senders[stream_id].send(false).unwrap();
|
||||
let mut streams = streams.write().unwrap();
|
||||
std::mem::take(&mut streams[stream_id].buffers);
|
||||
}
|
||||
AlsaAction::SetParameters(stream_id, mut msg) => {
|
||||
if stream_id >= streams_no {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user