Skip to content

Commit 1e7e0fa

Browse files
committed
vhost-device-sound: improve error handling in gst
- Replace some unwrap/expect with proper Result handling - Add GstError to handle GstreamerBackend init fail Signed-off-by: nicholasdezai <[email protected]>
1 parent 750f7d3 commit 1e7e0fa

File tree

2 files changed

+82
-52
lines changed

2 files changed

+82
-52
lines changed

vhost-device-sound/src/audio_backends.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ pub fn alloc_audio_backend(
6767
#[cfg(all(feature = "alsa-backend", target_env = "gnu"))]
6868
BackendType::Alsa => Ok(Box::new(AlsaBackend::new(streams))),
6969
#[cfg(all(feature = "gst-backend", target_env = "gnu"))]
70-
BackendType::GStreamer => Ok(Box::new(GStreamerBackend::new(streams))),
70+
BackendType::GStreamer => {
71+
Ok(Box::new(GStreamerBackend::new(streams).map_err(|err| {
72+
crate::Error::UnexpectedAudioBackendError(err.into())
73+
})?))
74+
}
7175
}
7276
}
7377

0 commit comments

Comments
 (0)