@@ -283,12 +283,8 @@ public function resumeAfterRestart(): void
283283 $ this ->presentationDj ?->resumeReader();
284284 $ this ->connection ?->resume();
285285 $ this ->presentationConnection ?->resume();
286- if ($ this ->streamMode ) {
287- // The stream receiver does not survive a restart (its recording does not either):
288- // follow the stream again from the live edge.
289- $ this ->streamReceiver = new StreamReceiver ($ this );
290- $ this ->streamReceiver ->start ($ this ->rtmpMode );
291- }
286+ // The stream receiver does not survive a restart, and neither does its recording: it's started again when a
287+ // recording is set, see setOutput().
292288 EventLoop ::queue ($ this ->refetch (...));
293289 }
294290
@@ -414,8 +410,9 @@ private function applyConnectionParams(array $params): void
414410 );
415411 $ this ->connection ?->close();
416412 $ this ->connection = null ;
417- $ this ->streamReceiver ??= new StreamReceiver ($ this );
418- $ this ->streamReceiver ->start ($ parsed ['rtmp ' ]);
413+ // Only to record: without a recording, it downloaded every chunk for nothing, and the flood waits of
414+ // downloading a few streams at once made it fall behind (TIME_TOO_SMALL), see setOutput().
415+ $ this ->streamReceiver ?->start($ parsed ['rtmp ' ]);
419416 return ;
420417 }
421418 if ($ parsed ['transport ' ] === null ) {
@@ -1143,6 +1140,7 @@ public function setOutput(LocalFile|WritableStream $file, string|int|null $parti
11431140 CallStream ::checkAvailable ($ streams , $ available , 'The stream ' );
11441141 $ this ->streamReceiver ??= new StreamReceiver ($ this );
11451142 $ this ->streamReceiver ->setOutput ($ file , $ format );
1143+ $ this ->streamReceiver ->start ($ this ->rtmpMode );
11461144 return $ available ;
11471145 }
11481146
@@ -1162,6 +1160,7 @@ public function setOutputFolder(LocalDirectory $dir, string|int|null $participan
11621160 }
11631161 $ this ->streamReceiver ??= new StreamReceiver ($ this );
11641162 $ this ->streamReceiver ->setOutputDirectory ($ dir , $ format );
1163+ $ this ->streamReceiver ->start ($ this ->rtmpMode );
11651164 return $ this ;
11661165 }
11671166
0 commit comments