make ffmpeg logging a bit more verbose
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 26 Mar 2023 18:59:23 +0000 (20:59 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 26 Mar 2023 18:59:23 +0000 (20:59 +0200)
music_assistant/server/controllers/streams.py
music_assistant/server/helpers/audio.py
music_assistant/server/helpers/process.py

index cc157835a7527c39f3b3b4e27b7d56edb6b09ce2..eef53b5df284f099e1bb28d186591204021dacc4 100644 (file)
@@ -622,7 +622,7 @@ class StreamsController:
             "ffmpeg",
             "-hide_banner",
             "-loglevel",
-            "quiet",
+            "verbose" if LOGGER.isEnabledFor(logging.DEBUG) else "quiet",
             "-ignore_unknown",
         ]
         # input args
index 2db9893386502f34674ee1373f6fc821ca67d447..e71509713ef6cefb048398fca40c089b46c380b0 100644 (file)
@@ -17,14 +17,18 @@ from aiohttp import ClientTimeout
 from music_assistant.common.helpers.util import create_tempfile
 from music_assistant.common.models.errors import AudioError, MediaNotFoundError, MusicAssistantError
 from music_assistant.common.models.media_items import ContentType, MediaType, StreamDetails
-from music_assistant.constants import CONF_VOLUME_NORMALISATION, CONF_VOLUME_NORMALISATION_TARGET
+from music_assistant.constants import (
+    CONF_VOLUME_NORMALISATION,
+    CONF_VOLUME_NORMALISATION_TARGET,
+    ROOT_LOGGER_NAME,
+)
 from music_assistant.server.helpers.process import AsyncProcess, check_output
 
 if TYPE_CHECKING:
     from music_assistant.common.models.player_queue import QueueItem
     from music_assistant.server import MusicAssistant
 
-LOGGER = logging.getLogger(__name__)
+LOGGER = logging.getLogger(f"{ROOT_LOGGER_NAME}.audio")
 
 # pylint:disable=consider-using-f-string
 
@@ -498,7 +502,7 @@ async def get_radio_stream(
 ) -> AsyncGenerator[bytes, None]:
     """Get radio audio stream from HTTP, including metadata retrieval."""
     headers = {"Icy-MetaData": "1"}
-    timeout = ClientTimeout(total=0, connect=30, sock_read=600)
+    timeout = ClientTimeout(total=0, connect=30, sock_read=60)
     async with mass.http_session.get(url, headers=headers, timeout=timeout) as resp:
         headers = resp.headers
         meta_int = int(headers.get("icy-metaint", "0"))
@@ -550,7 +554,7 @@ async def get_http_stream(
     buffer = b""
     buffer_all = False
     bytes_received = 0
-    timeout = ClientTimeout(total=0, connect=30, sock_read=600)
+    timeout = ClientTimeout(total=0, connect=30, sock_read=5 * 60)
     async with mass.http_session.get(url, headers=headers, timeout=timeout) as resp:
         is_partial = resp.status == 206
         buffer_all = seek_position and not is_partial
@@ -743,7 +747,7 @@ async def _get_ffmpeg_args(
         "ffmpeg",
         "-hide_banner",
         "-loglevel",
-        "quiet",
+        "verbose" if LOGGER.isEnabledFor(logging.DEBUG) else "quiet",
         "-ignore_unknown",
     ]
     # collect input args
index 0d584c341305920486f12d1736c87ab2f2605238..c272426e7e3eea472ec5ec1e601bc588b94425a0 100644 (file)
@@ -46,7 +46,7 @@ class AsyncProcess:
                 stdout=asyncio.subprocess.PIPE if self._enable_stdout else None,
                 stderr=asyncio.subprocess.PIPE if self._enable_stderr else None,
                 close_fds=True,
-                limit=32000000,
+                limit=64 * 1024 * 1024,
             )
         else:
             self._proc = await asyncio.create_subprocess_exec(
@@ -55,7 +55,7 @@ class AsyncProcess:
                 stdout=asyncio.subprocess.PIPE if self._enable_stdout else None,
                 stderr=asyncio.subprocess.PIPE if self._enable_stderr else None,
                 close_fds=True,
-                limit=32000000,
+                limit=64 * 1024 * 1024,
             )
 
             # Fix BrokenPipeError due to a race condition