From 8312c9b09283a96a1bd61a238a9db1e95c57158f Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sun, 24 Mar 2024 17:15:54 +0100 Subject: [PATCH] Implement a safer way to deal with the buffer limit (#1173) --- music_assistant/server/helpers/process.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/music_assistant/server/helpers/process.py b/music_assistant/server/helpers/process.py index 83d1b1cf..299e410d 100644 --- a/music_assistant/server/helpers/process.py +++ b/music_assistant/server/helpers/process.py @@ -100,10 +100,6 @@ class AsyncProcess: stdin=stdin if self._enable_stdin else None, stdout=stdout if self._enable_stdout else None, stderr=asyncio.subprocess.PIPE if self._enable_stderr else None, - # setting the buffer limit somewhat high because we're working with large (PCM) - # audio chunks sent between (ffmpeg) processes. We'd rather consume a bit - # more memory than cpu cycles. - limit=1024000, ) LOGGER.debug("Started %s with PID %s", self._name, self.proc.pid) @@ -223,8 +219,7 @@ class AsyncProcess: while not self.closed: try: async with self._stderr_locked: - async for line in self.proc.stderr: - yield line + yield await self.proc.stderr.readline() except ValueError as err: # we're waiting for a line (separator found), but the line was too big # this may happen with ffmpeg during a long (radio) stream where progress -- 2.34.1