From 312799d2315493d79d18c44f9c873b1ea85876bb Mon Sep 17 00:00:00 2001 From: Erk Date: Fri, 15 Nov 2024 05:47:06 +0100 Subject: [PATCH] fix(source): HLS would not work if used directly. (#262) This changes HlsRequest to return true in Compose::should_create_async. This would otherwise cause it to be spawned on a thread without a executor causing it to panic. This would only cause issues if used directly since we otherwise use Compose::create in a context where we have access to the executor. --- src/input/sources/hls.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/input/sources/hls.rs b/src/input/sources/hls.rs index 69dc42691..171992560 100644 --- a/src/input/sources/hls.rs +++ b/src/input/sources/hls.rs @@ -16,6 +16,11 @@ use crate::input::{ }; /// Lazy HLS stream +/// +/// # Note: +/// +/// `Compose::create` for this struct panics if called outside of a +/// tokio executor since it uses background tasks. #[derive(Debug)] pub struct HlsRequest { /// HTTP client @@ -82,11 +87,11 @@ impl Compose for HlsRequest { async fn create_async( &mut self, ) -> Result>, AudioStreamError> { - Err(AudioStreamError::Unsupported) + self.create() } fn should_create_async(&self) -> bool { - false + true } }