Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions crates/recording/src/output_pipeline/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,26 @@ fn spawn_video_encoder<TMutex: VideoMuxer<VideoFrame = TVideo::Frame>, TVideo: V
muxer: Arc<Mutex<TMutex>>,
timestamps: Timestamps,
) {
setup_ctx.tasks().spawn("capture-video", {
let stop_token = stop_token.clone();
async move {
video_source.start().await?;

stop_token.cancelled().await;

if let Err(e) = video_source.stop().await {
error!("Video source stop failed: {e:#}");
};

Ok(())
}
});

setup_ctx.tasks().spawn("mux-video", async move {
use futures::StreamExt;

let mut first_tx = Some(first_tx);

video_source.start().await?;

stop_token
.run_until_cancelled(async {
while let Some(frame) = video_rx.next().await {
Expand All @@ -432,8 +445,6 @@ fn spawn_video_encoder<TMutex: VideoMuxer<VideoFrame = TVideo::Frame>, TVideo: V
})
.await;

video_source.stop().await.context("video_source_stop")?;

muxer.lock().await.stop();

Ok(())
Expand Down
Loading