mass: MusicAssistant, # noqa: ARG001
streamdetails: StreamDetails,
seek_position: int = 0,
- raise_ffmpeg_exception: bool = False,
) -> AsyncGenerator[bytes, None]:
"""Return audio stream for a concatenation of multiple files.
"-ss",
str(seek_position),
],
- raise_ffmpeg_exception=raise_ffmpeg_exception,
):
yield chunk
finally:
chunk_size: int | None = None,
extra_input_args: list[str] | None = None,
extra_output_args: list[str] | None = None,
- raise_ffmpeg_exception: bool = False,
) -> AsyncGenerator[bytes, None]:
"""
Get the ffmpeg audio stream as async generator.
async for chunk in iterator:
yield chunk
if ffmpeg_proc.returncode not in (None, 0):
+ # unclean exit of ffmpeg - raise error with log tail
log_tail = "\n" + "\n".join(list(ffmpeg_proc.log_history)[-5:])
- if not raise_ffmpeg_exception:
- # dump the last 5 lines of the log in case of an unclean exit
- ffmpeg_proc.logger.error(log_tail)
- else:
- raise AudioError(log_tail)
+ raise AudioError(log_tail)
def get_ffmpeg_args( # noqa: PLR0915
# Apple ignores "Accept-Ranges=none" on iOS and iPadOS for some reason,
# so we need to slowly feed the music to avoid the Browser stopping and later
# restarting the audio stream (from a wrong position!) by keeping the buffer short.
- extra_input_args=["-readrate", "1.05", "-readrate_initial_burst", "8"],
+ extra_input_args=["-readrate", "1.02", "-readrate_initial_burst", "6"],
filter_params=get_player_filter_params(self.mass, player_id, pcm_format, stream_format),
):
try:
input_format=flow_pcm_format,
output_format=pcm_format,
filter_params=get_player_filter_params(
- self.mass, self.player_id, pcm_format, pcm_format
+ self.mass, self.player_id, flow_pcm_format, pcm_format
),
)