YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.multiroom.engine.CodecDrain Class Reference

The loop that takes the decoded audio of one chunk out of a platform codec, with every bound the engine thread needs: a limit on the bytes (it stops at the first buffer that would exceed it, gives that buffer back without reading it and does not look at the rest), a limit on the number of buffers, and a deadline for the whole chunk. More...

Collaboration diagram for de.yaacc.multiroom.engine.CodecDrain:
Collaboration graph

Classes

interface  FormatCheck
 Looks at the new output format; throws when the engine can not use it. More...
 
enum  Kind
 What one call of the codec gave. More...
 
enum  Outcome
 Why the drain ended. More...
 
class  Result
 The audio (empty unless the outcome is OK) and why the drain ended.
 
interface  Source
 The output side of a codec. More...
 
class  Step
 One answer of the codec.
 

Public Member Functions

 CodecDrain (long limitBytes, int maxBuffers, long deadlineMillis, long timeoutMicros, LongSupplier nanos)
 
Result run (Source source, FormatCheck formatCheck) throws DecoderException
 

Detailed Description

The loop that takes the decoded audio of one chunk out of a platform codec, with every bound the engine thread needs: a limit on the bytes (it stops at the first buffer that would exceed it, gives that buffer back without reading it and does not look at the rest), a limit on the number of buffers, and a deadline for the whole chunk.

A hostile stream can make a decoder produce far more audio than it was given; without these bounds one chunk could keep the (high priority) audio thread busy for as long as the codec keeps answering. The codec itself is behind Source, so the bounds are tested with a fake; MediaCodecDecoder only adapts MediaCodec to it.


The documentation for this class was generated from the following file: