ec-node: WebTransport publish + web hang-watch

This commit is contained in:
every.channel 2026-02-16 12:54:42 -05:00
parent 791c7beee7
commit 339aef50e0
No known key found for this signature in database
19 changed files with 1355 additions and 2229 deletions

View file

@ -4,8 +4,12 @@ version = "0.0.0"
edition.workspace = true
license.workspace = true
[features]
default = []
ffmpeg-ffi = ["dep:ac-ffmpeg"]
[dependencies]
ac-ffmpeg = "0.19.0"
ac-ffmpeg = { version = "0.19.0", optional = true }
anyhow.workspace = true
blake3.workspace = true
ec-core = { path = "../ec-core" }

View file

@ -1,5 +1,6 @@
//! Deterministic chunking and transcode scaffolding.
#[cfg(feature = "ffmpeg-ffi")]
use ac_ffmpeg::format::{
demuxer::Demuxer,
io::IO,
@ -15,6 +16,7 @@ use std::fs;
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use std::process::{Child, Command, Stdio};
#[cfg(feature = "ffmpeg-ffi")]
use std::time::Duration;
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -202,6 +204,14 @@ pub fn collect_segments(output_dir: &Path) -> Result<ChunkManifest> {
})
}
#[cfg(not(feature = "ffmpeg-ffi"))]
pub fn probe_read_stream<T: Read>(_stream: T) -> Result<Vec<StreamProbe>> {
Err(anyhow!(
"probe_read_stream requires feature `ec-chopper/ffmpeg-ffi` (ac-ffmpeg) and FFmpeg headers"
))
}
#[cfg(feature = "ffmpeg-ffi")]
pub fn probe_read_stream<T: Read>(stream: T) -> Result<Vec<StreamProbe>> {
let io = IO::from_read_stream(stream);
let demuxer = Demuxer::builder()
@ -401,6 +411,19 @@ pub fn hash_file_blake3(path: &Path) -> Result<String> {
Ok(hasher.finalize().to_hex().to_string())
}
#[cfg(not(feature = "ffmpeg-ffi"))]
pub fn chunk_stream_ffmpeg<T: Read>(
_stream: T,
_output_dir: &Path,
_chunk_duration_ms: u64,
_max_chunks: Option<usize>,
) -> Result<TsChunkManifest> {
Err(anyhow!(
"chunk_stream_ffmpeg requires feature `ec-chopper/ffmpeg-ffi` (ac-ffmpeg)"
))
}
#[cfg(feature = "ffmpeg-ffi")]
pub fn chunk_stream_ffmpeg<T: Read>(
stream: T,
output_dir: &Path,
@ -610,6 +633,20 @@ pub fn manifest_for_ts_chunks(
Ok((body, hashed))
}
#[cfg(not(feature = "ffmpeg-ffi"))]
pub fn chunk_stream_ffmpeg_live<T: Read, F: FnMut(TsChunk) -> Result<()>>(
_stream: T,
_output_dir: &Path,
_chunk_duration_ms: u64,
_max_chunks: Option<usize>,
_on_chunk: F,
) -> Result<()> {
Err(anyhow!(
"chunk_stream_ffmpeg_live requires feature `ec-chopper/ffmpeg-ffi` (ac-ffmpeg)"
))
}
#[cfg(feature = "ffmpeg-ffi")]
pub fn chunk_stream_ffmpeg_live<T: Read, F: FnMut(TsChunk) -> Result<()>>(
stream: T,
output_dir: &Path,