File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
crates/recording/src/output_pipeline Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -405,13 +405,26 @@ fn spawn_video_encoder<TMutex: VideoMuxer<VideoFrame = TVideo::Frame>, TVideo: V
405405 muxer : Arc < Mutex < TMutex > > ,
406406 timestamps : Timestamps ,
407407) {
408+ setup_ctx. tasks ( ) . spawn ( "capture-video" , {
409+ let stop_token = stop_token. clone ( ) ;
410+ async move {
411+ video_source. start ( ) . await ?;
412+
413+ stop_token. cancelled ( ) . await ;
414+
415+ if let Err ( e) = video_source. stop ( ) . await {
416+ error ! ( "Video source stop failed: {e:#}" ) ;
417+ } ;
418+
419+ Ok ( ( ) )
420+ }
421+ } ) ;
422+
408423 setup_ctx. tasks ( ) . spawn ( "mux-video" , async move {
409424 use futures:: StreamExt ;
410425
411426 let mut first_tx = Some ( first_tx) ;
412427
413- video_source. start ( ) . await ?;
414-
415428 stop_token
416429 . run_until_cancelled ( async {
417430 while let Some ( frame) = video_rx. next ( ) . await {
@@ -432,8 +445,6 @@ fn spawn_video_encoder<TMutex: VideoMuxer<VideoFrame = TVideo::Frame>, TVideo: V
432445 } )
433446 . await ;
434447
435- video_source. stop ( ) . await . context ( "video_source_stop" ) ?;
436-
437448 muxer. lock ( ) . await . stop ( ) ;
438449
439450 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments