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
|
.await
|
||||||
.context("failed to create moq-transport publisher")?;
|
.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.
|
// Spawn ffmpeg to generate fMP4 suitable for hang/moq-mux.
|
||||||
// We keep this conservative and deterministic-ish by default:
|
// We keep this conservative and deterministic-ish by default:
|
||||||
// - single threaded x264
|
// - single threaded x264
|
||||||
|
|
@ -4344,10 +4354,13 @@ async fn wt_publish(args: WtPublishArgs) -> Result<()> {
|
||||||
});
|
});
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
res = session.run() => {
|
res = session_task => {
|
||||||
let _ = child.kill().await;
|
let _ = child.kill().await;
|
||||||
res.context("relay session error")?;
|
match res {
|
||||||
Ok(())
|
Ok(Ok(())) => Ok(()),
|
||||||
|
Ok(Err(err)) => Err(err).context("relay session error"),
|
||||||
|
Err(err) => Err(anyhow!("relay session join failed: {err}")),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res = decode_task => {
|
res = decode_task => {
|
||||||
match res {
|
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() => {
|
_ = tokio::signal::ctrl_c() => {
|
||||||
tracing::info!("ctrl-c; shutting down");
|
tracing::info!("ctrl-c; shutting down");
|
||||||
// Best-effort shutdown; the underlying QUIC session is dropped after kill.
|
// Best-effort shutdown; the underlying QUIC session is dropped after kill.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue