ec-node: announce before ingest loop
This commit is contained in:
parent
c3579ac917
commit
806d8ed84d
1 changed files with 16 additions and 8 deletions
|
|
@ -4259,6 +4259,16 @@ async fn wt_publish(args: WtPublishArgs) -> Result<()> {
|
|||
.await
|
||||
.context("failed to create moq-transport publisher")?;
|
||||
|
||||
tracing::info!("announcing track(s)");
|
||||
publisher
|
||||
.announce(reader)
|
||||
.await
|
||||
.context("publisher announce failed")?;
|
||||
|
||||
// Run the relay session pump in the background; publishing happens by writing objects to
|
||||
// the track writer via moq-pub's fMP4 parser.
|
||||
let session_task = tokio::spawn(async move { session.run().await });
|
||||
|
||||
// Spawn ffmpeg to generate fMP4 suitable for hang/moq-mux.
|
||||
// We keep this conservative and deterministic-ish by default:
|
||||
// - single threaded x264
|
||||
|
|
@ -4344,10 +4354,13 @@ async fn wt_publish(args: WtPublishArgs) -> Result<()> {
|
|||
});
|
||||
|
||||
tokio::select! {
|
||||
res = session.run() => {
|
||||
res = session_task => {
|
||||
let _ = child.kill().await;
|
||||
res.context("relay session error")?;
|
||||
Ok(())
|
||||
match res {
|
||||
Ok(Ok(())) => Ok(()),
|
||||
Ok(Err(err)) => Err(err).context("relay session error"),
|
||||
Err(err) => Err(anyhow!("relay session join failed: {err}")),
|
||||
}
|
||||
}
|
||||
res = decode_task => {
|
||||
match res {
|
||||
|
|
@ -4368,11 +4381,6 @@ async fn wt_publish(args: WtPublishArgs) -> Result<()> {
|
|||
}
|
||||
}
|
||||
}
|
||||
res = publisher.announce(reader) => {
|
||||
let _ = child.kill().await;
|
||||
res.context("publisher announce failed")?;
|
||||
Ok(())
|
||||
}
|
||||
_ = tokio::signal::ctrl_c() => {
|
||||
tracing::info!("ctrl-c; shutting down");
|
||||
// Best-effort shutdown; the underlying QUIC session is dropped after kill.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue