sendspin-kmp 0.2.0
implementation("io.github.music-assistant:sendspin-kmp:0.2.0")See sendspin-kmp/README.md for the repository setup.
Changes that need action
SendspinPlayerhas the new abstract functioncheckConnection(). Add it to eachSendspinPlayerimplementation outside the library, for example a test fake.- Constructor changes:
SendspinDepshas the new parameterencoders,LocalPlayerConfighassource, andPlayerState.ConnectedhassourceandsourceSignal. Each parameter has a default value, so the source stays compatible. Compile again the code that was compiled against 0.1.0. SourceStatusandSourceSignalare new enums. Awhenover them without anelsebranch needs a case for each entry.
Source role
- Sendspin
source@v1role: the client can send audio to the server. SetLocalPlayerConfig.sourceto aSourceConfigto offer the role. A null value offers theplayer@v1role only.PlayerState.Connected.sourcegives theSourceStatus. SourceDialect.SPECis the current spec shape.SourceDialect.RC1is the shape that aiosendspin 10.3.0 and older need.RC1also advertisesline_senseinclient/hello, which the current spec removed.SourceStatus.Unpaired: the server activated an unpaired session, which never gets the source role.SourceStatus.Offmeans that the server did not answer.- Source signal: under both dialects, the source reports
client/state.source.signal = "absent"after 5 seconds of silence in a stream (every sample at or below about -70 dBFS). It reports"present"on the first block above that level. The server can then stop a silent source. Music Assistant stops it after 60 seconds.PlayerState.Connected.sourceSignal(SourceSignal.PresentorSourceSignal.Absent) gives the signal that the source last reported. - New ports:
AudioCapture(withCaptureFormatandCapturedAudio), andEncoderFactorywithAudioEncoderandEncodedAudio. Without anEncoderFactory, the source sends PCM. - The source send queue holds 26 chunks at most, which is 500 ms of 20 ms PCM. The sender drops a chunk that is older than 500 ms. A FLAC chunk is longer, so for FLAC the age check alone bounds the queue.
- Android:
AndroidEncoderFactoryinio.music_assistant.sendspin.android, which has a FLAC encoder. The encoder keeps the capture time of each chunk after a capture stall, so the sender does not drop the later chunks as too old.
Player
SendspinPlayer.checkConnection()asks for a connection check, for example when the app comes to the foreground. A waiting reconnect starts at once from attempt 0. A connected player sends a clock probe burst at once, and repeats a silent burst with no wait. So a dead link ends after 3 probe timeouts. Without a check, the stall tolerance does not change.- FLAC and PCM also advertise 44.1 kHz, after the 48 kHz formats. From Music Assistant server 2.10.6, the server selects the rate of the source, so 44.1 kHz audio comes without a resample. An older server sends the first format (48 kHz). Opus stays at 48 kHz.
- A
stream/startduring an active stream continues the same timeline, as the spec says. The player keeps the buffered chunks, and each chunk keeps the format that it came with. The scheduler changes the decoder at the first chunk of a new format. It builds a new sink only when the output format changes, after the old audio was heard. - A
stream/clearwithfrom_timestampremoves only the buffered chunks at or after that time. Playback continues, and the player does not flush the sink or report a stop. - The player ignores a
stream/clearor astream/endwith aroleslist that does not containplayer. WireVersion.SPEC_1_0always offers and accepts the Pairing PSK, as spec 1.0.0-rc1 says. The storedpairing_psk_enabledflag applies toWireVersion.LEGACY_9only.- Clock: the receive time of a
server/timereply is the time when the transport delivers the frame, before the inbound queue and the decryption. Before, a reply behind an audio burst got a later time, and that mademax_errorlarger.Frame.Binary.receivedAtMicroscarries the time. ASendspinTransportfromEndpoint.WebRtc.openChannelmust set it with the player clock. A frame without it gets the time when the session reads it. - Android: BouncyCastle gives X25519 and ChaCha20-Poly1305 on all Android levels. Android 9 does not have the
ChaCha20-Poly1305cipher name, so the session failed there. - Android:
connectivityOnlineignores a lateonLostof the previous default network. Before, that event made the player offline after a network change. - Logs: a drift summary once a minute under the tag
Sendspin.Drift, and a line when a connect attempt becomes active and when a reconnect continues a stream.
Pull requests since sendspin-v0.1.0
- Fill the sendspin-kmp 0.2.0 CHANGELOG (#1443)
- Stamp the Sendspin clock receive time at the transport (#1442)
- Read device audio on a dedicated audio thread and bound the source send queue (#1418)
- Report a silent device audio share as signal absent so the server autostops it (#1417)
- Fix a session stuck in AwaitingServerInfo after a reconnect (#1434)
- Fix device audio share end causes, double release, bad consent and unpaired timeout (#1421)
- Keep FLAC source times right after a capture stall (#1426)
- Add source@v1 role and UI (#1412)
- Sendspin alignment (#1408)
- Several onboarding fixes (#1401)
- Advertise 44.1 kHz for the lossless local-player formats (#1398)
- Ping the WebSocket on Android to find a dead connection (#1396)
- Log a periodic Sendspin drift summary (#1379)
- Fix two Sendspin rc1 conformance gaps (#1375)
- Session state machine (#1357)
- Check the local player connection on app foreground (#1355)
- Make the sendspin release rerunnable and check consumers on PRs (#1263)
- Test the Android ports and check the library as a consumer (#1262)
- chore: bump sendspin-kmp version to 0.2.0 (#1261)