diff --git a/ytsage/core/ytsage_downloader.py b/ytsage/core/ytsage_downloader.py index 820b12b..3799143 100644 --- a/ytsage/core/ytsage_downloader.py +++ b/ytsage/core/ytsage_downloader.py @@ -839,9 +839,24 @@ class DownloadThread(QThread): def pause(self) -> None: self.paused = True + self._signal_process_group(signal.SIGSTOP if sys.platform != "win32" else None) def resume(self) -> None: self.paused = False + self._signal_process_group(signal.SIGCONT if sys.platform != "win32" else None) + + def _signal_process_group(self, sig: Optional[int]) -> None: + """Send a signal to yt-dlp's whole process group (yt-dlp + ffmpeg children). + + On Windows there is no SIGSTOP/SIGCONT; pausing there only stops output + consumption, which is a known limitation. + """ + if sig is None or not self.process: + return + try: + os.killpg(os.getpgid(self.process.pid), sig) + except (ProcessLookupError, PermissionError, OSError) as e: + logger.debug(f"Could not signal process group: {e}") def cancel(self) -> None: self.cancelled = True