fix: disable HLS-LL
All checks were successful
continuous-integration/drone Build is passing

fix: thumb.webp path
This commit is contained in:
2025-06-13 13:05:23 +01:00
parent 047b3fec59
commit 338d351727
2 changed files with 29 additions and 12 deletions

View File

@ -97,6 +97,8 @@ pub struct HlsVariant {
packets_written: u64, packets_written: u64,
/// Reference stream used to track duration /// Reference stream used to track duration
ref_stream_index: i32, ref_stream_index: i32,
/// HLS-LL: Enable LL-output
low_latency: bool,
/// LL-HLS: Target duration for partial segments /// LL-HLS: Target duration for partial segments
partial_target_duration: f32, partial_target_duration: f32,
/// HLS-LL: Current partial index /// HLS-LL: Current partial index
@ -281,6 +283,7 @@ impl HlsVariant {
current_partial_index: 0, current_partial_index: 0,
current_partial_duration: 0.0, current_partial_duration: 0.0,
next_partial_independent: false, next_partial_independent: false,
low_latency: false,
}) })
} }
@ -322,7 +325,8 @@ impl HlsVariant {
} }
// HLS-LL: write prev partial segment // HLS-LL: write prev partial segment
if self.current_partial_duration >= self.partial_target_duration as f64 { if self.low_latency && self.current_partial_duration >= self.partial_target_duration as f64
{
self.create_partial_segment()?; self.create_partial_segment()?;
// HLS-LL: Mark next partial as independent if this packet is a keyframe // HLS-LL: Mark next partial as independent if this packet is a keyframe
@ -345,8 +349,10 @@ impl HlsVariant {
if pts_diff > 0 { if pts_diff > 0 {
let time_delta = pts_diff as f64 * av_q2d((*pkt).time_base); let time_delta = pts_diff as f64 * av_q2d((*pkt).time_base);
self.duration += time_delta; self.duration += time_delta;
if self.low_latency {
self.current_partial_duration += time_delta; self.current_partial_duration += time_delta;
} }
}
self.end_pts = (*pkt).pts; self.end_pts = (*pkt).pts;
} }
@ -588,10 +594,12 @@ impl HlsVariant {
byte_range_length: None, byte_range_length: None,
})); }));
} }
pl.version = Some(6); pl.version = Some(if self.low_latency { 6 } else { 3 });
if self.low_latency {
pl.part_inf = Some(PartInf { pl.part_inf = Some(PartInf {
part_target: self.partial_target_duration as f64, part_target: self.partial_target_duration as f64,
}); });
}
pl.media_sequence = self pl.media_sequence = self
.segments .segments
.iter() .iter()
@ -600,7 +608,6 @@ impl HlsVariant {
_ => None, _ => None,
}) })
.unwrap_or(self.idx); .unwrap_or(self.idx);
// For live streams, don't set end list
pl.end_list = false; pl.end_list = false;
let mut f_out = File::create(self.out_dir().join("live.m3u8"))?; let mut f_out = File::create(self.out_dir().join("live.m3u8"))?;

View File

@ -229,17 +229,27 @@ impl ZapStreamOverseer {
pubkey: &Vec<u8>, pubkey: &Vec<u8>,
) -> Result<Event> { ) -> Result<Event> {
// TODO: remove assumption that HLS is enabled // TODO: remove assumption that HLS is enabled
let base_streaming_path = PathBuf::from(HlsEgress::PATH).join(stream.id.to_string());
let extra_tags = vec![ let extra_tags = vec![
Tag::parse(["p", hex::encode(pubkey).as_str(), "", "host"])?, Tag::parse(["p", hex::encode(pubkey).as_str(), "", "host"])?,
Tag::parse([ Tag::parse([
"streaming", "streaming",
self.map_to_public_url(base_streaming_path.join("live.m3u8").to_str().unwrap())? self.map_to_public_url(
PathBuf::from(HlsEgress::PATH)
.join(stream.id.to_string())
.join("live.m3u8")
.to_str()
.unwrap(),
)?
.as_str(), .as_str(),
])?, ])?,
Tag::parse([ Tag::parse([
"image", "image",
self.map_to_public_url(base_streaming_path.join("thumb.webp").to_str().unwrap())? self.map_to_public_url(
PathBuf::from(stream.id.to_string())
.join("thumb.webp")
.to_str()
.unwrap(),
)?
.as_str(), .as_str(),
])?, ])?,
Tag::parse(["service", self.map_to_public_url("api/v1")?.as_str()])?, Tag::parse(["service", self.map_to_public_url("api/v1")?.as_str()])?,