|
YAACC - UPNP Client and Server
|
Opus through the platform's audio/opus encoder (MediaCodec, synchronous mode, API 29 and newer, no new dependency).
More...


Public Member Functions | |
| synchronized byte[] | encode (byte[] pcm) |
| synchronized void | close () |
| Frees the encoder. | |
Public Member Functions inherited from de.yaacc.audio.OpusPacketEncoder | |
Static Public Member Functions | |
| static OpusEncoderFactory | factory () |
| The factory for the Snapcast server and the Sendspin hub: it checks that the device has an Opus encoder. | |
Opus through the platform's audio/opus encoder (MediaCodec, synchronous mode, API 29 and newer, no new dependency).
One call takes one chunk of 20 ms and gives the first packet the encoder has ready; the packet of the first call may come later (the encoder has a look-ahead), which shifts the packets by one chunk at most and is no problem: the stamp of a chunk is the production time, and a missing packet is a hole that the clients fill. Thin glue, not unit tested.
Guesses that need a device: that the first output buffer is the configuration (flagged as such) and is skipped, that one input buffer of 20 ms gives one packet of 20 ms, and that 128 kbit/s stereo is what the encoder accepts.
| synchronized void de.yaacc.audio.MediaCodecOpusEncoder.close | ( | ) |
| synchronized byte[] de.yaacc.audio.MediaCodecOpusEncoder.encode | ( | byte[] | pcm | ) |
| pcm | one chunk: 960 frames of 16 bit stereo, little endian (20 ms at 48000 Hz) |
Implements de.yaacc.audio.OpusPacketEncoder.