|
YAACC - UPNP Client and Server
|
DRAFT of the tap of task 4.1 (not wired into the player, not verified on a device): a Media3 audio processor that hands everything ExoPlayer decodes to a PcmSink as 16 bit stereo at the stream's sample rate, and sends either silence or the unchanged audio on to the speaker.
More...


Public Member Functions | |
| PcmTapAudioProcessor (PcmFormat target, PcmSink sink, boolean playLocally) | |
| void | queueInput (ByteBuffer input) |
| long | getDroppedBuffers () |
| How many buffers the sink did not take (it was full or closed) since this processor was created. | |
Protected Member Functions | |
| AudioFormat | onConfigure (AudioFormat inputAudioFormat) throws UnhandledAudioFormatException |
| void | onFlush (StreamMetadata streamMetadata) |
| void | onReset () |
DRAFT of the tap of task 4.1 (not wired into the player, not verified on a device): a Media3 audio processor that hands everything ExoPlayer decodes to a PcmSink as 16 bit stereo at the stream's sample rate, and sends either silence or the unchanged audio on to the speaker.
It sits at the end of the chain built by FeedTapChain: the processors in front of it convert the bit depth (ToInt16PcmAudioProcessor) and the sample rate (SonicAudioProcessor); this one folds the channels to stereo with a PcmFormatConverter, which also converts any bit depth it is given. If the rate that reaches it is not the stream's (on a device the converter in front was seen not to act), it converts the rate itself with a PcmResampler; rates from 8000 to 384000 Hz are accepted, anything else is refused with an AudioProcessor.UnhandledAudioFormatException.
With playLocally == false the output is zeros of the same length as the input: ExoPlayer's clock keeps running at the speed of the audio track, which is what paces the decoder (and with it the sink), and the phone stays silent. The output keeps the input format, so the processors behind this one in ExoPlayer's chain see nothing unusual. A flush (seek, stop) calls PcmSink#discard(), so that queued audio of the old position is not heard.
queueInput runs on the playback thread of ExoPlayer and must not block for long: the sink is expected to wait a bounded time at most (PcmFeeder#write does). Data that the sink did not take is counted in getDroppedBuffers(); playback goes on.
| de.yaacc.multiroom.feed.PcmTapAudioProcessor.PcmTapAudioProcessor | ( | PcmFormat | target, |
| PcmSink | sink, | ||
| boolean | playLocally ) |
| target | the format of the stream; only PcmFormat#SNAPCAST_DEFAULT-like 16 bit stereo is supported |
| sink | receives the converted PCM |
| playLocally | true to pass the audio on to the speaker as well, false for silence there |