|
YAACC - UPNP Client and Server
|
Runs a ClientEngine on its own thread and is fed by a connection of a protocol (for Snapcast see SnapcastEngineListener): it is the connection's listener, hands every event to the engine thread through a bounded queue (the connection's listener thread never waits for the audio), and cycles the engine.
More...

Classes | |
| interface | Observer |
| Receives the status; called on the engine thread. More... | |
Public Member Functions | |
| EngineHost (ClientEngine engine, int tickMs, ThreadFactory threads, Observer observer) | |
| synchronized void | start () |
Starts the thread, unless stop() or abandon() came first: a stop is final. | |
| void | stop () |
| Asks the thread to stop the engine and end; waits a little for it. | |
| boolean | isRunning () |
| EngineStatus | latestStatus () |
| The newest status, or null before the first cycle. | |
| long | queuedBytes () |
| The payload bytes of the chunks that wait in the queue. | |
| long | droppedForLackOfRoom () |
| Chunks that found no room in the queue. | |
| boolean | isStalled (long limitMs) |
True when the engine thread is inside one cycle for longer than limitMs (it is stuck in the decoder or the output) or the loop stopped coming round. | |
| void | abandon () |
| Gives the thread up (it is stuck): the owner frees the output itself. | |
| void | setConnectionSource (java.util.function.Supplier< ConnectionStats > stats, long idHash) |
| Where the counters of the connection come from, and a number that stands for the Hello id (not the id). | |
| void | onAttempt (int number) |
| void | onConnected () |
| void | traceEnding (int endingOrdinal) |
| Notes in the trace why the session ended (the trace is thread safe; the engine may be stopped already). | |
| void | traceServerSays (long found, long playing, long streams) |
| Notes in the trace what the server said about this client. | |
| void | setManualLatencyMs (int milliseconds) |
| void | onServerSettings (StreamSettings settings) |
| void | onCodecHeader (CodecHeader header) |
| void | onChunk (StreamChunk chunk) |
| void | onOffsetUpdate (long offsetMicros, long jitterMicros) |
| void | onConnectionLost (int reasonOrdinal, int limitCode) |
The connection to the source was lost (a LossReason ordinal, -1 if unknown, and our own limit code, 0 if none). | |
Runs a ClientEngine on its own thread and is fed by a connection of a protocol (for Snapcast see SnapcastEngineListener): it is the connection's listener, hands every event to the engine thread through a bounded queue (the connection's listener thread never waits for the audio), and cycles the engine.
The engine is touched by that one thread only.
The queue holds 1024 events; chunks are accepted only while it is less than three quarters full, so settings, headers and a loss always find room. A chunk that finds no room is dropped and counted. A watchdog (isStalled) tells the owner when the thread has not come round for too long (a stuck decoder or output).
| void de.yaacc.multiroom.engine.EngineHost.abandon | ( | ) |
Gives the thread up (it is stuck): the owner frees the output itself.
The observer hears the end once, now.

| void de.yaacc.multiroom.engine.EngineHost.stop | ( | ) |
Asks the thread to stop the engine and end; waits a little for it.
Do not call it on the main thread. A stop is final: after it start() does nothing, so a caller that is too late can not leave a thread behind. A host that never ran is ended here (its engine is touched by nobody else) and the end is reported.