Skip to content

Commit

Permalink
fix(source): HLS would not work if used directly. (#262)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Erk- authored Nov 15, 2024
1 parent 8eace22 commit 312799d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/input/sources/hls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -82,11 +87,11 @@ impl Compose for HlsRequest {
async fn create_async(
&mut self,
) -> Result<AudioStream<Box<dyn MediaSource>>, AudioStreamError> {
Err(AudioStreamError::Unsupported)
self.create()
}

fn should_create_async(&self) -> bool {
false
true
}
}

Expand Down

0 comments on commit 312799d

Please sign in to comment.