Use correct pcm format for airplay flow stream
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 3 Nov 2025 18:31:43 +0000 (19:31 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Mon, 3 Nov 2025 18:31:43 +0000 (19:31 +0100)
music_assistant/providers/airplay/player.py
music_assistant/providers/airplay/protocols/_protocol.py

index 20e0fe10f17b1bd0a2bc98ddaf77a1138253f5a6..fbbb009ea89f419f0237265836f09b7044180010 100644 (file)
@@ -23,7 +23,7 @@ from music_assistant.models.player import DeviceInfo, Player, PlayerMedia
 
 from .constants import (
     AIRPLAY_DISCOVERY_TYPE,
-    AIRPLAY_PCM_FORMAT,
+    AIRPLAY_FLOW_PCM_FORMAT,
     CACHE_CATEGORY_PREV_VOLUME,
     CONF_ACTION_FINISH_PAIRING,
     CONF_ACTION_START_PAIRING,
@@ -433,7 +433,7 @@ class AirPlayPlayer(Player):
         self._attr_current_media = media
 
         # select audio source
-        audio_source = self.mass.streams.get_stream(media, AIRPLAY_PCM_FORMAT)
+        audio_source = self.mass.streams.get_stream(media, AIRPLAY_FLOW_PCM_FORMAT)
 
         # if an existing stream session is running, we could replace it with the new stream
         if self.stream and self.stream.running:
@@ -448,7 +448,7 @@ class AirPlayPlayer(Player):
         # setup StreamSession for player (and its sync childs if any)
         sync_clients = self._get_sync_clients()
         provider = cast("AirPlayProvider", self.provider)
-        stream_session = AirPlayStreamSession(provider, sync_clients, AIRPLAY_PCM_FORMAT)
+        stream_session = AirPlayStreamSession(provider, sync_clients, AIRPLAY_FLOW_PCM_FORMAT)
         await stream_session.start(audio_source)
 
     async def volume_set(self, volume_level: int) -> None:
index a9e37356fbecae4adfe025e8cca5b467fb137634..85cd9aa5f109f567f36a5107b4852f2636f43f26 100644 (file)
@@ -7,11 +7,11 @@ from abc import ABC, abstractmethod
 from random import randint
 from typing import TYPE_CHECKING
 
-from music_assistant_models.enums import ContentType, PlaybackState
-from music_assistant_models.media_items import AudioFormat
+from music_assistant_models.enums import PlaybackState
 
 from music_assistant.constants import VERBOSE_LOG_LEVEL
 from music_assistant.helpers.named_pipe import AsyncNamedPipeWriter
+from music_assistant.providers.airplay.constants import AIRPLAY_PCM_FORMAT
 
 if TYPE_CHECKING:
     from music_assistant_models.player import PlayerMedia
@@ -32,9 +32,7 @@ class AirPlayProtocol(ABC):
     session: AirPlayStreamSession | None = None  # reference to the active stream session (if any)
 
     # the pcm audio format used for streaming to this protocol
-    pcm_format = AudioFormat(
-        content_type=ContentType.PCM_S16LE, sample_rate=44100, bit_depth=16, channels=2
-    )
+    pcm_format = AIRPLAY_PCM_FORMAT
     supports_pairing = False  # whether this protocol supports pairing
     is_pairing: bool = False  # whether this protocol instance is in pairing mode